Class: Anima::CLI
- Inherits:
-
Thor
- Object
- Thor
- Anima::CLI
- Defined in:
- lib/anima/cli.rb
Constant Summary collapse
- VALID_ENVIRONMENTS =
%w[development test production].freeze
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.exit_on_failure? ⇒ Boolean
9 10 11 |
# File 'lib/anima/cli.rb', line 9 def self.exit_on_failure? true end |
Instance Method Details
#install ⇒ Object
14 15 16 17 |
# File 'lib/anima/cli.rb', line 14 def install require_relative "installer" Installer.new.run end |
#start ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/anima/cli.rb', line 21 def start env = [:environment] unless VALID_ENVIRONMENTS.include?(env) say "Invalid environment: #{env}. Must be one of: #{VALID_ENVIRONMENTS.join(", ")}", :red exit 1 end ENV["RAILS_ENV"] = env unless File.directory?(File.("~/.anima")) say "Anima is not installed. Run 'anima install' first.", :red exit 1 end system(Anima.gem_root.join("bin/rails").to_s, "db:prepare") || abort("db:prepare failed") say "Anima booted successfully (#{env}).", :green end |