Commit 50bd90b 1 parent 466caa8 commit 50bd90b Copy full SHA for 50bd90b
File tree 11 files changed +153
-0
lines changed
11 files changed +153
-0
lines changed Original file line number Diff line number Diff line change 1
1
/.bundle
2
2
/pkg
3
+ /test /mounted_app /test /dummy /log
3
4
/test /test_app /log
4
5
node_modules
5
6
.byebug_history
Original file line number Diff line number Diff line change
1
+ require "test_helper"
2
+
3
+ class EngineRakeTasksTest < Minitest ::Test
4
+ def setup
5
+ remove_webpack_binstubs
6
+ end
7
+
8
+ def teardown
9
+ remove_webpack_binstubs
10
+ end
11
+
12
+ def test_task_mounted
13
+ output = Dir . chdir ( mounted_app_path ) { `rake -T` }
14
+ assert_includes output , "app:webpacker"
15
+ end
16
+
17
+ def test_binstubs
18
+ Dir . chdir ( mounted_app_path ) { `bundle exec rake app:webpacker:binstubs` }
19
+ webpack_binstub_paths . each { |path | assert File . exist? ( path ) }
20
+ end
21
+
22
+ private
23
+ def mounted_app_path
24
+ File . expand_path ( "mounted_app" , __dir__ )
25
+ end
26
+
27
+ def webpack_binstub_paths
28
+ [
29
+ "#{ mounted_app_path } /test/dummy/bin/webpack" ,
30
+ "#{ mounted_app_path } /test/dummy/bin/webpack-dev-server" ,
31
+ ]
32
+ end
33
+
34
+ def remove_webpack_binstubs
35
+ webpack_binstub_paths . each do |path |
36
+ File . delete ( path ) if File . exist? ( path )
37
+ end
38
+ end
39
+ end
Original file line number Diff line number Diff line change
1
+ require "bundler/setup"
2
+
3
+ APP_RAKEFILE = File . expand_path ( "test/dummy/Rakefile" , __dir__ )
4
+ load "rails/tasks/engine.rake"
Original file line number Diff line number Diff line change
1
+ require_relative "config/application"
2
+
3
+ Rails . application . load_tasks
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File . expand_path ( "../config/application" , __dir__ )
3
+ require "rails/commands"
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env ruby
2
+ require "rake"
3
+ Rake . application . run
Original file line number Diff line number Diff line change
1
+ # This file allows the `Rails.root` to be correctly determined.
2
+
3
+ require_relative "config/environment"
4
+
5
+ run Rails . application
Original file line number Diff line number Diff line change
1
+ require "action_controller/railtie"
2
+ require "action_view/railtie"
3
+ require "webpacker"
4
+
5
+ module TestDummyApp
6
+ class Application < Rails ::Application
7
+ config . secret_key_base = "abcdef"
8
+ config . eager_load = true
9
+ end
10
+ end
Original file line number Diff line number Diff line change
1
+ require_relative "application"
2
+
3
+ Rails . application . initialize!
Original file line number Diff line number Diff line change
1
+ # Note: You must restart bin/webpack-dev-server for changes to take effect
2
+
3
+ default : &default
4
+ source_path : app/javascript
5
+ source_entry_path : packs
6
+ public_output_path : packs
7
+ cache_path : tmp/cache/webpacker
8
+
9
+ # Additional paths webpack should lookup modules
10
+ # ['app/assets', 'engine/foo/app/assets']
11
+ resolved_paths :
12
+ - app/assets
13
+ - /etc/yarn
14
+
15
+ # Reload manifest.json on all requests so we reload latest compiled packs
16
+ cache_manifest : false
17
+
18
+ extensions :
19
+ - .js
20
+ - .sass
21
+ - .scss
22
+ - .css
23
+ - .module.sass
24
+ - .module.scss
25
+ - .module.css
26
+ - .png
27
+ - .svg
28
+ - .gif
29
+ - .jpeg
30
+ - .jpg
31
+
32
+ development :
33
+ << : *default
34
+ compile : true
35
+
36
+ # Reference: https://webpack.js.org/configuration/dev-server/
37
+ dev_server :
38
+ https : false
39
+ host : localhost
40
+ port : 3035
41
+ public : localhost:3035
42
+ hmr : false
43
+ # Inline should be set to true if using HMR
44
+ inline : true
45
+ overlay : true
46
+ disable_host_check : true
47
+ use_local_ip : false
48
+
49
+ test :
50
+ << : *default
51
+ compile : true
52
+
53
+ # Compile test packs to a separate directory
54
+ public_output_path : packs-test
55
+
56
+ production :
57
+ << : *default
58
+
59
+ # Production depends on precompilation of packs prior to booting for performance.
60
+ compile : false
61
+
62
+ # Cache manifest.json for performance
63
+ cache_manifest : true
64
+
65
+ staging :
66
+ << : *default
67
+
68
+ # Production depends on precompilation of packs prior to booting for performance.
69
+ compile : false
70
+
71
+ # Cache manifest.json for performance
72
+ cache_manifest : true
73
+
74
+ # Compile staging packs to a separate directory
75
+ public_output_path : packs-staging
Original file line number Diff line number Diff line change
1
+ {
2
+ "private" : true ,
3
+ "dependencies" : {
4
+ "@rails/webpacker" : " file:../../../../"
5
+ },
6
+ "license" : " MIT"
7
+ }
You can’t perform that action at this time.
0 commit comments