fastlane-plugin-sunny_project 0.1.20 → 0.2.1

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
  SHA256:
3
- metadata.gz: 077567b8b1975f13a73613b05e48677b0bb271b71ce4e4f1ee671e020044f17e
4
- data.tar.gz: 17b9e8f103cbf1da04603e9b57427336fe725528a3179ea48e856fd7495f2a16
3
+ metadata.gz: 9ce12ef710c532d745039014df9970dd64a5b0a3d76392ebe5feb7e84b0ae445
4
+ data.tar.gz: c4f5efa01f1c70f7f6ab043855e0f2c51f65611f75eab66d7ce04abb053c775d
5
5
  SHA512:
6
- metadata.gz: fa8b1b12128bcfca58685c644240b7b71e92566f4d155db0298e62832e031bec83dc8726d34c0e271b8ac814d0e94730e1ae02120c4a04cb21a1b1c7308d13bc
7
- data.tar.gz: 9b960dc6106b6ac4736f61b10e15d0c5da1c4b530a8105c93e3f638dcb1a758e15ce884f705d3e1328f08bd6c2b4a7be63cefd8cf861ce6994e23433dc6cc254
6
+ metadata.gz: e6037740092fe97afd89e55a50fbc288005950495c4c4605fb0564aab0fb704cdb7f70aa5d772d1b57a5bd5fff3248616ee4ddd1a14d490b8713bce25e7aa9f3
7
+ data.tar.gz: 0653c4a208fddb510fe77e6fd6bacdbba167399ee07286f1a3586ba8ed29b040ff4a31509490830c08b9c613c0780eb45e38c9e3a5cea5b47604cccd6354229c
@@ -26,20 +26,15 @@ end
26
26
  module Fastlane
27
27
  module Actions
28
28
  class PubspecDoctorAction < Action
29
- def self.run(options)
29
+ def self.run(params)
30
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]}")
31
+ unless params
32
+ params = FastlaneCore::Configuration.create(self.available_options, {})
39
33
  end
34
+ params.load_configuration_file("Sunnyfile")
35
+ params.load_configuration_file(".Sunnyfile")
40
36
 
41
37
  plugins = params[:sunny_plugins]
42
- branches = params[:sunny_plugins_branches]
43
38
  plugin_folder = params[:sunny_plugin_folder]
44
39
  pubspec = YAML.load_file("pubspec.yaml")
45
40
  local_mode = params[:sunny_local_mode]
@@ -116,7 +111,14 @@ module Fastlane
116
111
  end
117
112
 
118
113
  def self.available_options
119
- Fastlane::SunnyProject::Options.available_options
114
+ opts = [
115
+
116
+ ]
117
+
118
+ Fastlane::SunnyProject::Options.available_options.each do |option|
119
+ opts.push(option)
120
+ end
121
+ opts
120
122
  end
121
123
 
122
124
  def self.is_supported?(platform)
