fastlane-plugin-sunny_project 0.1.4 → 0.1.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: '00794e8cd4807d4c959dd26f0c36739c9b4317ff9cba32d3a06a1dceae797afe'
4
- data.tar.gz: 5922485524c4aa963091467002cf0722ee0b3c3d81e5661c5f5feb7facae38f4
3
+ metadata.gz: e5a4314d675651fcc54daa9ad1a652f848e351267b2118c2f4a4a8f2245db66b
4
+ data.tar.gz: 22d4dc030288c6cca79205dc2afaad6136fce30e8b511fd2e4c8865875c8d510
5
5
  SHA512:
6
- metadata.gz: 8055fb6b959f289e8ab91cf0225d8ea4bff4c1b166a913fb540510bc26c3faaad28a9807cad1df75b07d64d3bc6ace508f75660e36b3838bf79a0e46e5190d81
7
- data.tar.gz: 595752d12ab6f375fe529993455bf70c590005fb9681a0aa96d0d072adf7f1b4b4ef413f1715ed91cd30427029ec5c17e230c549a79201dd2597f654d5b596b7
6
+ metadata.gz: fdcdee64745b5be1d9125fc734493decde7ce7727866268f4114c26a21e5560d7919c790a7932f1ca2cbcf425aec77050d6f43197ac4fb4d4ad93eb337c34824
7
+ data.tar.gz: 436546fe121d118181d5c34768ff67797e22b08545d98d7e7d06382beeb21f7981263c86999741f8279fe7dc9cc80fe953611d1bb41f0a3fe1ed2ad9b0e6123b
@@ -0,0 +1,156 @@
1
+ require 'fastlane/action'
2
+
3
+ # require 'ci'
4
+ require_relative '../helper/sunny_project_helper'
5
+ require 'semantic'
6
+ require 'yaml'
7
+
8
+ require_relative '../helper/plugin_options'
9
+
10
+ def resort_keys(input)
11
+ resort={}
12
+ keys=[]
13
+ input.each_key do |key|
14
+ puts("Key #{key} #{key.class}")
15
+ keys.push("#{key}")
16
+ end
17
+
18
+ keys=keys.sort
19
+ puts("Sorted keys: #{keys}")
20
+ keys.each do |k|
21
+ resort[k] = input[k]
22
+ end
23
+ resort
24
+ end
25
+
26
+ module Fastlane
27
+ module Actions
28
+ class PubspecDoctorAction < Action
29
+ def self.run(options)
30
+
31
+ params = FastlaneCore::Configuration.create(Fastlane::SunnyProject::Options.available_options, {})
32
+ params.load_configuration_file("Sunnyfile")
33
+ options.all_keys.each do |key|
34
+ puts("override #{key} => #{options[key]}")
35
+ params.set(key, options[key])
36
+ end
37
+ params.all_keys.each do |k|
38
+ puts("#{k} => #{params[k]}")
39
+ end
40
+
41
+ plugins = params[:sunny_plugins]
42
+ branches = params[:sunny_plugins_branches]
43
+ plugin_folder = params[:sunny_plugin_folder]
44
+ pubspec = YAML.load_file("pubspec.yaml")
45
+ local_mode = params[:sunny_local_mode]
46
+ is_local = "local".eql?(local_mode)
47
+ puts("Local #{local_mode} creates #{is_local}")
48
+ dependency_overrides = pubspec["dependency_overrides"]
49
+
50
+ plugins.keys.each do |key|
51
+ info = plugins[key]
52
+ if info.empty?
53
+ info = key
54
+ end
55
+ folder = key
56
+ branch = nil
57
+ path = nil
58
+ repo = key
59
+ if info.is_a? String
60
+ repo = info
61
+ else
62
+ path = info[:path]
63
+ branch = info[:branch] if info[:branch]
64
+ repo = info[:repo] if info[:repo]
65
+ folder = repo
66
+ end
67
+
68
+ if is_local
69
+ dependency_overrides[key.to_s] = {
70
+ 'path' => "#{plugin_folder}/#{folder}#{path ? "/#{path}" : ''}"
71
+ }
72
+ else
73
+ settings = {
74
+ 'git' => {
75
+ 'url' => "git@github.com:SunnyApp/#{repo}.git",
76
+ }
77
+ }
78
+ if branch
79
+ settings['git']['ref'] = branch
80
+ end
81
+ if path
82
+ settings['git']['path'] = "#{path}"
83
+ end
84
+ dependency_overrides[key.to_s] = settings
85
+ end
86
+ end
87
+
88
+ pubspec["dependencies"] = resort_keys pubspec["dependencies"]
89
+ pubspec["dev_dependencies"] = resort_keys pubspec["dev_dependencies"]
90
+ pubspec["dependency_overrides"] = resort_keys pubspec["dependency_overrides"]
91
+
92
+ pyaml = Psych::Visitors::YAMLTree.create
93
+ pyaml << pubspec
94
+ n=StringIO.new
95
+ emitter = CustomVisitor.new(n)
96
+ emitter.accept(pyaml.tree)
97
+ final_pubspec=n.string.gsub("---", "")
98
+ File.write('pubspec.yaml', final_pubspec)
99
+ print(final_pubspec)
100
+ end
101
+
102
+ def self.description
103
+ "Modify pubspec for local or git development"
104
+ end
105
+
106
+ def self.authors
107
+ ["ericmartineau"]
108
+ end
109
+
110
+ def self.return_value
111
+ # If your method provides a return value, you can describe here what it does
112
+ end
113
+
114
+ def self.details
115
+ # Optional:
116
+ ""
117
+ end
118
+
119
+ def self.available_options
120
+ Fastlane::SunnyProject::Options.available_options
121
+ end
122
+
123
+ def self.is_supported?(platform)
124
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
125
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
126
+ #
127
+ # [:ios, :mac, :android].include?(platform)
128
+ true
129
+ end
130
+ end
131
+
132
+ class CustomVisitor < Psych::Visitors::Emitter
133
+ def initialize(io)
134
+ super(io)
135
+ end
136
+
137
+ def visit_Psych_Nodes_Scalar(o)
138
+ if o.value.is_a? String
139
+ str="#{o.value}"
140
+ if str.start_with?('^') || str.start_with?('..')
141
+ @handler.scalar o.value, o.anchor, o.tag, o.plain, o.quoted, 1
142
+ elsif str.start_with?('https://') || str.start_with?('git@')
143
+ @handler.scalar o.value, o.anchor, o.tag, o.plain, o.quoted, 3
144
+ else
145
+ @handler.scalar o.value, o.anchor, o.tag, o.plain, o.quoted, o.style
146
+ end
147
+ return
148
+ end
149
+ @handler.scalar o.value, o.anchor, o.tag, o.plain, o.quoted, o.style
150
+ end
151
+ end
152
+
153
+
154
+ end
155
+ end
156
+
@@ -23,18 +23,17 @@ module Fastlane
23
23
  type: String,
