fastlane-plugin-sunny_project 0.1.4 → 0.1.5

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: 7c90ea7726a0c3b36982e44302d6d8d35e0b4067c655c21bba74ba01dee84d9c
4
+ data.tar.gz: f27bc1ec235f610d66c81413227d4e9d53d83bcaee834d4b668070de784bf558
5
5
  SHA512:
6
- metadata.gz: 8055fb6b959f289e8ab91cf0225d8ea4bff4c1b166a913fb540510bc26c3faaad28a9807cad1df75b07d64d3bc6ace508f75660e36b3838bf79a0e46e5190d81
7
- data.tar.gz: 595752d12ab6f375fe529993455bf70c590005fb9681a0aa96d0d072adf7f1b4b4ef413f1715ed91cd30427029ec5c17e230c549a79201dd2597f654d5b596b7
6
+ metadata.gz: 047cd447a90553162eb2895c9fdc4d85f1f170849a0fa90646af69516e216907f72e9348517ee2a24295b45c0c83c46879e48bff6d42bd55682cb2c2ccf8cc25
7
+ data.tar.gz: ebe81994c213e694a669142bb4deba1f4435b9019498586f10eae3dc21c4b44319b61be44e6a6a572ada49191511b997565acbf3ced32b975cb4ba682fe01afe
@@ -0,0 +1,155 @@
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
+ folder = key
53
+ branch = nil
54
+ path = nil
55
+ repo = key
56
+ if info.is_a? String
57
+ repo = info
58
+ else
59
+ path = info[:path]
60
+ branch = info[:branch] if info[:branch]
61
+ repo = info[:repo] if info[:repo]
62
+ folder = repo
63
+ end
64
+
65
+ if is_local
66
+ dependency_overrides[key.to_s] = {
67
+ 'path' => "#{plugin_folder}/#{folder}#{path ? "/#{path}" : ''}"
68
+ }
69
+ else
70
+ settings = {
71
+ 'git' => {
72
+ 'url' => "git@github.com:SunnyApp/#{repo}.git",
73
+ }
74
+ }
75
+ if branch
76
+ settings['git']['ref'] = branch
77
+ end
78
+ if path
79
+ settings['git']['path'] = "#{path}"
80
+ end
81
+ dependency_overrides[key.to_s] = settings
82
+ end
83
+ end
84
+
85
+ pubspec["dependencies"] = resort_keys pubspec["dependencies"]
86
+ pubspec["dev_dependencies"] = resort_keys pubspec["dev_dependencies"]
87
+ pubspec["dependency_overrides"] = resort_keys pubspec["dependency_overrides"]
88
+
89
+ pyaml = Psych::Visitors::YAMLTree.create
90
+ pyaml << pubspec
91
+ n=StringIO.new
92
+ emitter = CustomVisitor.new(n)
93
+ emitter.accept(pyaml.tree)
94
+ final_pubspec=n.string.gsub("---", "")
95
+ File.write('pubspec.yaml', final_pubspec)
96
+ # normalize = YamlNormalizer::Services::Normalize.new('pubspec.yaml')
97
+ # normalize.call
98
+ print(final_pubspec)
99
+ end
100
+
101
+ def self.description
102
+ "Modify pubspec for local or git development"
103
+ end
104
+
105
+ def self.authors
106
+ ["ericmartineau"]
107
+ end
108
+
109
+ def self.return_value
110
+ # If your method provides a return value, you can describe here what it does
111
+ end
112
+
113
+ def self.details
114
+ # Optional:
115
+ ""
116
+ end
117
+
118
+ def self.available_options
119
+ Fastlane::SunnyProject::Options.available_options
120
+ end
121
+
122
+ def self.is_supported?(platform)
123
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
124
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
125
+ #
126
+ # [:ios, :mac, :android].include?(platform)
127
+ true
128
+ end
129
+ end
130
+
131
+ class CustomVisitor < Psych::Visitors::Emitter
132
+ def initialize(io)
133
+ super(io)
134
+ end
135
+
136
+ def visit_Psych_Nodes_Scalar(o)
137
+ if o.value.is_a? String
138
+ str="#{o.value}"
139
+ if str.start_with?('^') || str.start_with?('..')
140
+ @handler.scalar o.value, o.anchor, o.tag, o.plain, o.quoted, 1
141
+ elsif str.start_with?('https://') || str.start_with?('git@')
142
+ @handler.scalar o.value, o.anchor, o.tag, o.plain, o.quoted, 3
143
+ else
144
+ @handler.scalar o.value, o.anchor, o.tag, o.plain, o.quoted, o.style
145
+ end
146
+ return
147
+ end
148
+ @handler.scalar o.value, o.anchor, o.tag, o.plain, o.quoted, o.style
149
+ end
150
+ end
151
+
152
+
153
+ end
154
+ end
155
+
@@ -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.5"
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.5
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-02 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