webpack_integration 0.1.5 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/webpack_integration/assets.rb +1 -1
- data/lib/webpack_integration/version.rb +1 -1
- data/lib/webpack_integration/view_helper.rb +5 -1
- data/test/apps/test_rails_app.rb +23 -0
- data/test/apps/test_rails_app/view_test/index.html.erb +2 -0
- data/test/railtie_test.rb +25 -0
- data/test/store_test.rb +3 -3
- data/test/test_helper.rb +12 -1
- data/webpack_integration.gemspec +3 -0
- metadata +49 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ca5ac36aa834d18c99bec9f6b746792475b46a8
|
4
|
+
data.tar.gz: eda9c3e4764fc933ec84d35d30380bf0c57bd87f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a281992e171e7e6334bd7064f22c854d1e02580109b3164a2ac522794454acdb0f57aadf37e319e665abd480f1668c86c2eab78b0d1e3d18cdfa3d57b9f1a460
|
7
|
+
data.tar.gz: b6b71b7265136f735a11bf5f12b893ac6cc7dec71a74adecfc326a62fbd0e5f46d6031a54d87cf31656115978f1df208f7596dc6fdab669c76afd9e4a26fa4aa
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'rails'
|
2
|
+
require 'action_controller/railtie'
|
3
|
+
|
4
|
+
module TestRailsApp
|
5
|
+
class Application < Rails::Application
|
6
|
+
config.secret_token = '572c86f5ede338bd8aba8dae0fd3a326aabababc98d1e6ce34b9f5'
|
7
|
+
config.eager_load = false
|
8
|
+
routes.draw do
|
9
|
+
get '/view_test' => 'test_rails_app/view_test#index'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class ViewTestController < ActionController::Base
|
14
|
+
before_filter :set_view_path
|
15
|
+
def index
|
16
|
+
#render text: view_context.webpack_fuzzy_file('common.js')
|
17
|
+
end
|
18
|
+
|
19
|
+
def set_view_path
|
20
|
+
self.view_paths.push(File.dirname(__FILE__))
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require './test/test_helper'
|
2
|
+
|
3
|
+
describe 'WebpackIntegration::Railtie' do
|
4
|
+
before do
|
5
|
+
WebpackIntegration.configure do |config|
|
6
|
+
config.public_folder = 'test/fixtures'
|
7
|
+
config.folder_in_public = 'webpack'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
describe 'view_helper in views' do
|
12
|
+
include Rack::Test::Methods
|
13
|
+
def app
|
14
|
+
Rails.logger = Logger.new(STDOUT)
|
15
|
+
TestRailsApp::Application
|
16
|
+
end
|
17
|
+
|
18
|
+
it "works" do
|
19
|
+
get '/view_test'
|
20
|
+
assert last_response.ok?
|
21
|
+
last_response.body.must_equal "/webpack/common-2e7d2c0.js\n/webpack/common-2e7d2c0.js"
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
data/test/store_test.rb
CHANGED
@@ -20,7 +20,7 @@ describe 'WebpackIntegration::Store' do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
it "contains cleaned up file names, that you want to use in your application" do
|
23
|
-
expected = ["
|
23
|
+
expected = ["brand_view-bundle.js", "brand_view_styles-bundle.js", "common.js", "executive_view-bundle.js", "executive_view_styles-bundle.js", "img/logo.png", "img/logo_for_runaways.png"]
|
24
24
|
WebpackIntegration::Store.assets_keys.must_equal expected
|
25
25
|
end
|
26
26
|
end
|
@@ -28,7 +28,7 @@ describe 'WebpackIntegration::Store' do
|
|
28
28
|
|
29
29
|
describe 'assets_manifest' do
|
30
30
|
it "is a hash-map, that maps clean names to digested names with full path" do
|
31
|
-
expected = {"
|
31
|
+
expected = {"brand_view-bundle.js"=>"/webpack/brand_view-bundle-3e23e81.js", "brand_view_styles-bundle.js"=>"/webpack/brand_view_styles-bundle-ca97811.js", "common.js"=>"/webpack/common-2e7d2c0.js", "executive_view-bundle.js"=>"/webpack/executive_view-bundle-3f79bb7.js", "executive_view_styles-bundle.js"=>"/webpack/executive_view_styles-bundle-18ac3e7.js", "img/logo.png"=>"/webpack/img/logo-0ebe2ec.png", "img/logo_for_runaways.png"=>"/webpack/img/logo_for_runaways-907b853.png"}
|
32
32
|
WebpackIntegration::Store.assets_manifest.must_equal(expected)
|
33
33
|
end
|
34
34
|
end
|
@@ -36,7 +36,7 @@ describe 'WebpackIntegration::Store' do
|
|
36
36
|
describe 'file_for' do
|
37
37
|
it "returns the exact match on keys" do
|
38
38
|
expected = '/webpack/brand_view-bundle-3e23e81.js'
|
39
|
-
WebpackIntegration::Store.file_for('
|
39
|
+
WebpackIntegration::Store.file_for('brand_view-bundle.js').must_equal expected
|
40
40
|
end
|
41
41
|
|
42
42
|
it "blows up otherwise" do
|
data/test/test_helper.rb
CHANGED
@@ -10,10 +10,21 @@ if ENV['CI']=='true'
|
|
10
10
|
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
11
11
|
end
|
12
12
|
|
13
|
-
|
13
|
+
require 'pry'
|
14
14
|
Bundler.setup
|
15
15
|
|
16
|
+
require './test/apps/test_rails_app'
|
16
17
|
require 'webpack_integration'
|
18
|
+
|
19
|
+
# we need to initialize application after loading webpack_integration, so railtie hooks run!
|
20
|
+
Rails.application.initialize!
|
21
|
+
# somehow the routes are gone after init, but I dont care why, just re-init them
|
22
|
+
TestRailsApp::Application.routes.draw do
|
23
|
+
get '/view_test' => 'test_rails_app/view_test#index'
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
require 'rack/test'
|
17
28
|
require 'maxitest'
|
18
29
|
require 'mocha/mini_test'
|
19
30
|
require 'maxitest/autorun'
|
data/webpack_integration.gemspec
CHANGED
@@ -23,4 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency "minitest"
|
24
24
|
spec.add_development_dependency "maxitest"
|
25
25
|
spec.add_development_dependency "mocha"
|
26
|
+
spec.add_development_dependency "rails"
|
27
|
+
spec.add_development_dependency "rack-test"
|
28
|
+
spec.add_development_dependency "pry"
|
26
29
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webpack_integration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roman Heinrich
|
@@ -80,6 +80,48 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rails
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rack-test
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: pry
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
83
125
|
description: A small gem to integrated digested static files with Ruby / Rails apps
|
84
126
|
email:
|
85
127
|
- roman.heinrich@gmail.com
|
@@ -103,6 +145,8 @@ files:
|
|
103
145
|
- sh/c
|
104
146
|
- sh/env.rb
|
105
147
|
- sh/test
|
148
|
+
- test/apps/test_rails_app.rb
|
149
|
+
- test/apps/test_rails_app/view_test/index.html.erb
|
106
150
|
- test/fixtures/webpack/brand_view-bundle-3e23e81.js
|
107
151
|
- test/fixtures/webpack/brand_view_styles-bundle-ca97811.js
|
108
152
|
- test/fixtures/webpack/common-2e7d2c0.js
|
@@ -111,6 +155,7 @@ files:
|
|
111
155
|
- test/fixtures/webpack/img/logo-0ebe2ec.png
|
112
156
|
- test/fixtures/webpack/img/logo_for_runaways-907b853.png
|
113
157
|
- test/public_api_test.rb
|
158
|
+
- test/railtie_test.rb
|
114
159
|
- test/store_test.rb
|
115
160
|
- test/test_helper.rb
|
116
161
|
- webpack_integration.gemspec
|
@@ -139,6 +184,8 @@ signing_key:
|
|
139
184
|
specification_version: 4
|
140
185
|
summary: A small gem to integrated digested static files with Ruby / Rails apps
|
141
186
|
test_files:
|
187
|
+
- test/apps/test_rails_app.rb
|
188
|
+
- test/apps/test_rails_app/view_test/index.html.erb
|
142
189
|
- test/fixtures/webpack/brand_view-bundle-3e23e81.js
|
143
190
|
- test/fixtures/webpack/brand_view_styles-bundle-ca97811.js
|
144
191
|
- test/fixtures/webpack/common-2e7d2c0.js
|
@@ -147,5 +194,6 @@ test_files:
|
|
147
194
|
- test/fixtures/webpack/img/logo-0ebe2ec.png
|
148
195
|
- test/fixtures/webpack/img/logo_for_runaways-907b853.png
|
149
196
|
- test/public_api_test.rb
|
197
|
+
- test/railtie_test.rb
|
150
198
|
- test/store_test.rb
|
151
199
|
- test/test_helper.rb
|