opal-webpack-loader 0.8.0 → 0.8.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c724250c05cffa31dfa68ddf06cf501e5993a17b5553dd40061c3e921edc74d2
4
- data.tar.gz: cbbabc576daf3622e6e7d118d07dfd0ee59fd56dd803b5cfbc501b7493146c9e
3
+ metadata.gz: d34a28b1df85de73b35742484b26da50a13481b07fc4bf96d65065a6adfd78e2
4
+ data.tar.gz: eb7f6324947a11357451344607365b421b9bd6300d6e7410bab5efe51d0b8d0a
5
5
  SHA512:
6
- metadata.gz: 2c3f756fa3e66924c07ee831369708985bb73a54816b1fa57268fc197e4088687f8390d6d2f0812c2f460d3e1c964362242b13ef27320dbdec8720aa88b32f90
7
- data.tar.gz: dbc2978da4134506446d96aca264930bc387644e0aee657f8d3ace42539dd90830f7f6c9980929a9761db1ba12a4e28dd0e680f2a70af19fe09c791448d7ab7d
6
+ metadata.gz: 015572a3148732c34004bb96091a018b1ec9220473a042f72dcf79031206b857dc34c1b3ee6901d896a58b619883ce3fb9df96ac6e263136d4af91ce8be32fba
7
+ data.tar.gz: 023053ba731cfcfff3b2f169a8146bd80589cb6586ca5b9af6976d63eecbda4406b1e1927d13d023455921dc238b47ad9b681f1bbdec3eccece64cfe8f78b4a4
@@ -3,4 +3,4 @@ require 'oj'
3
3
  require 'opal/paths'
4
4
  require 'opal-webpack-loader/compile_server'
5
5
  require 'opal-webpack-loader/load_path_manager'
6
- OpalWebpackLoader::LoadPathManager.create_load_paths_cache
6
+ OpalWebpackLoader::LoadPathManager.create_load_paths_cache(ARGV)
@@ -44,6 +44,7 @@ module OpalWebpackLoader
44
44
  create_directory(@webpack_config_directory)
45
45
  create_directory(@asset_output_directory)
46
46
  install_webpack_config
47
+ install_gitignore
47
48
  create_file_from_template('initializer.rb.erb', File.join('owl_init.rb'), { opal_directory: @opal_directory })
48
49
  add_gem
49
50
  end
@@ -170,6 +171,7 @@ module OpalWebpackLoader
170
171
  install_webpacker_package_json
171
172
  install_webpacker_js_entry
172
173
  install_opal_entries
174
+ install_gitignore
173
175
  create_file_from_template('initializer.rb.erb', File.join('config', 'initializers', 'opal_webpack_loader.rb'),
174
176
  { opal_directory: @opal_directory })
175
177
  add_gem
@@ -199,6 +201,17 @@ module OpalWebpackLoader
199
201
  install_js_entries
200
202
  install_opal_entries
201
203
  install_procfile
204
+ install_gitignore
205
+ end
206
+
207
+ def install_gitignore
208
+ if File.exist?('.gitignore')
209
+ gitignore = File.read('.gitignore', more: 'r')
210
+ unless gitignore.include?('.owl_cache')
211
+ gitignore << "\n.owl_cache\n"
212
+ File.write('.gitignore', gitignore)
213
+ end
214
+ end
202
215
  end
203
216
 
204
217
  def install_js_entries
@@ -1,6 +1,6 @@
1
1
  module OpalWebpackLoader
2
2
  class LoadPathManager
3
- def self.get_load_path_entries(path)
3
+ def self.get_load_path_entries(path, filter)
4
4
  path_entries = []
5
5
  return [] unless Dir.exist?(path)
6
6
  dir_entries = Dir.entries(path)
@@ -10,10 +10,16 @@ module OpalWebpackLoader
10
10
  next unless entry
11
11
  absolute_path = File.join(path, entry)
12
12
  if File.directory?(absolute_path)
13
- more_path_entries = get_load_path_entries(absolute_path)
13
+ more_path_entries = get_load_path_entries(absolute_path, filter)
14
14
  path_entries.push(*more_path_entries) if more_path_entries.size > 0
15
15
  elsif (absolute_path.end_with?('.rb') || absolute_path.end_with?('.js')) && File.file?(absolute_path)
16
- path_entries.push(absolute_path)
16
+ push_entry = true
17
+ if filter && filter.size > 0
18
+ filter.each do |filter_entry|
19
+ push_entry = false if absolute_path.end_with?(filter_entry)
20
+ end
21
+ end
22
+ path_entries.push(absolute_path) if push_entry
17
23
  end
18
24
  end
19
25
  path_entries
@@ -24,7 +30,7 @@ module OpalWebpackLoader
24
30
  load_paths_cache['opal_load_paths']
25
31
  end
26
32
 
27
- def self.create_load_paths_cache
33
+ def self.create_load_paths_cache(filter)
28
34
  load_paths = if File.exist?(File.join('bin', 'rails'))
29
35
  %x{
30
36
  bundle exec rails runner "puts (Rails.configuration.respond_to?(:assets) ? (Rails.configuration.assets.paths + Opal.paths).uniq : Opal.paths)"
@@ -44,7 +50,7 @@ module OpalWebpackLoader
44
50
 
45
51
  load_path_lines.each do |path|
46
52
  next if path.start_with?(cwd)
47
- more_path_entries = get_load_path_entries(path)
53
+ more_path_entries = get_load_path_entries(path, filter)
48
54
  load_path_entries.push(*more_path_entries) if more_path_entries.size > 0
49
55
  end
50
56
  cache_obj = { 'opal_load_paths' => load_path_lines, 'opal_load_path_entries' => load_path_entries }
@@ -1,3 +1,3 @@
1
1
  module OpalWebpackLoader
2
- VERSION="0.8.0"
2
+ VERSION="0.8.1"
3
3
  end
data/readme.md CHANGED
@@ -61,7 +61,7 @@ Continue here:
61
61
  ### Example applications
62
62
  [are here](https://github.com/isomorfeus/opal-webpack-loader/tree/master/example_apps/)
63
63
 
64
- ### General Usage
64
+ ### General Usage without Webpacker
65
65
 
66
66
  After installing owl with the installer, three scripts are provided in package.json:
67
67
  - `development` - runs the webpack-dev-server, use for general development, provides fast reloads, entry is application.js
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opal-webpack-loader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-13 00:00:00.000000000 Z
11
+ date: 2019-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal