Class: GitPusshuTen::Commands::Bundler

Inherits:
Base
  • Object
show all
Defined in:
lib/gitpusshuten/modules/bundler/command.rb

Instance Attribute Summary

Attributes inherited from Base

#cli, #command, #configuration, #environment, #hooks, #perform_hooks

Instance Method Summary collapse

Methods inherited from Base

#c, #command_object, description, #e, #error, example, #g, #git, #help, #local, long_description, #message, #perform!, #perform_hooks!, #post_perform!, #pre_perform!, #prompt_for_root_password!, #prompt_for_user_password!, #r, #requires_user_existence!, #silent, #standard, usage, #validate!, #warning, #y, #yes?

Constructor Details

#initialize(*objects) ⇒ Bundler

Returns a new instance of Bundler.



8
9
10
11
12
13
14
# File 'lib/gitpusshuten/modules/bundler/command.rb', line 8

def initialize(*objects)
  super
  
  @command = cli.arguments.shift
  
  help if command.nil? or e.name.nil?
end

Instance Method Details

#perform_bundle!Object

Bundles gems



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/gitpusshuten/modules/bundler/command.rb', line 18

def perform_bundle!
  GitPusshuTen::Log.message "Bundling Gems for #{y(c.application)} (#{y(e.name)} environment)."
  installed = e.installed?('bundle')
  if not installed
    GitPusshuTen::Log.message "Couldn't find Bundler, installing the gem."
    Spinner.return :message => "Installing Bundler.." do
      e.execute_as_user('gem install bundler --no-ri --no-rdoc')
      installed = e.installed?('bundle')
      if not installed
        r("Unable to install Bundler.")
      else
        g("Done!")
      end
    end
  end
  
  exit if not installed
  
  Spinner.return :message => "Bundling Gems for #{y(c.application)}", :put => true do
    e.execute_as_user("cd '#{e.app_dir}'; bundle install --without test development")
  end
end