lib/generators/apitome/install/install_generator.rb in apitome-0.0.4 vs lib/generators/apitome/install/install_generator.rb in apitome-0.0.6
- old
+ new
@@ -3,12 +3,23 @@
class InstallGenerator < Rails::Generators::Base
source_root File.expand_path("../", __FILE__)
desc "Installs the Apitome initializer and markdown file into your application."
+ class_option :assets, type: :boolean,
+ aliases: "-a",
+ default: false,
+ desc: "Install the javascript and stylesheet assets to /public"
+
def copy_initializers
copy_file "templates/initializer.rb", "config/initializers/apitome.rb"
copy_file "templates/api.md", "doc/api.md"
+ end
+
+ def copy_assets
+ return unless options[:assets]
+ copy_file "../../../../app/assets/javascripts/apitome/bundle.js", "public/javascripts/apitome/application.js"
+ copy_file "../../../../app/assets/stylesheets/apitome/bundle.css", "public/stylesheets/apitome/application.css"
end
def display_readme
readme "POST_INSTALL" if behavior == :invoke
end