@@ -0,0 +1,71 @@
1
+ require_relative '../helper/sunny_project_helper'
2
+ require 'semantic'
3
+ require 'yaml'
4
+
5
+ require_relative '../helper/plugin_options'
6
+
7
+ module Fastlane
8
+ UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
9
+ module Actions
10
+ class SunnyBuildRunnerAction < Action
11
+ def self.run(options)
12
+ Sunny.build_runner(options)
13
+ end
14
+
15
+ def self.description
16
+ "Cleans and runs flutter build_runner"
17
+ end
18
+
19
+ def self.authors
20
+ ["ericmartineau"]
21
+ end
22
+
23
+ def self.return_value
24
+ # If your method provides a return value, you can describe here what it does
25
+ end
26
+
27
+ def self.details
28
+ # Optional:
29
+ ""
30
+ end
31
+
32
+ def self.available_options
33
+ [
34
+ FastlaneCore::ConfigItem.new(key: :clean,
35
+ env_name: "SUNNY_CLEAN",
36
+ description: "Whether to clean",
37
+ optional: true, type: Object),
38
+
39
+ FastlaneCore::ConfigItem.new(key: :flutter,
40
+ env_name: "SUNNY_FLUTTER",
41
+ description: "Path to flutter sdk",
42
+ optional: true, type: String),
43
+ FastlaneCore::ConfigItem.new(key: :skip_pub,
44
+ env_name: "SUNNY_SKIP_PUB",
45
+ description: "Whether to skip pub get",
46
+ optional: true, type: Object),
47
+
48
+ FastlaneCore::ConfigItem.new(key: :skip_gen,
49
+ env_name: "SUNNY_SKIP_GEN",
50
+ description: "Whether to skip generation",
51
+ optional: true, type: Object),
52
+
53
+ FastlaneCore::ConfigItem.new(key: :verbose,
54
+ env_name: "SUNNY_VERBOSE",
55
+ description: "Verbose or not",
56
+ optional: true, type: Object),
57
+
58
+ ]
59
+ end
60
+
61
+ def self.is_supported?(platform)
62
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
63
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
64
+ #
65
+ # [:ios, :mac, :android].include?(platform)
66
+ true
67
+ end
68
+ end
69
+ end
70
+ end
71
+
@@ -0,0 +1,110 @@
1
+ require_relative '../helper/sunny_project_helper'
2
+ require 'semantic'
3
+ require 'yaml'
4
+
5
+ require_relative '../helper/plugin_options'
6
+
7
+ module Fastlane
8
+ UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
9
+ module Actions
10
+ class SunnyBuildWebAction < Action
11
+ def self.run(options)
12
+ unless options[:skip_build_runner]
13
+ Sunny.build_runner(options)
14
+ end
15
+ flutter = Sunny.get_flutter(options[:flutter])
16
+ profile = if options[:profile]
17
+ " --profile"
18
+ else
19
+ ""
20
+ end
21
+
22
+ build_cmd = "build web#{profile} --web-renderer #{options[:renderer]}"
23
+ Sunny.exec_cmd_options("flutter #{build_cmd}", "#{flutter} #{build_cmd}", options)
24
+
25
+ if options[:deploy]
26
+ Sunny.exec_cmd_options("firebase deploy", "firebase deploy", options)
27
+ end
28
+ end
29
+
30
+ def self.description
31
+ "Builds a web project"
32
+ end
33
+
34
+ def self.authors
35
+ ["ericmartineau"]
36
+ end
37
+
38
+ def self.return_value
39
+ # If your method provides a return value, you can describe here what it does
40
+ end
41
+
42
+ def self.details
43
+ # Optional:
44
+ ""
45
+ end
46
+
47
+ def self.available_options
48
+ [
49
+ FastlaneCore::ConfigItem.new(key: :skip_build_runner,
50
+ env_name: "SUNNY_SKIP_BUILD_RUNNER",
51
+ description: "Whether to skip the build_runner phase",
52
+ optional: true, type: Object),
53
+
54
+ FastlaneCore::ConfigItem.new(key: :clean,
55
+ env_name: "SUNNY_CLEAN",
56
+ description: "Whether to clean",
57
+ optional: true, type: Object),
58
+
59
+ FastlaneCore::ConfigItem.new(key: :flutter,
60
+ env_name: "SUNNY_FLUTTER",
61
+ description: "Path to flutter sdk",
62
+ optional: true, type: String),
63
+ FastlaneCore::ConfigItem.new(key: :skip_pub,
64
+ env_name: "SUNNY_SKIP_PUB",
65
+ description: "Whether to skip pub get",
66
+ optional: true, type: Object),
67
+
68
+ FastlaneCore::ConfigItem.new(key: :skip_gen,
69
+ env_name: "SUNNY_SKIP_GEN",
70
+ description: "Whether to skip generation",
71
+ optional: true, type: Object),
72
+
73
+ FastlaneCore::ConfigItem.new(key: :renderer,
74
+ env_name: "SUNNY_RENDERER",
75
+ description: "The flutter web renderer to build with",
76
+ optional: false,
77
+ default_value: "auto", type: String),
78
+
79
+ FastlaneCore::ConfigItem.new(key: :profile,
80
+ env_name: "SUNNY_PROFILE",
81
+ description: "Whether to run in profile mode",
82
+ optional: true,
83
+ type: Object),
84
+
85
+ FastlaneCore::ConfigItem.new(key: :deploy,
86
+ env_name: "SUNNY_DEPLOY",
87
+ description: "Whether to deploy to firebase",
88
+ optional: true,
89
+ type: Object),
90
+
91
+ FastlaneCore::ConfigItem.new(key: :verbose,
92
+ env_name: "SUNNY_VERBOSE",
93
+ description: "Whether to show verbose output",
94
+ optional: true,
95
+ type: Object),
96
+
97
+ ]
98
+ end
99
+
100
+ def self.is_supported?(platform)
101
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
102
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
103
+ #
104
+ # [:ios, :mac, :android].include?(platform)
105
+ true
106
+ end
107
+ end
108
+ end
109
+ end
110
+
@@ -1,4 +1,5 @@
1
1
  require 'fastlane_core/ui/ui'
