Module: Mayu::Commands
- Extended by:
- T::Sig
- Defined in:
- lib/mayu/commands.rb,
lib/mayu/commands/base.rb,
lib/mayu/commands/build.rb
Defined Under Namespace
Class Method Summary collapse
Class Method Details
.call(argv) ⇒ Object
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 40 41 42 43 44 45 46 |
# File 'lib/mayu/commands.rb', line 14 def self.call(argv) puts Colors.rainbow(BANNER) case argv in ["dev", *rest] # Initialize RMagick on start to avoid the following error: # objc[88493]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called. # We cannot safely call it or ignore it in the fork() child process. Crashing instead. require "rmagick" require_relative "server" Server.start(load_config(:dev)) in ["devbundle", *rest] require_relative "server" Server.start(load_config(:devbundle)) in ["build", *rest] require_relative "commands/build" Commands::Build.new( load_config( :prod, overrides: { "use_bundle" => false, "secret_key" => "not important, just needed to avoid an exception" } ) ).call(rest) in ["serve", *rest] require_relative "server" Server.start(load_config(:prod)) else puts "Invalid args: #{argv.inspect}" exit 1 end end |
.load_config(env, overrides: {}) ⇒ Object
53 54 55 |
# File 'lib/mayu/commands.rb', line 53 def self.load_config(env, overrides: {}) Mayu::Configuration.load_config(env, pwd: Dir.pwd, overrides:) end |