fastlane-plugin-sunny_project 0.1.3 → 0.1.8

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: a515090fcca006dc19c431618a5487ee87396f4e663dc3da861100a97e4b6f00
4
- data.tar.gz: 2c515e01ab4c674fca09dc659c68e43a3cc715b72adee7fb2204f3c8fdadc013
3
+ metadata.gz: b5d748898a8a35ebe64e279a81c13918b0d3ac34c5df476427a02d505b08911f
4
+ data.tar.gz: 7d02ea5c6f44e45b51d32d99a5d42c9df8daad294622dd87e737e8da3c59ec57
5
5
  SHA512:
6
- metadata.gz: 195d698da34785c9587403779566ca69b525e62daad899ac99602751a4254baf1aa7a978dad63e8e771045578d79fb9faa4e8717238b471e1866c6dab0670e7d
7
- data.tar.gz: 1e7e79897ecd1945b1913eb350f90bbe442f5878e14ca09e300b77a16be752a264dc5bd9f9264e8175cabd682267bbb442fa7108191aa6b944824fe5c398eb54
6
+ metadata.gz: de0d47e516c7946c60880c9fb41a8c1ea20c987026832d1cb8544428031c82ac881e3521460980a33cd03398564f24bd6584ea3769899ee43c9217c08d6ec1ec
7
+ data.tar.gz: 6bb168e990742ddfb8da0a1abfb081002c3de8d603d6b17f3f1718f2960a09375c88a39425498216bde54446b27402083b177f315db9587327b6454ec864a695
@@ -0,0 +1,102 @@
1
+ require 'fastlane/action'
2
+ # require 'ci'
3
+ require_relative '../helper/sunny_project_helper'
4
+ require 'semantic'
5
+ require_relative '../helper/plugin_options'
6
+
7
+ # def with_captured_stdout
8
+ # original_stdout = FastlaneCore::UI.ui_object
9
+ # str = ''
10
+ # ci_output = FastlaneCI::FastlaneCIOutput.new(
11
+ # each_line_block: proc do |raw_row|
12
+ # str = str + raw_row
13
+ # end
14
+ # )
15
+ #
16
+ # FastlaneCore::UI.ui_object = ci_output
17
+ # yield
18
+ # str
19
+ # ensure
20
+ # FastlaneCore::UI.ui_object = original_stdout
21
+ # end
22
+
23
+ module Fastlane
24
+ module Actions
25
+ class DartPackageStatusAction < Action
26
+ def self.run(options)
27
+ params = FastlaneCore::Configuration.create(Fastlane::SunnyProject::Options.available_options, {})
28
+ params.load_configuration_file("Sunnyfile")
29
+ options.all_keys.each do |key|
30
+ params.set(key, options[key])
31
+ end
32
+ plugins = params[:sunny_plugins]
33
+ branches = params[:sunny_plugins]
34
+ Dir.chdir(params[:sunny_plugin_folder]) do
35
+ plugins.keys.each do |key|
36
+ folder = plugins[key]
37
+ folder_str = ''
38
+ unless key.to_s.eql? folder.to_s
39
+ folder_str = " (folder=#{folder})"
40
+ end
41
+ UI.command_output "############### #{key} #{folder_str}"
42
+ if !File.exists? "./#{folder_str}"
43
+ UI.important " > folder is missing"
44
+ else
45
+ Dir.chdir("./#{folder}") do
46
+ res = ''
47
+ begin
48
+ Fastlane::Actions::EnsureGitStatusCleanAction.run({})
49
+ rescue StandardError => e
50
+ UI.important " >> failed to check git status << #{e.message}"
51
+ unless res == ''
52
+ UI.important " >> #{res}"
53
+ end
54
+ if params[:sunny_verbose]
55
+ UI.user_error! "#{e.backtrace}"
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+
65
+
66
+ def self.convert_options(options)
67
+ o = options.__hash__.dup
68
+ o.delete(:verbose)
69
+ o
70
+ end
71
+
72
+ def self.description
73
+ "Get or retrieve release notes from git"
74
+ end
75
+
76
+ def self.authors
77
+ ["ericmartineau"]
78
+ end
79
+
80
+ def self.return_value
81
+ # If your method provides a return value, you can describe here what it does
82
+ end
83
+
84
+ def self.details
85
+ # Optional:
86
+ ""
87
+ end
88
+
89
+ def self.available_options
90
+ Fastlane::SunnyProject::Options.available_options
91
+ end
92
+
93
+ def self.is_supported?(platform)
94
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
95
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
96
+ #
97
+ # [:ios, :mac, :android].include?(platform)
98
+ true
99
+ end
100
+ end
101
+ end
102
+
@@ -0,0 +1,158 @@
1
+ require 'fastlane/action'
2
+
3
+ # require 'ci'
4
+ require_relative '../helper/sunny_project_helper'
5
+ require 'semantic'
6
+ require 'yaml'
7
+ require 'yaml_normalizer'
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
+ # normalize = YamlNormalizer::Services::Normalize.new('pubspec.yaml')
100
+ # normalize.call
101
+ print(final_pubspec)
102
+ end
103
+
104
+ def self.description
105
+ "Modify pubspec for local or git development"
106
+ end
107
+
108
+ def self.authors
109
+ ["ericmartineau"]
110
+ end
111
+
112
+ def self.return_value
113
+ # If your method provides a return value, you can describe here what it does
114
+ end
115
+
116
+ def self.details
117
+ # Optional:
118
+ ""
119
+ end
120
+
121
+ def self.available_options
122
+ Fastlane::SunnyProject::Options.available_options
123
+ end
124
+
125
+ def self.is_supported?(platform)
126
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
127
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
128
+ #
129
+ # [:ios, :mac, :android].include?(platform)
130
+ true
131
+ end
132
+ end
133
+
134
+ class CustomVisitor < Psych::Visitors::Emitter
135
+ def initialize(io)
136
+ super(io)
137
+ end
138
+
139
+ def visit_Psych_Nodes_Scalar(o)
140
+ if o.value.is_a? String
141
+ str="#{o.value}"
142
+ if str.start_with?('^') || str.start_with?('..')
143
+ @handler.scalar o.value, o.anchor, o.tag, o.plain, o.quoted, 1
144
+ elsif str.start_with?('https://') || str.start_with?('git@')
145
+ @handler.scalar o.value, o.anchor, o.tag, o.plain, o.quoted, 3
146
+ else
147
+ @handler.scalar o.value, o.anchor, o.tag, o.plain, o.quoted, o.style
148
+ end
149
+ return
150
+ end
151
+ @handler.scalar o.value, o.anchor, o.tag, o.plain, o.quoted, o.style
152
+ end
153
+ end
154
+
155
+
156
+ end
157
+ end
158
+
@@ -0,0 +1,42 @@
1
+ require 'fastlane_core/configuration/config_item'
2
+ require 'fastlane/helper/lane_helper'
3
+
4
+ module Fastlane
5
+ module SunnyProject
6
+ class Options
7
+ # This is match specific, as users can append storage specific options
8
+ def self.append_option(option)
9
+ self.available_options # to ensure we created the initial `@available_options` array
10
+ self.available_options.merge(option)
11
+ end
12
+
13
+ def self.available_options
14
+ [
15
+ FastlaneCore::ConfigItem.new(key: :sunny_plugins,
16
+ env_name: "SUNNY_PLUGINS",
17
+ description: "The plugins",
18
+ type: Hash,
19
+ optional: true,),
20
+ FastlaneCore::ConfigItem.new(key: :sunny_plugin_folder,
21
+ env_name: "SUNNY_PLUGIN_FOLDER",
22
+ description: "Folder that contains the packages",
23
+ type: String,
24
+ optional: false,
25
+ default_value: '../plugin'),
26
+ FastlaneCore::ConfigItem.new(key: :sunny_plugins_branches,
27
+ env_name: "SUNNY_PLUGINS_BRANCHES",
28
+ description: "Specific branches to use",
29
+ type: Hash,
30
+ optional: true,),
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,
35
+ optional: true,
36
+ default_value: "git"),
37
+
38
+ ]
39
+ end
40
+ end
41
+ end
42
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module SunnyProject
3
- VERSION = "0.1.3"
3
+ VERSION = "0.1.8"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-sunny_project
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.8
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
+ - !ruby/object:Gem::Dependency
14
+ name: ci
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: pry
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +142,14 @@ dependencies:
128
142
  requirements:
