Class: Locomotive::Cmd::Checker
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Locomotive::Cmd::Checker
- Includes:
- Thor::Actions
- Defined in:
- lib/locomotive_cmd/checker.rb
Instance Method Summary collapse
- #check_locomotive_version ⇒ Object
- #check_smtp ⇒ Object
- #verify_rails ⇒ Object
- #verify_rails_path ⇒ Object
- #verify_ruby ⇒ Object
Instance Method Details
#check_locomotive_version ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/locomotive_cmd/checker.rb', line 43 def check_locomotive_version if const_exists?('Locomotive') locomotive_version = Locomotive::VERSION default_version = Locomotive::Cmd::Config['versions']['default'] if locomotive_version == default_version say 'Locomotive is up to date: ✔', :green else say "Locomotive is not up to date: ✗ (current version: #{default_version})", :red end else say 'Locomotive installation: ✗ (please add "gem \'locomotive_cms\'" to your Gemfile)', :red end end |
#check_smtp ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/locomotive_cmd/checker.rb', line 57 def check_smtp smtp_settings = ActionMailer::Base.smtp_settings if smtp_settings[:address] == "smtp.sendgrid.net" && smtp_settings[:user_name] == 'didier' && smtp_settings[:password] == 'I<3locomotive' say 'Smtp configuration: ✔', :green elsif smtp_settings[:address] == "smtp.sendgrid.net" && (smtp_settings[:user_name] != 'didier' || smtp_settings[:password] != 'I<3locomotive') say "Please configure your smtp server in ./config/environments/production.rb", :yellow say "Smtp configuration: ✗", :red elsif smtp_settings[:address] != 'localhost' && smtp_settings[:user_name].present? && smtp_settings[:password].present? say 'Smtp configuration: ✔', :green else say "Please configure your smtp server in ./config/environments/production.rb", :yellow say "Smtp configuration: ✗", :red end end |
#verify_rails ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/locomotive_cmd/checker.rb', line 34 def verify_rails rails_version = `rails -v` if rails_version.include? '3.2' say 'rails version: ✔', :green else say "rails version: ✗ (needed 3.2 at least got #{rails_version}", :red end end |
#verify_rails_path ⇒ Object
18 19 20 21 22 23 |
# File 'lib/locomotive_cmd/checker.rb', line 18 def verify_rails_path unless File.exists? File.join('.', 'script', 'rails') say "Current folder is not a Rails application", :red exit -1 end end |
#verify_ruby ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/locomotive_cmd/checker.rb', line 25 def verify_ruby ruby_version = `ruby -v` if ruby_version.include? '1.9' say 'ruby version: ✔', :green else say "ruby version: ✗ (needed 1.9 at least got #{ruby_version}", :red end end |