flutterfy-cli 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 +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +23 -0
- data/.ruby-gemset +1 -0
- data/.tool-versions +1 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +176 -0
- data/README.md +64 -0
- data/Rakefile +12 -0
- data/assets/ss.png +0 -0
- data/lib/f/automation/libs/creators_lib.rb +32 -0
- data/lib/f/automation/libs/utils_lib.rb +58 -0
- data/lib/f/automation/version.rb +7 -0
- data/lib/f/automation.rb +148 -0
- data/lib/f/scripts/bump_version.sh +61 -0
- metadata +58 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 103e5c8e52e84f3d93f1030e1f8785b87544175c88fdd89b4924b74759826497
|
|
4
|
+
data.tar.gz: 6927ce9502fd38c51716e6e7593784bad1333cef8d2c177b386c67471ae78e89
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: f769e21ad6e6b9a24f40f1504bb30e413bdd3606fa27a2b42ce776a097e31faf495e5f75fce82783d6b21029a20b88444681c42f3bd498e0ac853273e6b539d1
|
|
7
|
+
data.tar.gz: acea14437c7fa1a3b8fdf7c0f68088797e43dd24c9530800f0b3a9b4c16d08031155acf2c2295301da3f37d831c608dc3b96bee2735e31b0546bfdea05905489
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
TargetRubyVersion: 2.6
|
|
3
|
+
|
|
4
|
+
Style/StringLiterals:
|
|
5
|
+
Enabled: true
|
|
6
|
+
EnforcedStyle: double_quotes
|
|
7
|
+
|
|
8
|
+
Style/StringLiteralsInInterpolation:
|
|
9
|
+
Enabled: true
|
|
10
|
+
EnforcedStyle: double_quotes
|
|
11
|
+
|
|
12
|
+
Layout/LineLength:
|
|
13
|
+
Max: 120
|
|
14
|
+
|
|
15
|
+
Metrics/ClassLength:
|
|
16
|
+
Max: 150
|
|
17
|
+
|
|
18
|
+
Metrics/MethodLength:
|
|
19
|
+
Max: 30
|
|
20
|
+
|
|
21
|
+
Metrics/AbcSize:
|
|
22
|
+
Max: 55 # Or any value that you find suitable
|
|
23
|
+
|
data/.ruby-gemset
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
f
|
data/.tool-versions
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ruby 3.2.2
|
data/Gemfile
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
source "https://rubygems.org"
|
|
4
|
+
|
|
5
|
+
# Specify your gem's dependencies in fitfans-automation.gemspec
|
|
6
|
+
gemspec
|
|
7
|
+
|
|
8
|
+
gem "CFPropertyList", "~> 3.0"
|
|
9
|
+
gem "cocoapods", "~> 1.11"
|
|
10
|
+
gem "colorize", "~> 0.8.1"
|
|
11
|
+
gem "httparty", "~> 0.20.0"
|
|
12
|
+
gem "launchy", "~> 2.5"
|
|
13
|
+
gem "rake", "~> 13.0"
|
|
14
|
+
gem "rspec", "~> 3.0"
|
|
15
|
+
gem "rubocop", "~> 1.21"
|
|
16
|
+
gem "terminal-table", "~> 3.0"
|
|
17
|
+
gem "tmpdir", "~> 0.1.2"
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
flutterfy-cli (0.1.0)
|
|
5
|
+
|
|
6
|
+
GEM
|
|
7
|
+
remote: https://rubygems.org/
|
|
8
|
+
specs:
|
|
9
|
+
CFPropertyList (3.0.6)
|
|
10
|
+
rexml
|
|
11
|
+
activesupport (7.1.2)
|
|
12
|
+
base64
|
|
13
|
+
bigdecimal
|
|
14
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
15
|
+
connection_pool (>= 2.2.5)
|
|
16
|
+
drb
|
|
17
|
+
i18n (>= 1.6, < 2)
|
|
18
|
+
minitest (>= 5.1)
|
|
19
|
+
mutex_m
|
|
20
|
+
tzinfo (~> 2.0)
|
|
21
|
+
addressable (2.8.5)
|
|
22
|
+
public_suffix (>= 2.0.2, < 6.0)
|
|
23
|
+
algoliasearch (1.27.5)
|
|
24
|
+
httpclient (~> 2.8, >= 2.8.3)
|
|
25
|
+
json (>= 1.5.1)
|
|
26
|
+
ast (2.4.2)
|
|
27
|
+
atomos (0.1.3)
|
|
28
|
+
base64 (0.2.0)
|
|
29
|
+
bigdecimal (3.1.4)
|
|
30
|
+
claide (1.1.0)
|
|
31
|
+
cocoapods (1.14.3)
|
|
32
|
+
addressable (~> 2.8)
|
|
33
|
+
claide (>= 1.0.2, < 2.0)
|
|
34
|
+
cocoapods-core (= 1.14.3)
|
|
35
|
+
cocoapods-deintegrate (>= 1.0.3, < 2.0)
|
|
36
|
+
cocoapods-downloader (>= 2.1, < 3.0)
|
|
37
|
+
cocoapods-plugins (>= 1.0.0, < 2.0)
|
|
38
|
+
cocoapods-search (>= 1.0.0, < 2.0)
|
|
39
|
+
cocoapods-trunk (>= 1.6.0, < 2.0)
|
|
40
|
+
cocoapods-try (>= 1.1.0, < 2.0)
|
|
41
|
+
colored2 (~> 3.1)
|
|
42
|
+
escape (~> 0.0.4)
|
|
43
|
+
fourflusher (>= 2.3.0, < 3.0)
|
|
44
|
+
gh_inspector (~> 1.0)
|
|
45
|
+
molinillo (~> 0.8.0)
|
|
46
|
+
nap (~> 1.0)
|
|
47
|
+
ruby-macho (>= 2.3.0, < 3.0)
|
|
48
|
+
xcodeproj (>= 1.23.0, < 2.0)
|
|
49
|
+
cocoapods-core (1.14.3)
|
|
50
|
+
activesupport (>= 5.0, < 8)
|
|
51
|
+
addressable (~> 2.8)
|
|
52
|
+
algoliasearch (~> 1.0)
|
|
53
|
+
concurrent-ruby (~> 1.1)
|
|
54
|
+
fuzzy_match (~> 2.0.4)
|
|
55
|
+
nap (~> 1.0)
|
|
56
|
+
netrc (~> 0.11)
|
|
57
|
+
public_suffix (~> 4.0)
|
|
58
|
+
typhoeus (~> 1.0)
|
|
59
|
+
cocoapods-deintegrate (1.0.5)
|
|
60
|
+
cocoapods-downloader (2.1)
|
|
61
|
+
cocoapods-plugins (1.0.0)
|
|
62
|
+
nap
|
|
63
|
+
cocoapods-search (1.0.1)
|
|
64
|
+
cocoapods-trunk (1.6.0)
|
|
65
|
+
nap (>= 0.8, < 2.0)
|
|
66
|
+
netrc (~> 0.11)
|
|
67
|
+
cocoapods-try (1.2.0)
|
|
68
|
+
colored2 (3.1.2)
|
|
69
|
+
colorize (0.8.1)
|
|
70
|
+
concurrent-ruby (1.2.2)
|
|
71
|
+
connection_pool (2.4.1)
|
|
72
|
+
diff-lcs (1.5.0)
|
|
73
|
+
drb (2.2.0)
|
|
74
|
+
ruby2_keywords
|
|
75
|
+
escape (0.0.4)
|
|
76
|
+
ethon (0.16.0)
|
|
77
|
+
ffi (>= 1.15.0)
|
|
78
|
+
ffi (1.16.3)
|
|
79
|
+
fileutils (1.7.2)
|
|
80
|
+
fourflusher (2.3.1)
|
|
81
|
+
fuzzy_match (2.0.4)
|
|
82
|
+
gh_inspector (1.1.3)
|
|
83
|
+
httparty (0.20.0)
|
|
84
|
+
mime-types (~> 3.0)
|
|
85
|
+
multi_xml (>= 0.5.2)
|
|
86
|
+
httpclient (2.8.3)
|
|
87
|
+
i18n (1.14.1)
|
|
88
|
+
concurrent-ruby (~> 1.0)
|
|
89
|
+
json (2.7.1)
|
|
90
|
+
language_server-protocol (3.17.0.3)
|
|
91
|
+
launchy (2.5.2)
|
|
92
|
+
addressable (~> 2.8)
|
|
93
|
+
mime-types (3.5.1)
|
|
94
|
+
mime-types-data (~> 3.2015)
|
|
95
|
+
mime-types-data (3.2023.1205)
|
|
96
|
+
minitest (5.20.0)
|
|
97
|
+
molinillo (0.8.0)
|
|
98
|
+
multi_xml (0.6.0)
|
|
99
|
+
mutex_m (0.2.0)
|
|
100
|
+
nanaimo (0.3.0)
|
|
101
|
+
nap (1.1.0)
|
|
102
|
+
netrc (0.11.0)
|
|
103
|
+
parallel (1.23.0)
|
|
104
|
+
parser (3.2.2.4)
|
|
105
|
+
ast (~> 2.4.1)
|
|
106
|
+
racc
|
|
107
|
+
public_suffix (4.0.7)
|
|
108
|
+
racc (1.7.3)
|
|
109
|
+
rainbow (3.1.1)
|
|
110
|
+
rake (13.1.0)
|
|
111
|
+
regexp_parser (2.8.3)
|
|
112
|
+
rexml (3.2.6)
|
|
113
|
+
rspec (3.12.0)
|
|
114
|
+
rspec-core (~> 3.12.0)
|
|
115
|
+
rspec-expectations (~> 3.12.0)
|
|
116
|
+
rspec-mocks (~> 3.12.0)
|
|
117
|
+
rspec-core (3.12.2)
|
|
118
|
+
rspec-support (~> 3.12.0)
|
|
119
|
+
rspec-expectations (3.12.3)
|
|
120
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
121
|
+
rspec-support (~> 3.12.0)
|
|
122
|
+
rspec-mocks (3.12.6)
|
|
123
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
124
|
+
rspec-support (~> 3.12.0)
|
|
125
|
+
rspec-support (3.12.1)
|
|
126
|
+
rubocop (1.58.0)
|
|
127
|
+
json (~> 2.3)
|
|
128
|
+
language_server-protocol (>= 3.17.0)
|
|
129
|
+
parallel (~> 1.10)
|
|
130
|
+
parser (>= 3.2.2.4)
|
|
131
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
132
|
+
regexp_parser (>= 1.8, < 3.0)
|
|
133
|
+
rexml (>= 3.2.5, < 4.0)
|
|
134
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
|
135
|
+
ruby-progressbar (~> 1.7)
|
|
136
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
|
137
|
+
rubocop-ast (1.30.0)
|
|
138
|
+
parser (>= 3.2.1.0)
|
|
139
|
+
ruby-macho (2.5.1)
|
|
140
|
+
ruby-progressbar (1.13.0)
|
|
141
|
+
ruby2_keywords (0.0.5)
|
|
142
|
+
terminal-table (3.0.2)
|
|
143
|
+
unicode-display_width (>= 1.1.1, < 3)
|
|
144
|
+
tmpdir (0.1.3)
|
|
145
|
+
fileutils
|
|
146
|
+
typhoeus (1.4.1)
|
|
147
|
+
ethon (>= 0.9.0)
|
|
148
|
+
tzinfo (2.0.6)
|
|
149
|
+
concurrent-ruby (~> 1.0)
|
|
150
|
+
unicode-display_width (2.5.0)
|
|
151
|
+
xcodeproj (1.23.0)
|
|
152
|
+
CFPropertyList (>= 2.3.3, < 4.0)
|
|
153
|
+
atomos (~> 0.1.3)
|
|
154
|
+
claide (>= 1.0.2, < 2.0)
|
|
155
|
+
colored2 (~> 3.1)
|
|
156
|
+
nanaimo (~> 0.3.0)
|
|
157
|
+
rexml (~> 3.2.4)
|
|
158
|
+
|
|
159
|
+
PLATFORMS
|
|
160
|
+
arm64-darwin-23
|
|
161
|
+
|
|
162
|
+
DEPENDENCIES
|
|
163
|
+
CFPropertyList (~> 3.0)
|
|
164
|
+
cocoapods (~> 1.11)
|
|
165
|
+
colorize (~> 0.8.1)
|
|
166
|
+
flutterfy-cli!
|
|
167
|
+
httparty (~> 0.20.0)
|
|
168
|
+
launchy (~> 2.5)
|
|
169
|
+
rake (~> 13.0)
|
|
170
|
+
rspec (~> 3.0)
|
|
171
|
+
rubocop (~> 1.21)
|
|
172
|
+
terminal-table (~> 3.0)
|
|
173
|
+
tmpdir (~> 0.1.2)
|
|
174
|
+
|
|
175
|
+
BUNDLED WITH
|
|
176
|
+
2.4.17
|
data/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# flutterfy-cli
|
|
2
|
+
> Combination of `Flutter` + `Simplify`
|
|
3
|
+
|
|
4
|
+
> Instead of copy pasting scripts for every new flutter project I'm working on I can just run `f` on a flutter project and run these common daily tasks.
|
|
5
|
+
|
|
6
|
+
<p align="center">
|
|
7
|
+
<img src="assets/ss.png" width="100%" />
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
f clean
|
|
15
|
+
# => Deep cleans the project and rebuilds it.
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
f fix
|
|
20
|
+
# => Automatically identifies and corrects common issues in Dart code, such as outdated syntax.
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
f fix
|
|
25
|
+
# => Automatically identifies and corrects common issues in Dart code, such as outdated syntax
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
```bash
|
|
29
|
+
f bump major|minor|patch|build
|
|
30
|
+
# => bumps the corresponding update type (and it always bumps the build number)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
f generate swagger|icon|assets
|
|
35
|
+
# => swagger: Executes a function to generate a Swagger (OpenAPI) client.
|
|
36
|
+
# => icon: Generates the icons for the app. (using "flutter_launcher_icons")
|
|
37
|
+
# => assets: Initiates asset generation and management. (using "fluttergen")
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
f open ios|android
|
|
42
|
+
# => ios: Opens the appstoreconnect website.
|
|
43
|
+
# => android: Opens the play console website.
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
f release beta|production
|
|
48
|
+
# => beta: Releases the current build to the beta track.
|
|
49
|
+
# => production: the current build to the production track.
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Install
|
|
53
|
+
Clone the repo in your designated folder
|
|
54
|
+
```bash
|
|
55
|
+
git clone git@github.com:cesarferreira/flutterfy-cli.git
|
|
56
|
+
```
|
|
57
|
+
Now add to your `~/.bashrc` or `~/.zshrc`
|
|
58
|
+
```bash
|
|
59
|
+
alias f="ruby -Ilib PATH_TO_GEM_FOLDER/f/bin/f"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
## Nice to Have
|
|
64
|
+
- [ ] listen to build_runner changes `flutter pub run build_runner watch -d`
|
data/Rakefile
ADDED
data/assets/ss.png
ADDED
|
Binary file
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# require "httparty"
|
|
4
|
+
require "json"
|
|
5
|
+
require "colorize"
|
|
6
|
+
require "terminal-table"
|
|
7
|
+
|
|
8
|
+
class Creators
|
|
9
|
+
# def self.create_new_app(subdomain, bundle_id, app_name)
|
|
10
|
+
# # TODO: get config and use the values from there, easy!!
|
|
11
|
+
# require "tmpdir"
|
|
12
|
+
# Dir.mktmpdir("fitfans_") do |tmpdir|
|
|
13
|
+
# Utils.title "Cloning #{subdomain.green.bold} into a temporary directory"
|
|
14
|
+
# Utils.execute "git clone #{@cloneable_url} #{tmpdir}"
|
|
15
|
+
# Dir.chdir tmpdir
|
|
16
|
+
|
|
17
|
+
# # switch_to X
|
|
18
|
+
# Utils.title "Checkout #{subdomain.green.bold}"
|
|
19
|
+
# Creators.switch_to subdomain
|
|
20
|
+
|
|
21
|
+
# Utils.title "Creating #{app_name.green.bold} (#{bundle_id.green.yellow}) in iTunes Connect"
|
|
22
|
+
# Creators.create_app(bundle_id, app_name)
|
|
23
|
+
|
|
24
|
+
# Utils.title "Release #{subdomain.green.bold} to testflight"
|
|
25
|
+
# Utils.run_fastlane_beta
|
|
26
|
+
# end
|
|
27
|
+
# end
|
|
28
|
+
|
|
29
|
+
def self.create_app(bundle_id, app_name)
|
|
30
|
+
Utils.execute "bundle exec fastlane ios create_new_app app_identifier:\"#{bundle_id}\" app_name:\"#{app_name}\""
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# require 'httparty'
|
|
4
|
+
require "json"
|
|
5
|
+
require "colorize"
|
|
6
|
+
require "terminal-table"
|
|
7
|
+
require "cfpropertylist"
|
|
8
|
+
|
|
9
|
+
class Utils
|
|
10
|
+
def self.run_fastlane(lane)
|
|
11
|
+
Dir.chdir("./ios/") do
|
|
12
|
+
Utils.execute "bundle exec pod install"
|
|
13
|
+
Utils.execute "bundle exec fastlane #{lane}"
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# TODO: bump a build number
|
|
18
|
+
|
|
19
|
+
def self.replace_launcher_icon
|
|
20
|
+
# system("wget '#{logo_url}' -O ./assets/logo.png")
|
|
21
|
+
system("dart run flutter_launcher_icons")
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def self.generate_splash_screen(_watermark_url, _color, _is_powered_by_on)
|
|
25
|
+
system("dart run flutter_native_splash:create --path=splash.yaml")
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# TODO: replace with
|
|
29
|
+
def self.is_flutter_project
|
|
30
|
+
File.file?("./pubspec.yaml")
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def self.interrupt_if_non_flutter_project
|
|
34
|
+
abort("This is not a flutter project...".red) unless is_flutter_project
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def self.title(text)
|
|
38
|
+
puts ""
|
|
39
|
+
puts "==> ".bold.blue + text.bold
|
|
40
|
+
puts ""
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def self.configure_fastlane
|
|
44
|
+
system("flutterfire configure -y")
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def self.execute(command)
|
|
48
|
+
is_success = system command
|
|
49
|
+
# is_success = Bundler::system command
|
|
50
|
+
return if is_success
|
|
51
|
+
|
|
52
|
+
puts "\n\n======================================================\n\n"
|
|
53
|
+
puts " Something went wrong while executing this:".red
|
|
54
|
+
puts " $ #{command}\n".yellow
|
|
55
|
+
puts "======================================================\n\n"
|
|
56
|
+
exit 1
|
|
57
|
+
end
|
|
58
|
+
end
|
data/lib/f/automation.rb
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# rubocop:disable Lint/MissingCopEnableDirective
|
|
4
|
+
require_relative "automation/version"
|
|
5
|
+
require_relative "automation/libs/creators_lib"
|
|
6
|
+
require_relative "automation/libs/utils_lib"
|
|
7
|
+
require "launchy"
|
|
8
|
+
|
|
9
|
+
module F
|
|
10
|
+
module Automation
|
|
11
|
+
class Main
|
|
12
|
+
def initialize(arguments)
|
|
13
|
+
case arguments[0]
|
|
14
|
+
when "generate" then handle_generate_command(arguments)
|
|
15
|
+
when "release" then release(arguments)
|
|
16
|
+
when "clean" then clean_rebuild(arguments)
|
|
17
|
+
when "open" then handle_open_command(arguments)
|
|
18
|
+
when "bump" then bump(arguments)
|
|
19
|
+
when "help" then help(arguments)
|
|
20
|
+
else
|
|
21
|
+
arguments[0].nil? ? help(arguments) : puts("Dont recognise the command".red)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# when "bump" then clean_rebuild(arguments) # TODO: bump a build number
|
|
26
|
+
|
|
27
|
+
def help(_arguments)
|
|
28
|
+
binary_name = "f"
|
|
29
|
+
# Define the rows of the table
|
|
30
|
+
rows = []
|
|
31
|
+
rows << ["#{binary_name} clean".green, "Deep cleans the project and rebuilds it."]
|
|
32
|
+
rows << :separator
|
|
33
|
+
rows << ["#{binary_name} fix".green,
|
|
34
|
+
"Automatically identifies and corrects common issues in Dart code, such as outdated syntax"]
|
|
35
|
+
rows << :separator
|
|
36
|
+
rows << ["#{binary_name} generate swagger".green, "Executes a function to generate a Swagger (OpenAPI) client."]
|
|
37
|
+
rows << ["#{binary_name} generate icon".green, "Generates the icons for the app."]
|
|
38
|
+
rows << ["#{binary_name} generate assets".green,
|
|
39
|
+
'Initiates asset generation and management. (using "fluttergen")']
|
|
40
|
+
rows << :separator
|
|
41
|
+
rows << ["#{binary_name} open apple".green, "Opens the #{"appstoreconnect".yellow} website."]
|
|
42
|
+
rows << ["#{binary_name} open android".green, "Opens the #{"play console".yellow} website."]
|
|
43
|
+
rows << :separator
|
|
44
|
+
rows << ["#{binary_name} release beta".green, "Releases the current build to the #{"beta".yellow} track."]
|
|
45
|
+
rows << ["#{binary_name} release production".green,
|
|
46
|
+
"Releases the current build to the #{"production".yellow} track."]
|
|
47
|
+
rows << :separator
|
|
48
|
+
rows << ["#{binary_name} bump major".green, "bumps the #{"MAJOR".yellow} build number (#{"x".yellow}.0.0+#{"y".yellow})"] # ESTEEEEE
|
|
49
|
+
rows << ["#{binary_name} bump minor".green,
|
|
50
|
+
"bumps the #{"MINOR".yellow} build number (0.#{"x".yellow}.0+#{"y".yellow})"]
|
|
51
|
+
rows << ["#{binary_name} bump patch".green,
|
|
52
|
+
"bumps the #{"PATCH".yellow} build number (0.0.#{"x".yellow}+#{"y".yellow})"]
|
|
53
|
+
rows << ["#{binary_name} bump build".green, "bumps the #{"build number".yellow} (1.0.0+#{"y".yellow})"]
|
|
54
|
+
rows << :separator
|
|
55
|
+
rows << ["#{binary_name} help".green, "Shows a table with all the available commands."]
|
|
56
|
+
# Create a table
|
|
57
|
+
table = Terminal::Table.new headings: ["Command".bold, "Description".bold], rows: rows
|
|
58
|
+
|
|
59
|
+
puts table
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def handle_open_command(arguments)
|
|
63
|
+
case arguments[1]
|
|
64
|
+
when "apple", "ios" then Launchy.open("https://appstoreconnect.apple.com/apps")
|
|
65
|
+
when "google", "android" then Launchy.open("https://play.google.com/console/u/0/developers/")
|
|
66
|
+
else
|
|
67
|
+
puts "Dont recognise the command"
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def handle_generate_command(arguments)
|
|
72
|
+
Utils.interrupt_if_non_flutter_project
|
|
73
|
+
|
|
74
|
+
case arguments[1]
|
|
75
|
+
when "swagger" then generate_network_layer(arguments)
|
|
76
|
+
when "icon" then generate_icons(arguments)
|
|
77
|
+
when "assets" then generate_assets(arguments)
|
|
78
|
+
else
|
|
79
|
+
puts "Dont recognise the command"
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
#
|
|
84
|
+
# release
|
|
85
|
+
#
|
|
86
|
+
def release(arguments)
|
|
87
|
+
Utils.interrupt_if_non_flutter_project
|
|
88
|
+
|
|
89
|
+
if arguments.length == 1
|
|
90
|
+
puts "Required 2 parameters".red
|
|
91
|
+
exit
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
case arguments[1]
|
|
95
|
+
when "beta" then Utils.run_fastlane("ios beta")
|
|
96
|
+
when "release" then Utils.run_fastlane("ios release")
|
|
97
|
+
else
|
|
98
|
+
puts "Not ready for #{arguments[1].red} yet"
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def generate_network_layer(_arguments)
|
|
103
|
+
Utils.interrupt_if_non_flutter_project
|
|
104
|
+
system("dart run build_runner build --delete-conflicting-outputs")
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def generate_icons(_arguments)
|
|
108
|
+
Utils.interrupt_if_non_flutter_project
|
|
109
|
+
system("dart run flutter_launcher_icons")
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def bump(arguments)
|
|
113
|
+
Utils.interrupt_if_non_flutter_project
|
|
114
|
+
case arguments[1]
|
|
115
|
+
when "major" then system(File.join(__dir__, "scripts/bump_version.sh pubspec.yaml major"))
|
|
116
|
+
when "minor" then system(File.join(__dir__, "scripts/bump_version.sh pubspec.yaml minor"))
|
|
117
|
+
when "patch" then system(File.join(__dir__, "scripts/bump_version.sh pubspec.yaml patch"))
|
|
118
|
+
when "build" then system(File.join(__dir__, "scripts/bump_version.sh pubspec.yaml build"))
|
|
119
|
+
else
|
|
120
|
+
puts "Not ready for #{arguments[1].red} yet"
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def generate_assets(_arguments)
|
|
125
|
+
Utils.interrupt_if_non_flutter_project
|
|
126
|
+
Utils.execute "fluttergen -c pubspec.yaml"
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
#
|
|
130
|
+
# CLEAN EVERYTHING
|
|
131
|
+
#
|
|
132
|
+
def clean_rebuild(_arguments)
|
|
133
|
+
Utils.interrupt_if_non_flutter_project
|
|
134
|
+
# flutter clean; rm -rf ios/Podfile.lock; flutter pub get; cd ios; pod install; cd ..
|
|
135
|
+
Utils.execute "flutter clean"
|
|
136
|
+
Utils.execute "flutter pub get"
|
|
137
|
+
Dir.chdir("./ios/") do
|
|
138
|
+
# Utils.execute "bundle install"
|
|
139
|
+
Utils.execute "rm -rf Podfile.lock"
|
|
140
|
+
Utils.execute "pod install"
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# class Error < StandardError; end
|
|
146
|
+
# Your code goes here...
|
|
147
|
+
end
|
|
148
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Define color codes
|
|
4
|
+
GREEN="\033[0;32m"
|
|
5
|
+
YELLOW="\033[0;33m"
|
|
6
|
+
RESET="\033[0m"
|
|
7
|
+
|
|
8
|
+
# Get the path to pubspec.yaml and the update type
|
|
9
|
+
PUBSPEC_PATH=$1
|
|
10
|
+
UPDATE_TYPE=$2
|
|
11
|
+
|
|
12
|
+
# Function to increment version parts
|
|
13
|
+
function bump_version() {
|
|
14
|
+
# Extract the line containing the version and build number
|
|
15
|
+
local version_line=$(grep 'version: ' "$PUBSPEC_PATH")
|
|
16
|
+
local version=$(echo "$version_line" | sed -E 's/version: ([0-9]+\.[0-9]+\.[0-9]+)\+[0-9]+/\1/')
|
|
17
|
+
local major=$(echo "$version" | cut -d. -f1)
|
|
18
|
+
local minor=$(echo "$version" | cut -d. -f2)
|
|
19
|
+
local patch=$(echo "$version" | cut -d. -f3)
|
|
20
|
+
local build_number=$(echo "$version_line" | sed -E 's/version: [0-9]+\.[0-9]+\.[0-9]+\+([0-9]+)/\1/')
|
|
21
|
+
|
|
22
|
+
# Increment the build number
|
|
23
|
+
local new_build_number=$((build_number + 1))
|
|
24
|
+
|
|
25
|
+
# Determine which part to update
|
|
26
|
+
case $UPDATE_TYPE in
|
|
27
|
+
major)
|
|
28
|
+
major=$((major + 1))
|
|
29
|
+
minor=0
|
|
30
|
+
patch=0
|
|
31
|
+
;;
|
|
32
|
+
minor)
|
|
33
|
+
minor=$((minor + 1))
|
|
34
|
+
patch=0
|
|
35
|
+
;;
|
|
36
|
+
patch)
|
|
37
|
+
patch=$((patch + 1))
|
|
38
|
+
;;
|
|
39
|
+
build)
|
|
40
|
+
# Only build number will be incremented
|
|
41
|
+
;;
|
|
42
|
+
*)
|
|
43
|
+
echo "Invalid update type: $UPDATE_TYPE"
|
|
44
|
+
echo "Please use 'major', 'minor', 'patch', or 'build'"
|
|
45
|
+
exit 1
|
|
46
|
+
;;
|
|
47
|
+
esac
|
|
48
|
+
|
|
49
|
+
# Form new version string
|
|
50
|
+
local new_version="$major.$minor.$patch+$new_build_number"
|
|
51
|
+
|
|
52
|
+
# Update the version in the pubspec.yaml
|
|
53
|
+
sed -i '' "s/$version_line/version: $new_version/" "$PUBSPEC_PATH"
|
|
54
|
+
|
|
55
|
+
# Print the old and new version
|
|
56
|
+
echo -e "\nfrom: ${YELLOW}$version+$build_number${RESET}"
|
|
57
|
+
echo -e "to: ${GREEN}$new_version${RESET}"
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
# Bump the version
|
|
61
|
+
bump_version
|
metadata
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: flutterfy-cli
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Cesar Ferreira
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2023-12-19 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Flutter CLI tool to increase development speed by automating common tasks
|
|
14
|
+
email:
|
|
15
|
+
- cesar.manuel.ferreira@gmail.com
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- ".rspec"
|
|
21
|
+
- ".rubocop.yml"
|
|
22
|
+
- ".ruby-gemset"
|
|
23
|
+
- ".tool-versions"
|
|
24
|
+
- Gemfile
|
|
25
|
+
- Gemfile.lock
|
|
26
|
+
- README.md
|
|
27
|
+
- Rakefile
|
|
28
|
+
- assets/ss.png
|
|
29
|
+
- lib/f/automation.rb
|
|
30
|
+
- lib/f/automation/libs/creators_lib.rb
|
|
31
|
+
- lib/f/automation/libs/utils_lib.rb
|
|
32
|
+
- lib/f/automation/version.rb
|
|
33
|
+
- lib/f/scripts/bump_version.sh
|
|
34
|
+
homepage: https://cesarferreira.com
|
|
35
|
+
licenses:
|
|
36
|
+
- MIT
|
|
37
|
+
metadata:
|
|
38
|
+
homepage_uri: https://cesarferreira.com
|
|
39
|
+
post_install_message:
|
|
40
|
+
rdoc_options: []
|
|
41
|
+
require_paths:
|
|
42
|
+
- lib
|
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
49
|
+
requirements:
|
|
50
|
+
- - ">="
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
version: '0'
|
|
53
|
+
requirements: []
|
|
54
|
+
rubygems_version: 3.4.10
|
|
55
|
+
signing_key:
|
|
56
|
+
specification_version: 4
|
|
57
|
+
summary: Flutter CLI tool to increase development speed
|
|
58
|
+
test_files: []
|