New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic --webpack delegation to new webpacker gem #27288

Merged
merged 3 commits into from Dec 9, 2016
File filter...
Filter file types
Jump to file or symbol
Failed to load files and symbols.
+16 −1
Diff settings

Always

Just for now

@@ -33,6 +33,9 @@ def self.add_shared_options_for(name)
class_option :javascript, type: :string, aliases: "-j",
desc: "Preconfigure for selected JavaScript library"

class_option :webpack, type: :boolean, default: false,
desc: "Preconfigure for app-like JavaScript with Webpack"

class_option :skip_yarn, type: :boolean, default: false,
desc: "Don't use Yarn for managing JavaScript dependencies"

@@ -128,6 +131,7 @@ def gemfile_entries
database_gemfile_entry,
webserver_gemfile_entry,
assets_gemfile_entry,
webpacker_gemfile_entry,
javascript_gemfile_entry,
jbuilder_gemfile_entry,
psych_gemfile_entry,
@@ -315,6 +319,13 @@ def assets_gemfile_entry
gems
end

def webpacker_gemfile_entry
if options[:webpack]
comment = "Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker"
GemfileEntry.new "webpacker", "~> 0.1", comment
end
end

def jbuilder_gemfile_entry
comment = "Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder"
GemfileEntry.new "jbuilder", "~> 2.5", comment, {}, options[:api]
@@ -414,6 +425,10 @@ def run_bundle
bundle_command("install") if bundle_install?
end

def run_webpack
rails_command "webpacker:install"
end

def generate_spring_binstubs
if bundle_install? && spring_install?
bundle_command("exec spring binstub --all")
@@ -357,7 +357,7 @@ def finish_template
end

public_task :apply_rails_template, :run_bundle
public_task :generate_spring_binstubs
public_task :run_webpack, :generate_spring_binstubs

def run_after_bundle_callbacks
@after_bundle_callbacks.each(&:call)
ProTip! Use n and p to navigate between commits in a pull request.