Class: Turbolog::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Turbolog::Generators::InstallGenerator
- Defined in:
- lib/generators/turbolog/install_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.source_root ⇒ Object
6 7 8 |
# File 'lib/generators/turbolog/install_generator.rb', line 6 def self.source_root File.dirname(__FILE__) + "/templates" end |
Instance Method Details
#backup_files ⇒ Object
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/generators/turbolog/install_generator.rb', line 41 def backup_files puts Color.blue(" ...................Backup Filess....................\n") inside("app/controllers") {(File.file? "users/omniauth_callbacks_controller.rb") ? (run "mv omniauth_callbacks_controller.rb omniauth_callbacks_controller.rb.bak") : (puts "No omniauth_callbacks_controller.rb")} inside("config/initializers") {(File.file? "devise.rb") ? (run "mv devise.rb devise.rb.bak") : (puts "No devise.rb")} inside("app/models") {(File.file? "user.rb") ? (run "mv user.rb user.rb.bak") : (puts "No user.rb")} inside("app/helpers") {(File.file? "application_helper.rb") ? (run "mv application_helper.rb application_helper.rb.bak") : (puts "No application_helper.rb")} inside("app/views/layouts") {(File.file? "application.html.erb") ? (run "cp application.html.erb application.html.erb.bak") : (puts "No application.html.erb")} inside("config") {(File.file? "routes.rb") ? (run "cp routes.rb routes.rb.bak") : (puts "No routes.rb")} directory "app" end |
#finish ⇒ Object
56 57 58 59 60 61 62 63 64 |
# File 'lib/generators/turbolog/install_generator.rb', line 56 def finish puts "\n" puts Color.blue(" ....................Finish Step 1/3..................\n") puts "Next: Please run the following command:\n" puts Color.blue("......................................................\n") puts "$ bundle install\n" puts "$ rails generate turbolog:config\n" puts Color.blue("......................................................\n") end |
#remove_devise ⇒ Object
51 52 53 54 |
# File 'lib/generators/turbolog/install_generator.rb', line 51 def remove_devise puts Color.blue(" ..............Remove devise from routes.............\n") gsub_file 'config/routes.rb',/devise_for.*\n/,'' end |
#setup_gems ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/generators/turbolog/install_generator.rb', line 10 def setup_gems puts Color.blue(" ....................Insert Gems....................\n") gem 'devise' gem 'mongo', '~> 2.2' gem 'bson', '~> 4.0' gem 'mongoid', github: 'mongodb/mongoid' gem 'nokogiri' # use for jinda/doc gem 'haml', '~> 5.0', '>= 5.0.4' gem 'haml-rails' gem 'bcrypt' gem 'omniauth-identity' gem 'omniauth-facebook' gem 'dotenv-rails' gem_group :development, :test do gem 'rspec' gem 'rspec-rails' gem 'better_errors' gem 'binding_of_caller' gem 'pry-byebug' gem 'factory_bot_rails' gem 'guard' gem 'guard-rspec' gem 'guard-minitest' gem 'capybara' gem 'rb-fsevent' gem 'simplecov' gem 'faker', :git => 'https://github.com/stympy/faker.git', :branch => 'master' gem 'database_cleaner' end end |