Class: RoCommands::Rails
- Inherits:
-
Base
- Object
- Thor
- Base
- RoCommands::Rails
show all
- Defined in:
- lib/ro_commands/rails.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
describe, start, usage
Methods included from Bash
#_bash, #bash, #bash_lines, #bash_per, #bashc, err, #handle_path, out, status
Class Method Details
.generators_map ⇒ Object
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/ro_commands/rails.rb', line 21
def generators_map
@generators_map ||= {
scaffold: 's',
migration: 'm',
model: 'mo',
controller: 'c',
assets: 'a',
task: 't'
}
end
|
.items ⇒ Object
52
53
54
|
# File 'lib/ro_commands/rails.rb', line 52
def items
@items ||= %w(migration scaffold model)
end
|
.items2 ⇒ Object
56
57
58
|
# File 'lib/ro_commands/rails.rb', line 56
def items2
@items2 ||= %w(controller task assets)
end
|
.method_added(method) ⇒ Object
9
10
11
12
13
14
15
|
# File 'lib/ro_commands/rails.rb', line 9
def method_added(method)
super
unless method.match(%r{})
meths << method
end
meths.uniq!
end
|
.meths ⇒ Object
17
18
19
|
# File 'lib/ro_commands/rails.rb', line 17
def meths
@meths ||= []
end
|
.set_shortcut_method(item) ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/ro_commands/rails.rb', line 32
def set_shortcut_method(item)
class_eval do
end
end
|
Instance Method Details
#get_assets ⇒ Object
120
121
122
123
124
|
# File 'lib/ro_commands/rails.rb', line 120
def get_assets
get_files('assets') do |f|
f.match(%r{(js|coffee|scss|css)$})
end
end
|
#get_controllers ⇒ Object
128
129
130
|
# File 'lib/ro_commands/rails.rb', line 128
def get_controllers
get_rails_files('controllers')
end
|
#get_migrations ⇒ Object
104
105
106
107
108
109
110
|
# File 'lib/ro_commands/rails.rb', line 104
def get_migrations
Find.find('db/migrate').select do |f|
f.match(%r{rb$})
end.map do |f|
File.basename(f).gsub(%r(^\d+_), "")
end
end
|
#get_models ⇒ Object
114
115
116
|
# File 'lib/ro_commands/rails.rb', line 114
def get_models
get_rails_files('models')
end
|
#scaffolds ⇒ Object
98
99
100
|
# File 'lib/ro_commands/rails.rb', line 98
def scaffolds
get_controllers
end
|