-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix tests and update the test app to Rails 5.1 / Webpacker 2
* update example app to Rails 5.1 * update example app to Webpacker 2 * added rake tasks to run yarn and webpacker in the example app before tests (related to #16)
- Loading branch information
Showing
32 changed files
with
5,270 additions
and
3,240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
source "https://rubygems.org" | ||
|
||
gem "rubocop", ">= 0.47", require: false | ||
gem "rails", github: "rails/rails" | ||
gem "arel", github: "rails/arel" | ||
gem "webpacker", github: "rails/webpacker" | ||
gem "rails", "~> 5.1.1" | ||
gem "webpacker", "~> 2.0.0" | ||
|
||
# Specify your gem's dependencies in webpacker-react.gemspec | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
PATH | ||
remote: . | ||
specs: | ||
webpacker-react (0.2.0) | ||
webpacker | ||
|
||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
actioncable (5.1.1) | ||
actionpack (= 5.1.1) | ||
nio4r (~> 2.0) | ||
websocket-driver (~> 0.6.1) | ||
actionmailer (5.1.1) | ||
actionpack (= 5.1.1) | ||
actionview (= 5.1.1) | ||
activejob (= 5.1.1) | ||
mail (~> 2.5, >= 2.5.4) | ||
rails-dom-testing (~> 2.0) | ||
actionpack (5.1.1) | ||
actionview (= 5.1.1) | ||
activesupport (= 5.1.1) | ||
rack (~> 2.0) | ||
rack-test (~> 0.6.3) | ||
rails-dom-testing (~> 2.0) | ||
rails-html-sanitizer (~> 1.0, >= 1.0.2) | ||
actionview (5.1.1) | ||
activesupport (= 5.1.1) | ||
builder (~> 3.1) | ||
erubi (~> 1.4) | ||
rails-dom-testing (~> 2.0) | ||
rails-html-sanitizer (~> 1.0, >= 1.0.3) | ||
activejob (5.1.1) | ||
activesupport (= 5.1.1) | ||
globalid (>= 0.3.6) | ||
activemodel (5.1.1) | ||
activesupport (= 5.1.1) | ||
activerecord (5.1.1) | ||
activemodel (= 5.1.1) | ||
activesupport (= 5.1.1) | ||
arel (~> 8.0) | ||
activesupport (5.1.1) | ||
concurrent-ruby (~> 1.0, >= 1.0.2) | ||
i18n (~> 0.7) | ||
minitest (~> 5.1) | ||
tzinfo (~> 1.1) | ||
addressable (2.5.0) | ||
public_suffix (~> 2.0, >= 2.0.2) | ||
arel (8.0.0) | ||
ast (2.3.0) | ||
builder (3.2.3) | ||
capybara (2.12.0) | ||
addressable | ||
mime-types (>= 1.16) | ||
nokogiri (>= 1.3.3) | ||
rack (>= 1.0.0) | ||
rack-test (>= 0.5.4) | ||
xpath (~> 2.0) | ||
cliver (0.3.2) | ||
concurrent-ruby (1.0.5) | ||
erubi (1.6.0) | ||
globalid (0.4.0) | ||
activesupport (>= 4.2.0) | ||
i18n (0.8.1) | ||
loofah (2.0.3) | ||
nokogiri (>= 1.5.9) | ||
mail (2.6.5) | ||
mime-types (>= 1.16, < 4) | ||
method_source (0.8.2) | ||
mime-types (3.1) | ||
mime-types-data (~> 3.2015) | ||
mime-types-data (3.2016.0521) | ||
mini_portile2 (2.1.0) | ||
minitest (5.10.1) | ||
multi_json (1.12.1) | ||
nio4r (2.0.0) | ||
nokogiri (1.7.0.1) | ||
mini_portile2 (~> 2.1.0) | ||
parser (2.4.0.0) | ||
ast (~> 2.2) | ||
poltergeist (1.13.0) | ||
capybara (~> 2.1) | ||
cliver (~> 0.3.1) | ||
websocket-driver (>= 0.2.0) | ||
powerpack (0.1.1) | ||
public_suffix (2.0.5) | ||
rack (2.0.1) | ||
rack-test (0.6.3) | ||
rack (>= 1.0) | ||
rails (5.1.1) | ||
actioncable (= 5.1.1) | ||
actionmailer (= 5.1.1) | ||
actionpack (= 5.1.1) | ||
actionview (= 5.1.1) | ||
activejob (= 5.1.1) | ||
activemodel (= 5.1.1) | ||
activerecord (= 5.1.1) | ||
activesupport (= 5.1.1) | ||
bundler (>= 1.3.0, < 2.0) | ||
railties (= 5.1.1) | ||
sprockets-rails (>= 2.0.0) | ||
rails-dom-testing (2.0.3) | ||
activesupport (>= 4.2.0) | ||
nokogiri (>= 1.6) | ||
rails-html-sanitizer (1.0.3) | ||
loofah (~> 2.0) | ||
railties (5.1.1) | ||
actionpack (= 5.1.1) | ||
activesupport (= 5.1.1) | ||
method_source | ||
rake (>= 0.8.7) | ||
thor (>= 0.18.1, < 2.0) | ||
rainbow (2.2.1) | ||
rake (10.5.0) | ||
rubocop (0.47.1) | ||
parser (>= 2.3.3.1, < 3.0) | ||
powerpack (~> 0.1) | ||
rainbow (>= 1.99.1, < 3.0) | ||
ruby-progressbar (~> 1.7) | ||
unicode-display_width (~> 1.0, >= 1.0.1) | ||
ruby-progressbar (1.8.1) | ||
sprockets (3.7.1) | ||
concurrent-ruby (~> 1.0) | ||
rack (> 1, < 3) | ||
sprockets-rails (3.2.0) | ||
actionpack (>= 4.0) | ||
activesupport (>= 4.0) | ||
sprockets (>= 3.0.0) | ||
thor (0.19.4) | ||
thread_safe (0.3.6) | ||
tzinfo (1.2.3) | ||
thread_safe (~> 0.1) | ||
unicode-display_width (1.1.3) | ||
webpacker (2.0) | ||
activesupport (>= 4.2) | ||
multi_json (~> 1.2) | ||
railties (>= 4.2) | ||
websocket-driver (0.6.5) | ||
websocket-extensions (>= 0.1.0) | ||
websocket-extensions (0.1.2) | ||
xpath (2.0.0) | ||
nokogiri (~> 1.3) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
bundler (~> 1.13) | ||
capybara | ||
minitest (~> 5.0) | ||
poltergeist | ||
rails (~> 5.1.1) | ||
rake (~> 10.0) | ||
rubocop (>= 0.47) | ||
webpacker (~> 2.0.0) | ||
webpacker-react! | ||
|
||
BUNDLED WITH | ||
1.15.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# webpacker:check_webpack_binstubs is looking for binstubs | ||
# in the gem root directory. We need to disable it for our | ||
# tests, as it tries to check they exist when loading the | ||
# example app | ||
|
||
task "webpacker:check_webpack_binstubs" | ||
Rake::Task["webpacker:check_webpack_binstubs"].clear |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require "English" | ||
|
||
namespace :example_app do | ||
desc "Runs yarn in test/example_app" | ||
task :yarn do | ||
sh "cd test/example_app && yarn" | ||
end | ||
|
||
desc "Runs webpack in test/example_app" | ||
task webpack: :yarn do | ||
sh "cd test/example_app && NODE_ENV=test ./bin/webpack" | ||
end | ||
end | ||
|
||
Rake::Task["test"].enhance ["example_app:webpack"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"env", | ||
{ | ||
"modules": false, | ||
"targets": { | ||
"browsers": "> 1%", | ||
"uglify": true | ||
}, | ||
"useBuiltIns": true | ||
} | ||
], | ||
"react" | ||
], | ||
"plugins": [ | ||
"syntax-dynamic-import", | ||
[ | ||
"transform-class-properties", | ||
{ | ||
"spec": true | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
plugins: | ||
postcss-smart-import: {} | ||
precss: {} | ||
autoprefixer: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,28 @@ | ||
#!/usr/bin/env ruby | ||
$stdout.sync = true | ||
|
||
RAILS_ENV = ENV["RAILS_ENV"] || "development" | ||
WEBPACK_ENV = ENV["WEBPACK_ENV"] || RAILS_ENV | ||
require "shellwords" | ||
require "yaml" | ||
|
||
APP_PATH = File.expand_path("../", __dir__) | ||
VENDOR_PATH = File.expand_path("../vendor", __dir__) | ||
ENV["RAILS_ENV"] ||= "development" | ||
RAILS_ENV = ENV["RAILS_ENV"] | ||
|
||
SET_NODE_PATH = "NODE_PATH=#{VENDOR_PATH}/node_modules" | ||
WEBPACK_BIN = "./node_modules/webpack/bin/webpack.js" | ||
WEBPACK_CONFIG = "#{APP_PATH}/config/webpack/#{WEBPACK_ENV}.js" | ||
ENV["NODE_ENV"] ||= RAILS_ENV | ||
NODE_ENV = ENV["NODE_ENV"] | ||
|
||
Dir.chdir(VENDOR_PATH) do | ||
exec "#{SET_NODE_PATH} #{WEBPACK_BIN} --config #{WEBPACK_CONFIG} #{ARGV.join(" ")}" | ||
APP_PATH = File.expand_path("../", __dir__) | ||
NODE_MODULES_PATH = File.join(APP_PATH, "node_modules") | ||
WEBPACK_CONFIG = File.join(APP_PATH, "config/webpack/#{NODE_ENV}.js") | ||
|
||
unless File.exist?(WEBPACK_CONFIG) | ||
puts "Webpack configuration not found." | ||
puts "Please run bundle exec rails webpacker:install to install webpacker" | ||
exit! | ||
end | ||
|
||
newenv = { "NODE_PATH" => NODE_MODULES_PATH.shellescape } | ||
cmdline = ["yarn", "run", "webpack", "--", "--config", WEBPACK_CONFIG] + ARGV | ||
|
||
Dir.chdir(APP_PATH) do | ||
exec newenv, *cmdline | ||
end |
Oops, something went wrong.