129
143
  - - ">="
130
144
  - !ruby/object:Gem::Version
131
- version: 2.160.0
145
+ version: 2.168.0
132
146
  type: :development
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
150
  - - ">="
137
151
  - !ruby/object:Gem::Version
138
- version: 2.160.0
152
+ version: 2.168.0
139
153
  description:
140
154
  email: smartytime@gmail.com
141
155
  executables: []
@@ -146,15 +160,16 @@ files:
146
160
  - README.md
147
161
  - lib/fastlane/plugin/sunny_project.rb
148
162
  - lib/fastlane/plugin/sunny_project/actions/curr_semver_action.rb
149
- - lib/fastlane/plugin/sunny_project/actions/dart_packages_status_action.rb
163
+ - lib/fastlane/plugin/sunny_project/actions/dart_package_status_action.rb
150
164
  - lib/fastlane/plugin/sunny_project/actions/finalize_version_action.rb
151
165
  - lib/fastlane/plugin/sunny_project/actions/generate_icons_action.rb
152
166
  - lib/fastlane/plugin/sunny_project/actions/increase_version_action.rb
153
167
  - lib/fastlane/plugin/sunny_project/actions/pub_publish_action.rb
168
+ - lib/fastlane/plugin/sunny_project/actions/pubspec_doctor_action.rb
154
169
  - lib/fastlane/plugin/sunny_project/actions/release_notes_action.rb
