Class: Mapfish::Generators::ViewerGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Mapfish::Generators::ViewerGenerator
- Defined in:
- lib/generators/mapfish/viewer/viewer_generator.rb
Instance Method Summary collapse
Instance Method Details
#clone_viewer ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/generators/mapfish/viewer/viewer_generator.rb', line 10 def clone_viewer @viewer = ["name"] puts "Cloning viewer..." dir = Dir.mktmpdir begin git :clone => "--depth=1 #{['repo']} #{dir}" Dir.glob("#{dir}/*").each do |fn| if File.directory?(fn) name = File.basename(fn).sub(/.+?(build)?$/, "#{@viewer}\\1") puts "Copy viewer to 'public/apps/#{name}/..." directory fn, "public/apps/#{name}", :verbose => false end end ensure FileUtils.rm_rf dir end end |
#generate_viewer_html ⇒ Object
28 29 30 31 32 33 |
# File 'lib/generators/mapfish/viewer/viewer_generator.rb', line 28 def generate_viewer_html @viewer = ["name"] dest = "app/views/apps/#{@viewer}.html.erb" template "viewer.html.erb", dest puts "Please adapt javascript and css references in '#{dest}'" end |