lib/vagrant-adam/action/pre_provision_script.rb
#
# Fetches or creates a provision script to the Host's
# Vagrant TMP directory.
#
Fetches or creates a provision script to the Host's
Vagrant TMP directory.
Fetches or creates a provision script to the Host ' s Vagrant TMP directory .
def fetch_or_create_pre_provision_script(env)
          @script_tmp_path =
            env[:tmp_path].join("#{Time.now.to_i}-#{provision_script_name}")
          @logger.info("Generating provision script at: #{@script_tmp_path}")
          url = @provision_script
          if File.file?(url) || url !~ /^[a-z0-9]+:.*$/i
            @logger.info('Assuming URL is a file.')
            file_path = File.expand_path(url)
            file_path = Vagrant::Util::Platform.cygwin_windows_path(file_path)
            url = "file:#{file_path}"
          end
          begin
            if windows_guest?
            else
              downloader = Vagrant::Util::Downloader.new(
                url,
                @script_tmp_path,
                {}
              )
              downloader.download!
            end
          rescue Vagrant::Errors::DownloaderInterrupted
            env[:ui].info(I18n.t('vagrant-adam.download.interrupted'))
            return
          end
        end
def fetch_or_create_pre_provision_script ( env ) @script_tmp_path = env [ :tmp_path ] . join ( "#{Time.now.to_i}-#{provision_script_name}" ) @logger . info ( "Generating provision script at: #{@script_tmp_path}" ) url = @provision_script if File . file? ( url ) || url !~ / ^[a-z0-9]+:.*$ /i @logger . info ( 'Assuming URL is a file.' ) file_path = File . expand_path ( url ) file_path = Vagrant :: Util :: Platform . cygwin_windows_path ( file_path ) url = "file:#{file_path}" end begin if windows_guest? else downloader = Vagrant :: Util :: Downloader . new ( url , @script_tmp_path , { } ) downloader . download! end rescue Vagrant :: Errors :: DownloaderInterrupted env [ :ui ] . info ( I18n . t ( 'vagrant-adam.download.interrupted' ) ) return end end
Fetches or creates a provision script to the Host's
Vagrant TMP directory.
Fetches or creates a provision script to the Host ' s Vagrant TMP directory .
# Download the provision script to a temporary path. # We store the temporary path as an instance variable so that # the `#recover` method can access it. # Not sure how to do this in Windows yet... # The downloader was interrupted, so just return, because that # means we were interrupted as well.
env
<not_specific>