Class: Ovimap::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Ovimap::Generators::InstallGenerator
show all
- Includes:
- Helpers
- Defined in:
- lib/generators/ovimap/install/install_generator.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Helpers
#asset_path, #content_for, #heatmap_options, #js_path, #layouts, #map_select, #map_style, #map_swap, #nokia_script, #pin_options, #stylesheets
Class Method Details
.source_root ⇒ Object
10
11
12
|
# File 'lib/generators/ovimap/install/install_generator.rb', line 10
def self.source_root
@source_root ||= File.expand_path("../templates", __FILE__)
end
|
Instance Method Details
#install ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/generators/ovimap/install/install_generator.rb', line 14
def install
directory @source_root, "#{js_path}"
insert_into_file "#{layouts}/application.html.erb", "#{nokia_script}", :before => '</head>'
insert_into_file "#{layouts}/application.html.erb", '<%= yield :map %>', :before => '</body>'
unless ENV['APP_ID'] == nil || ENV['APP_TOKEN'] == nil
gsub_file "#{js_path}/map.js", /YOUR_APPID/, ENV['APP_ID']
gsub_file "#{js_path}/map.js", /YOUR_TOKEN/, ENV['APP_TOKEN']
printf "\e[32m \n\t\t\tSUCCESS. Now run 'rails g ovimap:build CONTROLLER ACTION'. The\n
CONTROLLER and ACTION should point to the location of the file which will have the\n
map.\n"
else
printf "\e[32m \n\t\t\tYou must first register as a Nokia Developer, then save your APP_ID\n
and APP_TOKEN as environmental variables in the bash_profile. For further information, please\n
see the documentation.\n"
end
end
|