Sha256: b50ffc580dc2aa926314b28edb120faf7996bd355b2ace250817d380101a46ed

Contents?: true

Size: 1.64 KB

Versions: 9

Compression:

Stored size: 1.64 KB

Contents

Capistrano::Configuration.instance(:must_exist).load do
  define_recipe :geminstaller do
    #
    # Tasks
    #
    namespace :geminstaller do
      desc <<-DESC
      install geminstaller
      DESC
      task :install, :only => { :geminstaller => true } do
        as = fetch(:runner, "app")
        via = fetch(:run_method, :sudo)
        invoke_command "gem install geminstaller", :via => via, :as => as
        invoke_command "gem source -a http://gems.github.com", :via => via, :as => as
      end

      desc <<-DESC
      run geminstaller rake task to install gems on the server
      DESC
      task :run, :only => { :geminstaller => true } do
        as = fetch(:runner, "app")
        via = fetch(:run_method, :sudo)
        invoke_command "/usr/bin/geminstaller -c #{current_path}/config/geminstaller.yml  --geminstaller-output=all --rubygems-output=all", :via => via, :as => as
      end

      desc <<-DESC
      add geminstaller config to list of remote dependencies.
      DESC
      task :add_remote_gem_dependencies, :only => { :geminstaller => true } do
        CONFIG_PATH = File.join('config', 'geminstaller.yml')
        if File.exists?(CONFIG_PATH)
          gems = YAML.load(ERB.new(File.read(CONFIG_PATH)).result)['gems']
          gems.each do |gem|
            depend :remote, :gem, gem['name'], gem['version']
          end
        end
      end
    end
    
    # 
    # Callbacks
    #
    before "deploy:check",          "geminstaller:add_remote_gem_dependencies"
    after  "deploy:setup",          "geminstaller:install"
    after  "geminstaller:install",  "geminstaller:run"
    after  "deploy:update",         "geminstaller:run"
  end
  
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
factorylabs-fdlcap-0.3.10 lib/fdlcap/recipes/geminstaller.rb
factorylabs-fdlcap-0.3.11 lib/fdlcap/recipes/geminstaller.rb
factorylabs-fdlcap-0.3.3 lib/fdlcap/recipes/geminstaller.rb
factorylabs-fdlcap-0.3.4 lib/fdlcap/recipes/geminstaller.rb
factorylabs-fdlcap-0.3.5 lib/fdlcap/recipes/geminstaller.rb
factorylabs-fdlcap-0.3.6 lib/fdlcap/recipes/geminstaller.rb
factorylabs-fdlcap-0.3.7 lib/fdlcap/recipes/geminstaller.rb
factorylabs-fdlcap-0.3.8 lib/fdlcap/recipes/geminstaller.rb
factorylabs-fdlcap-0.3.9 lib/fdlcap/recipes/geminstaller.rb