2
+ require 'fastlane/helper/sh_helper'
2
3
  require "fastlane"
3
4
 
4
5
  module Fastlane
@@ -59,14 +60,22 @@ module Fastlane
59
60
  self.current_semver
60
61
  end
61
62
 
63
+ def self.config_to_hash(options)
64
+ hash = Hash([])
65
+ options.all_keys.each do |key|
66
+ hash.store(key, options.fetch(key, ask: false))
67
+ end
68
+ return hash
69
+ end
70
+
62
71
  def self.exec_cmd(name, *command, **args)
63
- if (command.count > 1)
72
+ if command.count > 1
64
73
  command = command.map { |item| Shellwords.escape(item) }
65
74
  end
66
75
  joined = command.join(" ")
67
76
  if args[:verbose]
68
77
  begin
69
- return sh(command)
78
+ return Fastlane::Actions.sh(*command, log:true, error_callback: ->(str) { UI.user_error!(">> #{name} failed << \n #{str}") })
70
79
  rescue StandardError => e
71
80
  UI.user_error!(">> #{name} failed << \n #{e}")
72
81
  end
@@ -84,6 +93,10 @@ module Fastlane
84
93
  end
85
94
  end
86
95
 
96
+ def self.exec_cmd_options(name, command, options)
97
+ return exec_cmd(name, command, **config_to_hash(options))
98
+ end
99
+
87
100
  def self.release_notes_file
88
101
  ".release-notes"
89
102
  end
@@ -144,6 +157,32 @@ module Fastlane
144
157
  provided || ".fvm/flutter_sdk/bin/flutter"
145
158
  end
146
159
 
160
+ def self.build_runner(options)
161
+ flutter = get_flutter(options[:flutter])
162
+ opt_hash = config_to_hash(options)
163
+ if options[:clean]
164
+ exec_cmd("flutter clean", "#{flutter} clean", **opt_hash)
165
+ end
166
+
167
+ if options[:clean] || (!options[:skip_pub])
168
+ exec_cmd("flutter pub get", "#{flutter} pub get", **opt_hash)
169
+ end
170
+
171
+ if options[:clean] || (!options[:skip_gen])
172
+ dc = if options[:clean]
173
+ " --delete-conflicting-outputs"
174
+ else
175
+ ""
176
+ end
177
+ vb = if options[:verbose]
178
+ " -v"
179
+ else
180
+ ""
181
+ end
182
+ exec_cmd("flutter pub run build_runner build#{dc}#{vb}", "#{flutter} pub run build_runner build#{dc}#{vb}", **opt_hash)
183
+ end
184
+ end
185
+
147
186
  def self.override_version(**options)
148
187
  semver = options[:version]
149
188
  unless semver
@@ -159,7 +198,7 @@ module Fastlane
159
198
  self.run_action(Fastlane::Actions::IncrementVersionNumberAction,
160
199
  version_number: "#{version.major}.#{version.minor}.#{version.patch}",
161
200
  xcodeproj: "ios/Runner.xcodeproj"
162
- )
201
+ )
163
202
  else
164
203
  UI.user_error!("No version found")
165
204
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module SunnyProject
3
- VERSION = "0.1.20"
3
+ VERSION = "0.2.1"
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.20
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ericmartineau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-09 00:00:00.000000000 Z
11
+ date: 2021-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -155,6 +155,8 @@ files:
155
155
  - lib/fastlane/plugin/sunny_project/actions/pubspec_doctor_action.rb
156
156
  - lib/fastlane/plugin/sunny_project/actions/release_notes_action.rb
157
157
  - lib/fastlane/plugin/sunny_project/actions/rename_assets_action.rb
158
+ - lib/fastlane/plugin/sunny_project/actions/sunny_build_runner.rb
159
+ - lib/fastlane/plugin/sunny_project/actions/sunny_build_web.rb
158
160
  - lib/fastlane/plugin/sunny_project/actions/sunny_release_action.rb
159
161
  - lib/fastlane/plugin/sunny_project/helper/plugin_options.rb
160
162
  - lib/fastlane/plugin/sunny_project/helper/sunny_project_helper.rb