Class: Shakapacker::Runner
- Inherits:
-
Object
- Object
- Shakapacker::Runner
show all
- Defined in:
- lib/shakapacker/runner.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(argv) ⇒ Runner
Returns a new instance of Runner.
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/shakapacker/runner.rb', line 11
def initialize(argv)
@argv = argv
@app_path = File.expand_path(".", 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 = fetch_node_modules_bin_path
@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
5
6
7
8
9
|
# File 'lib/shakapacker/runner.rb', line 5
def self.run(argv)
$stdout.sync = true
ENV["NODE_ENV"] ||= (ENV["RAILS_ENV"] == "production") ? "production" : "development"
new(argv).run
end
|
Instance Method Details
#fetch_node_modules_bin_path ⇒ Object
30
31
32
33
34
|
# File 'lib/shakapacker/runner.rb', line 30
def fetch_node_modules_bin_path
return nil if Shakapacker::Utils::Misc.use_package_json_gem
ENV["SHAKAPACKER_NODE_MODULES_BIN_PATH"] || `yarn bin`.chomp
end
|