Class: Rg::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Rg::InstallGenerator
show all
- Includes:
- Helper
- Defined in:
- lib/generators/rg/install_generator.rb
Constant Summary
Constants included
from Helper
Helper::APP_PATH, Helper::JS_PATH
Instance Method Summary
collapse
Methods included from Helper
#appName, #app_name, #bowerName, #camelizeLower, included, #railsName
Instance Method Details
#create_csrf_token_coffee ⇒ Object
45
46
47
48
49
|
# File 'lib/generators/rg/install_generator.rb', line 45
def create_csrf_token_coffee
return unless options[:"csrf-token"]
say "Creating app/csrf_token.coffee file"
template 'app/csrf_token.coffee.erb', APP_PATH + '/app/csrf_token.coffee'
end
|
#create_directories ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/generators/rg/install_generator.rb', line 20
def create_directories
say 'Creating new angular directory structure'
%w[
app
services
resources
controllers
filters
directives
].each{ |directory|
create_file APP_PATH + '/' + directory + '/.keep'
}
end
|
#create_main_coffee ⇒ Object
34
35
36
37
|
# File 'lib/generators/rg/install_generator.rb', line 34
def create_main_coffee
say "Creating app/main.coffee file"
template 'app/main.coffee.erb', APP_PATH + '/app/main.coffee'
end
|
#create_settings_coffee ⇒ Object
39
40
41
42
43
|
# File 'lib/generators/rg/install_generator.rb', line 39
def create_settings_coffee
say "Creating app/settings.coffee file"
@backend_url = options[:'backend-url']
template 'app/settings.coffee.erb', APP_PATH + '/app/settings.coffee'
end
|
#inject_into_sprockets ⇒ Object
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/generators/rg/install_generator.rb', line 51
def inject_into_sprockets
options[:manifests].each{ |manifest_file|
manifest_path = JS_PATH + '/' + manifest_file
if File.exists?(manifest_path)
manifest_data = File.read(manifest_path)
options[:libraries].reverse.each{ |library|
unless manifest_data =~ /require #{library}( |$)/
prepend_to_manifest manifest_path, library
end
}
else
create_manifest manifest_path, options[:libraries]
end
}
end
|