Class: Shakapacker::Runner
- Inherits:
-
Object
- Object
- Shakapacker::Runner
- Defined in:
- lib/shakapacker/runner.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Runner
constructor
A new instance of Runner.
Constructor Details
#initialize(argv) ⇒ Runner
Returns a new instance of Runner.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/shakapacker/runner.rb', line 9 def initialize(argv) @argv = argv @app_path = File.(".", Dir.pwd) @webpack_config = File.join(@app_path, "config/webpack/webpack.config.js") Shakapacker.set_shakapacker_env_variables_for_backward_compatibility @node_modules_bin_path = ENV["SHAKAPACKER_NODE_MODULES_BIN_PATH"] || `yarn bin`.chomp @shakapacker_config = ENV["SHAKAPACKER_CONFIG"] || File.join(@app_path, "config/shakapacker.yml") @shakapacker_config = Shakapacker.get_config_file_path_with_backward_compatibility(@shakapacker_config) unless File.exist?(@webpack_config) $stderr.puts "webpack config #{@webpack_config} not found, please run 'bundle exec rails shakapacker:install' to install Shakapacker with default configs or add the missing config file for your custom environment." exit! end end |
Class Method Details
.run(argv) ⇒ Object
3 4 5 6 7 |
# File 'lib/shakapacker/runner.rb', line 3 def self.run(argv) $stdout.sync = true ENV["NODE_ENV"] ||= (ENV["RAILS_ENV"] == "production") ? "production" : "development" new(argv).run end |