Class: Deals::CLI
Instance Method Summary collapse
- #create_user_class ⇒ Object
- #inject_carrierwave ⇒ Object
- #inject_devise ⇒ Object
- #inject_rails_admin ⇒ Object
- #install ⇒ Object
- #mount_deals_route ⇒ Object
- #say_upgraded ⇒ Object
- #update ⇒ Object
- #welcome ⇒ Object
Instance Method Details
#create_user_class ⇒ Object
63 64 65 |
# File 'lib/deals/cli.rb', line 63 def create_user_class run('rails generate model User') end |
#inject_carrierwave ⇒ Object
50 51 52 53 54 55 |
# File 'lib/deals/cli.rb', line 50 def inject_carrierwave puts 'add reference to carrierwave in GEMFILE' insert_into_file "Gemfile", "gem 'carrierwave'\n", :after => "gem 'rails_admin'\n" insert_into_file "Gemfile", "gem 'fog', '~> 1.3.1'", :after => "gem 'carrierwave'\n" create_file "config/initializers/carrierwave.rb", "require 'carrierwave/orm/activerecord'" end |
#inject_devise ⇒ Object
37 38 39 40 |
# File 'lib/deals/cli.rb', line 37 def inject_devise puts 'add reference to devise in GEMFILE' insert_into_file "Gemfile", "gem 'devise'\n", :after => "source 'https://rubygems.org'\n" end |
#inject_rails_admin ⇒ Object
44 45 46 47 |
# File 'lib/deals/cli.rb', line 44 def inject_rails_admin puts 'add reference to rails_admin in GEMFILE' insert_into_file "Gemfile", "gem 'rails_admin'\n", :after => "gem 'devise'\n" end |
#install ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/deals/cli.rb', line 8 def install if already_installed? update else inject_devise inject_rails_admin inject_carrierwave run('bundle install') run('rake deals:install:migrations') run('rake db:migrate') run('rails generate devise:install') run('rails generate devise User') run('rake db:migrate') run('rails g rails_admin:install') run('rake db:migrate') mount_deals_route welcome end end |
#mount_deals_route ⇒ Object
58 59 60 |
# File 'lib/deals/cli.rb', line 58 def mount_deals_route insert_into_file "config/routes.rb", "\n mount Deals::Engine => '/deals', :as => 'deals'\n", :after => "Application.routes.draw do\n" end |
#say_upgraded ⇒ Object
79 80 81 82 83 84 85 86 87 |
# File 'lib/deals/cli.rb', line 79 def say_upgraded say "" say "" say "" say "******************************************************************" say "******************************************************************" say "Deals Successfully Upgraded!" say "******************************************************************" end |
#update ⇒ Object
29 30 31 32 33 34 |
# File 'lib/deals/cli.rb', line 29 def update say "Deals install detected" say "Updating current Deals install" run('rake deals:install:migrations') say_upgraded end |
#welcome ⇒ Object
68 69 70 71 72 73 74 75 76 |
# File 'lib/deals/cli.rb', line 68 def welcome say "" say "" say "" say "******************************************************************" say "******************************************************************" say "Deals Successfully Installed!" say "******************************************************************" end |