engine_pack 0.1.0 → 0.2.0

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
  SHA256:
3
- metadata.gz: b4188c100677625caaf64e48b753063ac5658b9cde4847a7385114a6d7ead765
4
- data.tar.gz: d9a820070be235e792cd184826c12aa3e1c60881910a886314e37a40d519fdd5
3
+ metadata.gz: 55cf65d9502f706e9b94fac87dc958775805d62e57514434493e28981940cd25
4
+ data.tar.gz: a4925f67e6109284050bdc87777ec074051ce4b93f59f10461fbfc645a4f6b00
5
5
  SHA512:
6
- metadata.gz: 88ca00a0347b67233940da099871b8df3735779165c9221b74a8e1d0c77fbb9d0522fe084059d5151e53c3089b074cc6e453e6ff54f8cfb1c2cf74f3c6ec5973
7
- data.tar.gz: 94179b0bdc6e69dbbcc93443b65355061c5b2283ee6a27200fe8e9467a1961c6a5973e1e5ce3ae5946f055c16b63c54c1f8e763365242c456036e4b789958f67
6
+ metadata.gz: d567eb2e14598458d11a8c788e905803ba7d39800acc4807ffb6683243201ede18a6fc67fca6ed3718911b27ca2a9dd13331034741c9b6479876f8e57c3acd93
7
+ data.tar.gz: 382366d354be4cadc32b937818fcd286a3ab36977ab96cfecb8c0ed5f5967b60e40aafb166b6ce7757e00efec1f5b403eea700b8a2ff861be18829b592d3ca9e
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 2.5.8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- engine_pack (0.1.0)
4
+ engine_pack (0.2.0)
5
5
  dry-configurable (~> 0.12, >= 0.12.0)
6
6
  railties (>= 6.0.0)
7
7
 
data/README.md CHANGED
@@ -14,13 +14,47 @@ And then execute:
14
14
 
15
15
  $ bundle install
16
16
 
17
- Or install it yourself as:
17
+ Finally, run the generator:
18
18
 
19
- $ gem install engine_pack
19
+ $ rails generate engine_pack:install
20
20
 
21
21
  ## Usage
22
22
 
23
- TODO: Write usage instructions here
23
+ It works by hooking into the JavaScript package managers preinstall hook via a Rake task. The Rake task copies the `files` specified in the `package.json` to a temporary directory and then install that directory as a local package.
24
+
25
+ ### Configuration
26
+
27
+ ```ruby
28
+ require 'engine_pack'
29
+
30
+ EnginePack.configure do |config|
31
+ config.package_manager = :npm
32
+ config.engines = %w[
33
+ engine1
34
+ engine2
35
+ ]
36
+ end
37
+
38
+ ```
39
+
40
+ #### Configuration Options
41
+
42
+ Option/Method | Description
43
+ --- | ---
44
+ `package_manager` | The package manager you are using with your application. Currently supports `:npm` and `:yarn`. (default: `:npm`)
45
+ `engine` | An array of the names of the gems/engines to include.
46
+
47
+ ### Preinstall Hook
48
+
49
+ You'll need to add the `preinstall` script to your applications `package.json` in the `scripts` property.
50
+
51
+ ```json
52
+ {
53
+ "scripts": {
54
+ "preinstall": "bundle exec rails engine_pack:preinstall"
55
+ }
56
+ }
57
+ ```
24
58
 
25
59
  ## Development
26
60
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EnginePack
4
- VERSION = '0.1.0'
4
+ VERSION = '0.2.0'
5
5
  end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails/generators/named_base'
4
+
5
+ module EnginePack
6
+ module Generators
7
+ class InstallGenerator < Rails::Generators::Base
8
+ source_root File.expand_path('../templates', __dir__)
9
+
10
+ desc 'Generates configuration for EnginePack.'
11
+
12
+ class_option :package_manager,
13
+ desc: 'Specify the JavaScript package manager to configure. (yarn, npm)',
14
+ type: :string,
15
+ default: 'npm'
16
+
17
+ def copy_initializer
18
+ template 'initializer.rb', 'config/initializers/engine_pack.rb'
19
+ end
20
+
21
+ def show_post_install
22
+ readme 'POST_INSTAll'
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,8 @@
1
+
2
+ ===============================================================================
3
+
4
+ Add the following to your package.json scripts:
5
+
6
+ "preinstall": "bundle exec rails engine_pack:preinstall"
7
+
8
+ ===============================================================================
@@ -0,0 +1,6 @@
1
+ require 'engine_pack'
2
+
3
+ EnginePack.configure do |config|
4
+ config.package_manager = :<%= options[:package_manager] %>
5
+ config.engines = %w[]
6
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: engine_pack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaric Pittman
@@ -110,6 +110,7 @@ files:
110
110
  - ".devcontainer/devcontainer.json"
111
111
  - ".gitignore"
112
112
  - ".rspec"
113
+ - ".tool-versions"
113
114
  - ".travis.yml"
114
115
  - CHANGELOG.md
115
116
  - CODE_OF_CONDUCT.md
@@ -135,6 +136,9 @@ files:
135
136
  - lib/engine_pack/railtie.rb
136
137
  - lib/engine_pack/tasks/preinstall.rake
137
138
  - lib/engine_pack/version.rb
139
+ - lib/generators/engine_pack/install_generator.rb
140
+ - lib/generators/templates/POST_INSTALL
141
+ - lib/generators/templates/initializer.rb
138
142
  homepage: https://github.com/aaricpittman/engine-pack
139
143
  licenses:
140
144
  - MIT