Class: Fe::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Fe::InstallGenerator
- Defined in:
- lib/generators/fe/install_generator.rb
Instance Method Summary collapse
-
#complete ⇒ Object
TODO figure out image refernces def notify_about_images insert_into_file File.join(‘app’, ‘assets’, ‘images’, ‘application.css’) end.
- #create_database ⇒ Object
-
#install_migrations ⇒ Object
def additional_tweaks end.
- #noify_about_javascripts ⇒ Object
- #notify_about_routes ⇒ Object
- #notify_about_stylesheets ⇒ Object
-
#prepare_options ⇒ Object
def self.source_paths paths << File.expand_path(‘../templates’, “../../#__FILE__”) paths << File.expand_path(‘../templates’, “../#__FILE__”) paths << File.expand_path(‘../templates’, __FILE__) paths.flatten end.
- #run_migrations ⇒ Object
Instance Method Details
#complete ⇒ Object
TODO figure out image refernces def notify_about_images
insert_into_file File.join('app', 'assets', 'images', 'application.css')
end
122 123 124 125 126 127 128 129 |
# File 'lib/generators/fe/install_generator.rb', line 122 def complete unless [:quiet] puts "*" * 75 puts " " puts ">> Fe successfully installed. You're all ready to go!" puts ">> Enjoy!" end end |
#create_database ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/generators/fe/install_generator.rb', line 33 def create_database say_status :creating, "database" silence_stream(STDOUT) do silence_stream(STDERR) do silence_warnings { rake 'db:create' } end end end |
#install_migrations ⇒ Object
def additional_tweaks end
26 27 28 29 30 31 |
# File 'lib/generators/fe/install_generator.rb', line 26 def install_migrations say_status :copying, "migrations" silence_stream(STDOUT) do silence_warnings { rake 'fe_engine:install:migrations' } end end |
#noify_about_javascripts ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/generators/fe/install_generator.rb', line 75 def noify_about_javascripts insert_into_file File.join('app', 'assets', 'javascripts', 'application.js'), :before => "//= require_tree ." do %Q{//= require fe/application \n} end unless [:quiet] puts "*" * 75 puts "Added this to app's application.js file," puts " " puts " //= require fe/application" puts " " end end |
#notify_about_routes ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/generators/fe/install_generator.rb', line 51 def notify_about_routes insert_into_file File.join('config', 'routes.rb'), :after => "pplication.routes.draw do\n" do %Q{ # == Questionnaire # This line mounts QuestionnaireEngine's routes at the root of your application. # This means, any requests to URLs such as http://localhost:3000/admin/forms, # will go to Fe::Admin::FormsController. # # If you would like to change where this engine is mounted, simply change the # `:at` option to something different. mount Fe::Engine, :at => '/' \n } end unless [:quiet] puts "*" * 75 puts "We added the following line to your application's config/routes.rb file:" puts " " puts " mount Fe::Engine, :at => '/'" puts " " end end |
#notify_about_stylesheets ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/generators/fe/install_generator.rb', line 89 def notify_about_stylesheets insert_into_file File.join('app', 'assets', 'stylesheets', 'application.css'), :before => "*= require_tree ." do %Q{*= require fe/application \n } end unless [:quiet] puts "*" * 75 puts "Added this to app's stylesheets file," puts " " puts " *= require fe/application" puts " " end end |
#prepare_options ⇒ Object
def self.source_paths
paths << File.('../templates', "../../#{__FILE__}")
paths << File.('../templates', "../#{__FILE__}")
paths << File.('../templates', __FILE__)
paths.flatten
end
15 16 17 18 |
# File 'lib/generators/fe/install_generator.rb', line 15 def @run_migrations = [:migrate] @lib_name = [:lib_name] end |
#run_migrations ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/generators/fe/install_generator.rb', line 42 def run_migrations if @run_migrations say_status :running, "migrations" quietly { rake 'db:migrate' } else say_status :skipping, "migrations (don't forget to run rake db:migrate)" end end |