rake_npm 0.1.0.pre.8 → 0.1.0.pre.9

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: de873fed8319a4bbb3c453cd4321b287e38c9b22534b8a0db777962b25e639ca
4
- data.tar.gz: 831a84ac0a97d43759189190a095d019f30994032a9ecc7a19c41de3be96ae66
3
+ metadata.gz: 7f2e47d9bf4395c8065606e3032fc316fa8b387307959f9af24716dd313c6935
4
+ data.tar.gz: 5376c6177750c13eeb90c8790e044e6b03d192eb1fa3fefb5181aad7d020b8da
5
5
  SHA512:
6
- metadata.gz: fa7bd402aa4ec927672082151833fa8ccbbf816194d10a06940eb71c77a6d1fea3992af12e4cd131027277cc9673a4a4a6d9d401f873d37e92899c63ff553b5b
7
- data.tar.gz: 82e87f14da0e9580c4bc2bd0418f20a9114198c94b826c9c62afd865a3741b3a1c51a506e3de06ea494b5c188dbd97226ebedb8d5545b34a6503fe0183dc54d9
6
+ metadata.gz: 1ffa91b7183597d65b8693b9ba5d36d5a43ef756fc6cb91f8578d7ca36032ab5fea11ae843dd166c522b939c3375673a219f14aa307040030bf845cd52d71e9c
7
+ data.tar.gz: 8e85c3124e51f710962c2d9f3b754228bcc00f15d00cccac29e883e138b46b56133800182485da19fdf4a1a6cd9108ce7d898794b7c9780553ac0fa4684d1987
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rake_npm (0.1.0.pre.8)
4
+ rake_npm (0.1.0.pre.9)
5
5
  colored2 (~> 3.1)
6
6
  rake_dependencies (~> 3.1)
7
7
  rake_factory (~> 0.23)
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RakeNPM
4
+ module Mixins
5
+ module Directoried
6
+ def in_directory(directory, &block)
7
+ if directory
8
+ Dir.chdir(directory, &block)
9
+ else
10
+ block.call
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -3,9 +3,13 @@
3
3
  require 'rake_factory'
4
4
  require 'ruby_npm'
5
5
 
6
+ require_relative '../mixins/directoried'
7
+
6
8
  module RakeNPM
7
9
  module Tasks
8
10
  class Install < RakeFactory::Task
11
+ include Mixins::Directoried
12
+
9
13
  default_name :install
10
14
  default_description(RakeFactory::DynamicValue.new do |_t|
11
15
  'Install NPM dependencies'
@@ -15,13 +19,28 @@ module RakeNPM
15
19
  parameter :fund, default: false
16
20
  parameter :audit, default: true
17
21
 
22
+ parameter :directory
23
+
24
+ parameter :environment, default: {}
25
+
18
26
  action do |task|
19
- puts 'Installing NPM dependencies...'
20
- RubyNPM.install(
21
- color: task.color,
22
- fund: task.fund,
23
- audit: task.audit
27
+ logged_directory = task.directory || '.'
28
+ puts(
29
+ 'Installing NPM dependencies ' \
30
+ "in directory: '#{logged_directory}'..."
24
31
  )
32
+ in_directory(task.directory) do
33
+ RubyNPM.install(
34
+ {
35
+ color: task.color,
36
+ fund: task.fund,
37
+ audit: task.audit
38
+ },
39
+ {
40
+ environment: task.environment
41
+ }
42
+ )
43
+ end
25
44
  end
26
45
  end
27
46
  end
@@ -3,9 +3,13 @@
3
3
  require 'rake_factory'
4
4
  require 'ruby_npm'
5
5
 
6
+ require_relative '../mixins/directoried'
7
+
6
8
  module RakeNPM
7
9
  module Tasks
8
10
  class RunScript < RakeFactory::Task
11
+ include Mixins::Directoried
12
+
9
13
  default_name :run_script
10
14
  default_description(RakeFactory::DynamicValue.new do |t|
11
15
  "Runs the NPM #{t.script} script"
@@ -13,11 +17,30 @@ module RakeNPM
13
17
 
14
18
  parameter :script, required: true
15
19
 
20
+ parameter :color, default: 'always'
21
+
22
+ parameter :environment, default: {}
23
+
24
+ parameter :directory
25
+
16
26
  action do |task|
17
- puts "Running NPM script: '#{task.script}'..."
18
- RubyNPM.run_script(
19
- script: task.script
27
+ logged_directory = task.directory || '.'
28
+ puts(
29
+ "Running NPM script: '#{task.script}' " \
30
+ "in directory: '#{logged_directory}'..."
20
31
  )
32
+
33
+ in_directory(task.directory) do
34
+ RubyNPM.run_script(
35
+ {
36
+ script: task.script,
37
+ color: task.color
38
+ },
39
+ {
40
+ environment: task.environment
41
+ }
42
+ )
43
+ end
21
44
  end
22
45
  end
23
46
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RakeNPM
4
- VERSION = '0.1.0.pre.8'
4
+ VERSION = '0.1.0.pre.9'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake_npm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre.8
4
+ version: 0.1.0.pre.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - InfraBlocks Maintainers
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-02 00:00:00.000000000 Z
11
+ date: 2023-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colored2
@@ -279,6 +279,7 @@ files:
279
279
  - bin/console
280
280
  - bin/setup
281
281
  - lib/rake_npm.rb
282
+ - lib/rake_npm/mixins/directoried.rb
282
283
  - lib/rake_npm/task_sets.rb
283
284
  - lib/rake_npm/task_sets/npm.rb
284
285
  - lib/rake_npm/tasks.rb