Class: Qe::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Qe::InstallGenerator
- Defined in:
- lib/generators/qe/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
108 109 110 111 112 113 114 115 116 117 |
# File 'lib/generators/qe/install_generator.rb', line 108 def complete unless [:quiet] puts "*" * 75 puts " " puts ">> Questionnaire has been installed successfully." puts ">> You're all ready to go!" puts " " puts ">> Enjoy!" end end |
#create_database ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/generators/qe/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/qe/install_generator.rb', line 26 def install_migrations say_status :copying, "migrations" silence_stream(STDOUT) do silence_warnings { rake 'qe:install:migrations' } end end |
#noify_about_javascripts ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/generators/qe/install_generator.rb', line 76 def noify_about_javascripts insert_into_file File.join('app', 'assets', 'javascripts', 'application.js'), :before => "//= require_tree ." do %Q{//= require qe/application \n} end unless [:quiet] puts "*" * 75 puts "We added the following line tou your applications javascripts file," puts " " puts " //= require qe/application " 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/qe/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/user, will go to # Questionnaire::Elements. If you would like to change where this engine # is mounted, simply change the :at option to something different. # # DON'T TRUST THIS - We ask that you don't use the :as option here, as # Questionnaire relies on it being the default of "Qe" # mount Qe::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 Qe::Engine, :at => '/'" end end |
#notify_about_stylesheets ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/generators/qe/install_generator.rb', line 90 def notify_about_stylesheets insert_into_file File.join('app', 'assets', 'stylesheets', 'application.css'), :before => "*= require_tree ." do %Q{*= require qe/application \n } end unless [:quiet] puts "*" * 75 puts "We added the following line tou your applications stylesheets file," puts " " puts " //= require qe/application " 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/qe/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/qe/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 |