Class: Eastrails::Commands::Add
- Inherits:
-
Base
- Object
- Rails::Generators::Base
- Generator
- Base
- Eastrails::Commands::Add
show all
- Defined in:
- lib/eastrails/commands/add.rb
Constant Summary
collapse
- ALIASES =
{
"tdd" => ["rspec", "cucumber"],
"default" => ["tdd", "haml", "devise", "twitter_bootstrap"]
}
Instance Attribute Summary
Attributes inherited from Base
#parameter
Instance Method Summary
collapse
Methods inherited from Base
#initialize, #run_in_shell
Methods inherited from Generator
#initialize
Instance Method Details
#execute ⇒ Object
4
5
6
7
8
9
|
# File 'lib/eastrails/commands/add.rb', line 4
def execute
components = expand_aliases(parameter.component.split(",")).map do |name|
Eastrails::Components.class_for(name).new
end
components.map(&:add)
end
|
#expand_aliases(names) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/eastrails/commands/add.rb', line 16
def expand_aliases(names)
index = 0
while index < names.length
name = names[index]
if ALIASES[name]
names.delete_at index
names.insert index, *ALIASES[name]
else
index += 1
end
end
names
end
|