155
170
  - lib/fastlane/plugin/sunny_project/actions/rename_assets_action.rb
171
+ - lib/fastlane/plugin/sunny_project/helper/plugin_options.rb
156
172
  - lib/fastlane/plugin/sunny_project/helper/sunny_project_helper.rb
157
- - lib/fastlane/plugin/sunny_project/options/plugin_options.rb
158
173
  - lib/fastlane/plugin/sunny_project/version.rb
159
174
  homepage: https://github.com/SunnyApp/fastlane-plugin-sunny_project
160
175
  licenses:
@@ -1,45 +0,0 @@
1
- require 'fastlane/action'
2
- require 'fastlane_core'
3
- require 'fastlane_core/ui/ui'
4
-
5
- require_relative '../helper/sunny_project_helper'
6
- require_relative '../options/plugin_options'
7
- require 'semantic'
8
-
9
- module Fastlane
10
- UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
11
- module Actions
12
- class DartPackagesStatus < Fastlane::Action
13
- def self.run(options)
14
- params = FastlaneCore::Configuration.create(SunnyPlugin::Options.available_options, options.__hash__)
15
- params.load_configuration_file("Sunnyfile")
16
- "Hello #{params.pretty_print}"
17
- end
18
-
19
- def self.description
20
- "Checks status of plugins modules"
21
- end
22
-
23
- def self.authors
24
- ["ericmartineau"]
25
- end
26
-
27
- def self.return_value
28
- # If your method provides a return value, you can describe here what it does
29
- end
30
-
31
- def self.details
32
- # Optional:
33
- ""
34
- end
35
-
36
- def self.available_options
37
- SunnyPluginOptions.available_options
38
- end
39
-
40
- def self.is_supported?(platform)
41
- true
42
- end
43
- end
44
- end
45
- end
@@ -1,33 +0,0 @@
1
- require 'fastlane_core/configuration/config_item'
2
- require 'fastlane/helper/lane_helper'
3
-
4
- module Fastlane
5
- module SunnyProject
6
- class SunnyPluginOptions
7
- # This is match specific, as users can append storage specific options
8
- def self.append_option(option)
9
- self.available_options # to ensure we created the initial `@available_options` array
10
- @available_options << option
11
- end
12
-
13
- def self.default_platform
14
- case Fastlane::Helper::LaneHelper.current_platform.to_s
15
- when "mac"
16
- "macos"
17
- else
18
- "ios"
19
- end
20
- end
21
-
22
- def self.available_options
23
- [
24
- FastlaneCore::ConfigItem.new(key: :sunny_plugins,
25
- env_name: "SUNNY_PLUGINS",
26
- description: "The plugins",
27
- type: Hash,
28
- optional: false,)
29
- ]
30
- end
31
- end
32
- end
33
- end