webpackrails 0.1.1 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d9b8b8434a19ec89528c9b6e881c745f28e05a94
4
- data.tar.gz: 280ca44bac406b044fa20d7a39f821b80637bee9
3
+ metadata.gz: 2fa2985efb84baf179b44c31c54b45b7bebb8a79
4
+ data.tar.gz: 90aeb67545627aeb8227b627c5507bbe056686e3
5
5
  SHA512:
6
- metadata.gz: ea4dc1ba597d1566cf1d7006dcc78c74a36e2d994bcc7942d2b738648ba0c10a39b11f4f562ae3f3fa9af5d860679d8db02416d1076a31d40c558e64a9c534a8
7
- data.tar.gz: 9cd84024ace9d54ca09902d7bce01e04e1b377e11cf40a3585ae717eadd02a436e7043fcf171bb2bd512c079b432d3bbcf8e3f0bc24856c590349dc2d8e0852d
6
+ metadata.gz: a0172bd0f2f2e60ed678b4ec5991e5e10e8368b23d2c3412b70e66f140c35cb7942be659916ebfb8207d18af5821c5d243af52a6261b7236d46633aa887188dd
7
+ data.tar.gz: 18ecc798dd746604ec293e89a6c7274e543a24451c7039045135d2a9fed4356397d1b6d5b8a2c019729c4c39f4305c76d726865cf4558fc6105942091108aed2
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://ruby.taobao.org/'
1
+ source 'https://rubygems.org/'
2
2
 
3
3
  # Specify your gem's dependencies in webpack-rails.gemspec
4
4
  gemspec
data/README.md CHANGED
@@ -40,7 +40,7 @@ webpack config file within `application.rb`
40
40
 
41
41
  ### Config
42
42
 
43
- See [source](https://raw.githubusercontent.com/towry/webpack-rails/master/lib/webpack-rails/railtie.rb)
43
+ See [source](https://raw.githubusercontent.com/towry/webpackrails/master/lib/webpackrails/railtie.rb)
44
44
 
45
45
  ## Development
46
46
 
@@ -50,7 +50,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
50
50
 
51
51
  ## Contributing
52
52
 
53
- Bug reports and pull requests are welcome on GitHub at https://github.com/towry/webpack-rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
53
+ Bug reports and pull requests are welcome on GitHub at https://github.com/towry/webpackrails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
54
54
 
55
55
 
56
56
  ## License
@@ -17,7 +17,7 @@ module WebpackRails
17
17
  config.webpack_rails.node_bin = "node_modules/.bin/"
18
18
 
19
19
  initializer :setup_webpack do |app|
20
- app.assets.register_postprocessor "application/javascript", WebapckProcessor
20
+ app.assets.register_postprocessor "application/javascript", WebpackRails::WebpackProcessor
21
21
  end
22
22
  end
23
23
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module WebpackRails
4
- VERSION = "0.1.1"
4
+ VERSION = "1.0.0"
5
5
  end
@@ -7,7 +7,7 @@ require 'fileutils'
7
7
  require 'shellwords'
8
8
 
9
9
  module WebpackRails
10
- class WebapckProcessor < Tilt::Template
10
+ class WebpackProcessor < Tilt::Template
11
11
  attr_accessor :config
12
12
 
13
13
  def initialize(template)
@@ -25,7 +25,7 @@ module WebpackRails
25
25
  # return if there is nothing to do
26
26
  return data unless should_webpack?
27
27
 
28
- run_webpack(context.logical_path)
28
+ run_webpack(context.pathname || context.logical_path)
29
29
  end
30
30
 
31
31
  private
@@ -82,7 +82,7 @@ module WebpackRails
82
82
  end
83
83
 
84
84
  def commonjs_module?
85
- data.to_s.include?("module.exports") || data.present? && data.to_s.include?("require")
85
+ data.to_s.include?("module.exports") || data.present? && data.to_s.include?("require") || data.present? && data.to_s.include?("import")
86
86
  end
87
87
 
88
88
  def asset_paths
@@ -101,7 +101,7 @@ module WebpackRails
101
101
  end
102
102
 
103
103
  def run_webpack(logical_path=nil)
104
- command_options = "--config #{@config_file} #{logical_path} --output-filename"
104
+ command_options = "--colors --config #{@config_file} #{logical_path} --bail --output-filename"
105
105
  output_file = Tempfile.new("output", rails_path(tmp_path))
106
106
  command_options << " #{output_file.path.inspect}"
107
107
 
@@ -109,7 +109,7 @@ module WebpackRails
109
109
 
110
110
  base_directory = File.dirname(file)
111
111
 
112
- Logger::log "Webpack: #{command}"
112
+ Logger::log "\nWebpack: #{command}"
113
113
  stdout, stderr, status = Open3.capture3(env, command, stdin_data: data, chdir: base_directory)
114
114
 
115
115
  if !status.success?
@@ -0,0 +1,12 @@
1
+ # encoding: utf-8
2
+
3
+ require 'sprockets'
4
+
5
+ require 'webpackrails/webpack_processor'
6
+ require 'webpackrails/webpack_logger'
7
+ require 'webpackrails/webpack_error'
8
+ require 'webpackrails/railtie'
9
+ require 'webpackrails/version'
10
+
11
+ module WebpackRails
12
+ end
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'webpack-rails/version'
4
+ require 'webpackrails/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "webpackrails"
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
 
12
12
  spec.summary = %q{Make Webpack work with Rails for you}
13
13
  spec.description = %q{Webpack + Rails ≠ CommonJS Heaven}
14
- spec.homepage = "https://github.com/towry/webpack-rails"
14
+ spec.homepage = "https://github.com/towry/webpackrails"
15
15
  spec.license = "MIT"
16
16
 
17
17
  # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webpackrails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - towry
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-10 00:00:00.000000000 Z
11
+ date: 2015-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -129,14 +129,14 @@ files:
129
129
  - Rakefile
130
130
  - bin/console
131
131
  - bin/setup
132
- - lib/webpack-rails.rb
133
- - lib/webpack-rails/railtie.rb
134
- - lib/webpack-rails/version.rb
135
- - lib/webpack-rails/webpack_error.rb
136
- - lib/webpack-rails/webpack_logger.rb
137
- - lib/webpack-rails/webpack_processor.rb
138
- - webpack-rails.gemspec
139
- homepage: https://github.com/towry/webpack-rails
132
+ - lib/webpackrails.rb
133
+ - lib/webpackrails/railtie.rb
134
+ - lib/webpackrails/version.rb
135
+ - lib/webpackrails/webpack_error.rb
136
+ - lib/webpackrails/webpack_logger.rb
137
+ - lib/webpackrails/webpack_processor.rb
138
+ - webpackrails.gemspec
139
+ homepage: https://github.com/towry/webpackrails
140
140
  licenses:
141
141
  - MIT
142
142
  metadata:
data/lib/webpack-rails.rb DELETED
@@ -1,12 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'sprockets'
4
-
5
- require 'webpack-rails/webpack_processor'
6
- require 'webpack-rails/webpack_logger'
7
- require 'webpack-rails/webpack_error'
8
- require 'webpack-rails/railtie'
9
- require 'webpack-rails/version'
10
-
11
- module WebpackRails
12
- end