webpack_assets 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0e9d65fb90841c3ffa7d48007eb0df7b18c525e3
4
- data.tar.gz: 77b36788ea68d74584655ddb8975cde00e6c0a32
3
+ metadata.gz: 1213d86568456fea8f6a6d0f34a296c8d0f570d3
4
+ data.tar.gz: 0ca010337b4d689e0b2d0a067f26f1a42656de7e
5
5
  SHA512:
6
- metadata.gz: be24b4a50966a5450a8b55f6390d2731fc8e777bdf0c2d0e40c0c256d5170db64fa00964a100df815a8c8c250779720217bbf83e1e985882c8852fa88e9e71ef
7
- data.tar.gz: 86a8b260c32f0bb70315fde170f0050b8e8a48314377f8bd137015498958c7ea027ecac6ab33816b099ae1ec748157ed576b435938f4b6ccbafc021f78f13324
6
+ metadata.gz: 1a9cf99cec73b603b52e8525716c765f0f5c84e660ea33829a1d87ef169a2bed2a16a53a20fdc396ca21d7a41c7c9ffabad549938d328648d489df4870a42097
7
+ data.tar.gz: db51ee44d6e728a28f76b112f7e1db3c7a79bfef83097e9df4c3d8d03a26d710997dd4156a2e0fa11057832f73b9d432f6144c3e99364dad75b274314d7ab64a
data/README.md CHANGED
@@ -45,10 +45,8 @@ To watch for changes from your webpack build files and compile per change, execu
45
45
 
46
46
  ```bash
47
47
  cd <your-rails-root>
48
- npm init #follow directions to create a project
49
- npm install --save webpack
50
- npm install --save jsx-loader
51
- bin/rails g webpack_assets:webpack #will build a webpack.config.js
48
+ bin/rails g webpack_assets:init #will build webpack.config.js, and package.json
49
+ npm install
52
50
 
53
51
  ```
54
52
 
@@ -0,0 +1,44 @@
1
+ require 'rails/generators'
2
+
3
+ module WebpackAssets
4
+ class Init < Rails::Generators::Base
5
+
6
+ desc "create a default webpack.config.js file if one doesn't exist"
7
+
8
+ def self.source_root
9
+ @source_root ||= File.join(File.dirname(__FILE__), 'templates')
10
+ end
11
+
12
+ def create_webpack_file
13
+ destination = 'webpack.config.js'
14
+ if File.exist?(destination)
15
+ puts "Skipping #{destination} because it already exists"
16
+ else
17
+ copy_file 'webpack.config.js', destination
18
+ puts "** update the entry point in 'webpack.config.js' "
19
+ end
20
+ end
21
+
22
+ def create_package_file
23
+ destination = 'package.json'
24
+ if File.exist?(destination)
25
+ puts "Skipping #{destination} because it already exists"
26
+ puts "** make sure 'package.json' includes 'webpack' and 'jsx-loader' dependencies"
27
+ else
28
+ template 'package.json', destination
29
+ system "npm install"
30
+ end
31
+ end
32
+
33
+ def add_config
34
+ application "config.webpack_build_path = 'app/assets/javascripts/bundle.js'"
35
+ application "# path or glob to webpack built assets"
36
+ end
37
+
38
+ private
39
+ def app_name
40
+ Rails.application.class.parent_name.underscore
41
+ end
42
+
43
+ end
44
+ end
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "<%= app_name %>",
3
+ "version": "0.0.1",
4
+ "description": "",
5
+ "scripts": {
6
+ "test": "echo 'add some tests!' "
7
+ },
8
+ "author": "",
9
+ "license": "MIT",
10
+ "dependencies": {
11
+ "jsx-loader": "^0.12.2",
12
+ "webpack": "^1.4.13"
13
+ }
14
+ }
@@ -6,7 +6,7 @@ module WebpackAssets
6
6
  end
7
7
 
8
8
  generators do
9
- require 'webpack_assets/generators/webpack.rb'
9
+ require 'webpack_assets/generators/init.rb'
10
10
  end
11
11
 
12
12
  end
@@ -1,3 +1,3 @@
1
1
  module WebpackAssets
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webpack_assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Madsen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-15 00:00:00.000000000 Z
11
+ date: 2014-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -51,8 +51,9 @@ files:
51
51
  - README.md
52
52
  - Rakefile
53
53
  - lib/webpack_assets.rb
54
+ - lib/webpack_assets/generators/init.rb
55
+ - lib/webpack_assets/generators/templates/package.json
54
56
  - lib/webpack_assets/generators/templates/webpack.config.js
55
- - lib/webpack_assets/generators/webpack.rb
56
57
  - lib/webpack_assets/railtie.rb
57
58
  - lib/webpack_assets/tasks/webpack.rake
58
59
  - lib/webpack_assets/version.rb
@@ -1,23 +0,0 @@
1
- require 'rails/generators'
2
- module WebpackAssets
3
- class Webpack < Rails::Generators::Base
4
-
5
- desc "create a default webpack.config.js file if one doesn't exist"
6
-
7
- def self.source_root
8
- @source_root ||= File.join(File.dirname(__FILE__), 'templates')
9
- end
10
-
11
- def create_webpack_file
12
- destination = 'webpack.config.js'
13
- if File.exist?(destination)
14
- puts "Skipping #{destination} because it already exists"
15
- else
16
- copy_file 'webpack.config.js', destination
17
- puts "** update the entry point in 'webpack.config.js' "
18
- puts "** update 'package.json' to include 'webpack' and 'jsx-loader' dependencies"
19
- end
20
- end
21
-
22
- end
23
- end