Class: Commands

Inherits:
Hash
  • Object
show all
Defined in:
lib/commands.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Hash

#execute, #to_html

Constructor Details

#initialize(env = nil, directory = Rake.application.original_dir) ⇒ Commands

Returns a new instance of Commands.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/commands.rb', line 21

def initialize(env = nil, directory = Rake.application.original_dir)
  @env = env
  @env = Environment.new if @env.nil?
  Dir.chdir(directory) do
    self[:pull] = Pull.new
    self[:update] = Update.new
    self[:setup] = Setup.new
    self[:build] = Build.new
    self[:test] = Test.new
    self[:analyze] = Analyze.new
    self[:doc] = Doc.new
    self[:package] = Package.new
    self[:publish] = Publish.new
    self[:add] = Add.new
    self[:commit] = Commit.new
    self[:push] = Push.new
  end
end

Instance Attribute Details

#envObject

Returns the value of attribute env.



19
20
21
# File 'lib/commands.rb', line 19

def env
  @env
end

Instance Method Details

#infoObject



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/commands.rb', line 40

def info
  puts "Commands"
  each do |k, v|
    v.update if v.respond_to? "update"
    next unless v.length.positive?

    puts " #{k}"
    v.each do |c|
      puts "  #{c[:input]}" unless c.is_a?(Hash)
    end
  end
end