24
24
  optional: false,
25
25
  default_value: '../plugin'),
26
-
27
26
  FastlaneCore::ConfigItem.new(key: :sunny_plugins_branches,
28
27
  env_name: "SUNNY_PLUGINS_BRANCHES",
29
28
  description: "Specific branches to use",
30
29
  type: Hash,
31
30
  optional: true,),
32
- FastlaneCore::ConfigItem.new(key: :sunny_verbose,
33
- env_name: "SUNNY_VERBOSE",
34
- description: "Whether to print out more debug",
35
- type: Boolean,
31
+ FastlaneCore::ConfigItem.new(key: :sunny_local_mode,
32
+ env_name: "SUNNY_LOCAL_MODE",
33
+ description: "Whether the project uses local checked out packages",
34
+ type: String,
36
35
  optional: true,
37
- default_value: false),
36
+ default_value: "git"),
38
37
 
39
38
  ]
40
39
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module SunnyProject
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.9"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-sunny_project
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - ericmartineau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-24 00:00:00.000000000 Z
11
+ date: 2020-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ci
@@ -165,6 +165,7 @@ files:
165
165
  - lib/fastlane/plugin/sunny_project/actions/generate_icons_action.rb
166
166
  - lib/fastlane/plugin/sunny_project/actions/increase_version_action.rb
167
167
  - lib/fastlane/plugin/sunny_project/actions/pub_publish_action.rb
168
+ - lib/fastlane/plugin/sunny_project/actions/pubspec_doctor_action.rb
168
169
  - lib/fastlane/plugin/sunny_project/actions/release_notes_action.rb
169
170
  - lib/fastlane/plugin/sunny_project/actions/rename_assets_action.rb
170
171
  - lib/fastlane/plugin/sunny_project/helper/plugin_options.rb