Sha256: f6e9380dbb7b50075889dc53ee52628cd49d6b06a877fa8947f534cd9ef8818e

Contents?: true

Size: 1.63 KB

Versions: 3

Compression:

Stored size: 1.63 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 -s -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

3 entries across 3 versions & 1 rubygems

Version Path
factorylabs-fdlcap-0.3.15 lib/fdlcap/recipes/geminstaller.rb
factorylabs-fdlcap-0.3.16 lib/fdlcap/recipes/geminstaller.rb
factorylabs-fdlcap-0.3.17 lib/fdlcap/recipes/geminstaller.rb