Module: WebpackerCli::RailsTemplate
- Defined in:
- lib/webpacker_cli/rails_template.rb
Class Method Summary collapse
- .bin_rails ⇒ Object
- .config_application ⇒ Object
- .gemfile(test = false) ⇒ Object
- .gemspec ⇒ Object
- .gemspec_deps ⇒ Object
- .rakefile ⇒ Object
Class Method Details
.bin_rails ⇒ Object
35 36 37 38 39 |
# File 'lib/webpacker_cli/rails_template.rb', line 35 def bin_rails %q$#!/usr/bin/env ruby APP_PATH = File.expand_path('../config/application', __dir__) require 'rails/commands'$ end |
.config_application ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/webpacker_cli/rails_template.rb', line 21 def config_application %q$require "action_controller/railtie" require "action_view/railtie" require "webpacker" module TestApp class Application < ::Rails::Application config.secret_key_base = "abcdef" config.eager_load = true config.webpacker.check_yarn_integrity = false end end$ end |
.gemfile(test = false) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/webpacker_cli/rails_template.rb', line 4 def gemfile(test = false) %Q$source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/\#{repo}.git" } gem 'rake', '>= 11' gem 'webpacker_cli', '#{WebpackerCli::VERSION}'#{ if test; ", path: '#{File.('../', __dir__)}'" end } $ + gemspec_deps end |
.gemspec ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/webpacker_cli/rails_template.rb', line 47 def gemspec begin Gem::Specification.find_by_name "webpacker_cli" rescue local_spec = File.("../../webpacker_cli.gemspec", __dir__) raise "Gemspec not found for 'webpacker_cli'!" unless File.exist? local_spec eval File.read(local_spec) end end |
.gemspec_deps ⇒ Object
41 42 43 44 45 |
# File 'lib/webpacker_cli/rails_template.rb', line 41 def gemspec_deps gemspec.runtime_dependencies. map {|i| "gem '#{i.name}', '#{i.requirement.requirements.join(' ')}'"}. join("\n") end |
.rakefile ⇒ Object
15 16 17 18 19 |
# File 'lib/webpacker_cli/rails_template.rb', line 15 def rakefile %q$require_relative "config/application" Rails.application.load_tasks$ end |