fastlane-plugin-yarn 0.2.0 → 1.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: ea40ff23d9ab2da8db798eaf3b3f8f33149ea552
4
- data.tar.gz: 5dd44bf531d90eb39ee589d09eaef6bad655295a
3
+ metadata.gz: 1fd2ecb7fd0bed4e5139ca7f5173b2218a03c4e1
4
+ data.tar.gz: a1d890deb1ef658a607d5610bd1b1b8e7f7d1e27
5
5
  SHA512:
6
- metadata.gz: 0b2af9785ee98958d1f617ac4750afb375e51332e859f26e986a455e92eee9001fef50880d0f9b31944f168901bba3b0c4234b726ea2c8d9e84eea6036fb4448
7
- data.tar.gz: 60e6c980020e0f7896e159594a7d505ec75b7be0b808ba1bb5214a9984a1bf5df7fa5e265322a10a477eb6507187b2d455b07b56e49289b93921884a4dc21dc1
6
+ metadata.gz: 4b155d2c9979761b6020ae0661fb2d5020a7f272e81ac50087237f7712124c5c2526f697609ddde5eba4970a4fdaa64ab4bcf76b499aabb450b5fe06062496b3
7
+ data.tar.gz: 81b70f16b307210b8b4afd1353ef0eda6a46a26515e0f862076cee2949413e59f2500ed7a2b8539e4616a943e65bf9031735dce6e20e8207f18fdbb978c4ec68
@@ -2,9 +2,9 @@ module Fastlane
2
2
  module Actions
3
3
  class YarnAction < Action
4
4
  def self.run(params)
5
- # UI.message("The yarn plugin is working!")
6
- task = params[:task]
5
+ flags = params[:flags]
7
6
  command = params[:command]
7
+ options = params[:options]
8
8
  package_path = params[:package_path]
9
9
 
10
10
  # create a new object from yarn helper
@@ -13,8 +13,13 @@ module Fastlane
13
13
  # Check if yarn is installed
14
14
  yarn.check_install
15
15
 
16
+ if params[:auto_install_dependencies]
17
+ UI.message("Installign dependecies")
18
+ yarn.install_dependencies
19
+ end
20
+
16
21
  # trigger command
17
- yarn.trigger(command:command, task: task)
22
+ yarn.trigger(command: command, flags: flags, options: options)
18
23
  end
19
24
 
20
25
  def self.description
@@ -36,9 +41,9 @@ module Fastlane
36
41
 
37
42
  def self.available_options
38
43
  [
39
- FastlaneCore::ConfigItem.new(key: :task,
40
- env_name: "YARN_TASK",
41
- description: "Task you want Yarn to perform as listed in package.json file",
44
+ FastlaneCore::ConfigItem.new(key: :flags,
45
+ env_name: "YARN_FLAGS",
46
+ description: "Flags you want Yarn to perform as listed in package.json file",
42
47
  optional: true,
43
48
  type: String),
44
49
  FastlaneCore::ConfigItem.new(key: :command,
@@ -55,7 +60,13 @@ module Fastlane
55
60
  env_name: "YARN_OPTIONS",
56
61
  description: "Options to pass to Yarn",
57
62
  optional: true,
58
- type: String)
63
+ type: String),
64
+ FastlaneCore::ConfigItem.new(key: :auto_install_dependencies,
65
+ env_name: "AUTO_INSTALL_DEPENDENCIES",
66
+ description: "Runs yarn install before executing any yarn command",
67
+ optional: true,
68
+ default_value: false,
69
+ is_string: false)
59
70
 
60
71
  ]
61
72
  end
@@ -4,8 +4,9 @@ module Fastlane
4
4
  # class methods that you define here become available in your action
5
5
  # as `Helper::YarnHelper.your_method`
6
6
 
7
- attr_accessor :task
7
+ attr_accessor :flags
8
8
  attr_accessor :commands
9
+ attr_accessor :options
9
10
  attr_accessor :package_path
10
11
  attr_accessor :yarn
11
12
 
@@ -20,35 +21,35 @@ module Fastlane
20
21
  end
21
22
 
22
23
  # Run a certain action
23
- def trigger(command: nil, task: nil, print_command: true, print_command_output: true)
24
-
25
- command = [self.yarn, command, task].compact.join(" ")
24
+ def trigger(command: nil, flags: nil, options: nil, print_command: true, print_command_output: true)
25
+ command = [self.yarn, command, flags, options].compact.join(" ")
26
26
  Action.sh(command, print_command: print_command, print_command_output: print_command_output)
27
27
  end
28
28
 
29
29
  def check_install
30
30
  check_package
31
-
32
- UI.message("Checking yarn install and dependencies")
33
31
  begin
34
- Action.sh(self.yarn, print_command: true, print_command_output: true)
32
+ command = [self.yarn, "--version"].compact.join(" ")
33
+ Action.sh(command, print_command: false, print_command_output: false)
35
34
  rescue Errno::ENOENT => e
36
35
  UI.error("Yarn not installed, please install with Homebrew or npm.")
37
36
  raise e
38
37
  end
39
-
40
38
  end
41
39
 
42
- def check_package()
43
- UI.message("Checking for valid package.json")
40
+ def install_dependencies
41
+ UI.message("Installing dependencies")
42
+ trigger(command: "install")
43
+ end
44
44
 
45
+ def check_package
45
46
  if self.package_path.nil?
46
47
  package_path = 'package.json'
47
48
  else
48
49
  package_path = self.package_path
49
50
  end
50
51
 
51
- unless File.exists?(package_path)
52
+ unless File.exist?(package_path)
52
53
  UI.error("Could not find package.json")
53
54
  raise Errno::ENOENT
54
55
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Yarn
3
- VERSION = "0.2.0"
3
+ VERSION = "1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-yarn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: '1.0'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Lesch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-22 00:00:00.000000000 Z
11
+ date: 2017-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry