deployand 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ae5c7f246bb30e5b05780d65c043063869dafcffbec510561cb8dba1bce3e295
4
+ data.tar.gz: 65f85b671e9fb4a3e682db09a06d81ba072ef7223a53935510d7ec1bfbd5905f
5
+ SHA512:
6
+ metadata.gz: 83b266a9ed067f418b7a587de78137462bf162b23d3506cdfdaff20b142990331bba67b3ecee2e6d7c86b59b6b7cb64b99bf6ce312d5327931d10cfd87b51502
7
+ data.tar.gz: 30560a014680e2633cd26d93b3f65c99c5b96a390b75ff62d8375ab6ab4c0ad1032ccca4536e3e606f617d8427aedb370b1a820f74cdda80f0b04d457b8a1bde
@@ -0,0 +1,9 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(chmod:*)",
5
+ "Bash(deployand)"
6
+ ],
7
+ "deny": []
8
+ }
9
+ }
data/.gitignore ADDED
@@ -0,0 +1,71 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # Ruby artifacts
7
+ *.gem
8
+ *.rbc
9
+ /.config
10
+ /coverage/
11
+ /InstalledFiles
12
+ /pkg/
13
+ /spec/reports/
14
+ /spec/examples.txt
15
+ /test/tmp/
16
+ /test/version_tmp/
17
+ /tmp/
18
+
19
+ # Bundle artifacts
20
+ /.bundle/
21
+ /vendor/bundle
22
+ /lib/bundler/man/
23
+
24
+ # RDoc documentation
25
+ /.yardoc
26
+ /_yardoc/
27
+ /doc/
28
+ /rdoc/
29
+
30
+ # Environment variables
31
+ .env
32
+ .env.local
33
+ .env.*.local
34
+
35
+ # IDE files
36
+ .vscode/
37
+ .idea/
38
+ *.swp
39
+ *.swo
40
+ *~
41
+
42
+ # OS generated files
43
+ .DS_Store
44
+ .DS_Store?
45
+ ._*
46
+ .Spotlight-V100
47
+ .Trashes
48
+ ehthumbs.db
49
+ Thumbs.db
50
+
51
+ # Logs
52
+ *.log
53
+
54
+ # Runtime data
55
+ pids
56
+ *.pid
57
+ *.seed
58
+ *.pid.lock
59
+
60
+ # Coverage directory used by tools like istanbul
61
+ coverage
62
+ *.lcov
63
+
64
+ # Build outputs
65
+ /build/
66
+ /dist/
67
+ /out/
68
+
69
+ # Temporary files
70
+ *.tmp
71
+ *.temp
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in deployand.gemspec
6
+ gemspec
7
+
8
+ gem 'rake', '~> 13.0'
9
+ gem 'rspec', '~> 3.0'
10
+ gem 'rubocop', '~> 1.21'
data/README.md ADDED
@@ -0,0 +1,219 @@
1
+ # DeployAnd
2
+
3
+ 用于自动化 Google Play 商店应用部署、编译和发布流程的命令行工具。
4
+
5
+ ## 安装
6
+
7
+ ### 系统要求
8
+
9
+ - Ruby 2.7.0 或更高版本
10
+ - Bundler
11
+
12
+ ### 从 RubyGems 安装(即将推出)
13
+
14
+ ```bash
15
+ gem install deployand
16
+ ```
17
+
18
+ ### 从源码安装
19
+
20
+ ```bash
21
+ git clone https://github.com/deployand/deployand.git
22
+ cd deployand
23
+ bundle install
24
+ rake build
25
+ gem install pkg/deployand-*.gem
26
+ ```
27
+
28
+ ### 跨平台支持
29
+
30
+ DeployAnd 支持以下系统:
31
+ - macOS
32
+ - Linux
33
+ - Windows(需要安装 Ruby)
34
+
35
+ ## 快速开始
36
+
37
+ 1. 初始化新项目:
38
+ ```bash
39
+ deployand init MyApp
40
+ ```
41
+
42
+ 2. 在 `deployand.yml` 中配置应用设置
43
+
44
+ 3. 构建应用:
45
+ ```bash
46
+ deployand build
47
+ ```
48
+
49
+ 4. 发布到 Google Play 商店:
50
+ ```bash
51
+ deployand publish internal
52
+ ```
53
+
54
+ ## 命令
55
+
56
+ ### `deployand init [项目名称]`
57
+
58
+ 初始化一个新的 deployand 项目,并创建配置文件。
59
+
60
+ **选项:**
61
+ - `--template=模板` - 使用指定模板(android、flutter、react-native)
62
+ - `--force` - 覆盖现有配置文件
63
+
64
+ **示例:**
65
+ ```bash
66
+ deployand init MyApp
67
+ deployand init MyApp --template=flutter
68
+ deployand init MyApp --template=react-native --force
69
+ ```
70
+
71
+ ### `deployand iap [操作]`
72
+
73
+ 管理 Google Play 控制台中的应用内购买产品。
74
+
75
+ **操作:**
76
+ - `create` - 创建新的 IAP 产品
77
+ - `update` - 更新现有 IAP 产品
78
+ - `list` - 列出所有 IAP 产品
79
+ - `delete` - 删除 IAP 产品
80
+
81
+ **选项:**
82
+ - `--product-id=产品ID` - 指定产品 ID
83
+ - `--price=价格` - 设置产品价格
84
+ - `--title=标题` - 设置产品标题
85
+ - `--description=描述` - 设置产品描述
86
+ - `--sync` - 与远程 IAP 配置同步
87
+
88
+ **示例:**
89
+ ```bash
90
+ deployand iap list
91
+ deployand iap create --product-id=premium --price=9.99 --title="高级版本"
92
+ deployand iap update --product-id=premium --price=7.99
93
+ deployand iap delete --product-id=old_product
94
+ ```
95
+
96
+ ### `deployand build [构建类型]`
97
+
98
+ 构建并打包应用程序以用于 Google Play 商店部署。
99
+
100
+ **构建类型:**
101
+ - `release`(默认)- 发布模式构建
102
+ - `debug` - 调试模式构建
103
+
104
+ **选项:**
105
+ - `--clean` - 构建前清理构建产物
106
+ - `--sign` - 使用发布密钥库签名 APK/AAB(发布模式默认)
107
+ - `--output=路径` - 指定输出目录
108
+ - `--flavor=变体` - 构建指定变体
109
+ - `--arch=架构` - 目标架构(arm64-v8a、armeabi-v7a、x86_64)
110
+
111
+ **示例:**
112
+ ```bash
113
+ deployand build
114
+ deployand build release --clean
115
+ deployand build debug --flavor=development
116
+ deployand build --arch=arm64-v8a --output=./dist
117
+ ```
118
+
119
+ ### `deployand publish [发布轨道]`
120
+
121
+ 上传并发布应用程序到 Google Play 商店。
122
+
123
+ **发布轨道:**
124
+ - `internal`(默认)- 内部测试
125
+ - `alpha` - Alpha 测试
126
+ - `beta` - Beta 测试
127
+ - `production` - 正式发布
128
+
129
+ **选项:**
130
+ - `--apk=路径` - APK 文件路径
131
+ - `--aab=路径` - AAB 文件路径
132
+ - `--rollout=百分比` - 分阶段推出百分比(0-100)
133
+ - `--release-notes=说明` - 此版本的发布说明
134
+ - `--release-notes-file=文件` - 包含发布说明的文件
135
+ - `--skip-upload-apk` - 跳过 APK/AAB 上传(仅元数据)
136
+ - `--skip-upload-metadata` - 跳过元数据上传
137
+ - `--skip-upload-images` - 跳过截图和图片上传
138
+ - `--dry-run` - 验证但不实际发布
139
+
140
+ **示例:**
141
+ ```bash
142
+ deployand publish internal --aab=./build/app.aab
143
+ deployand publish beta --rollout=50 --release-notes="错误修复和改进"
144
+ deployand publish production --aab=./app-release.aab --release-notes-file=./CHANGELOG.md
145
+ deployand publish alpha --dry-run
146
+ ```
147
+
148
+ ## 配置
149
+
150
+ DeployAnd 在项目根目录使用 `deployand.yml` 配置文件:
151
+
152
+ ```yaml
153
+ app:
154
+ package_name: "com.example.myapp"
155
+ name: "我的应用"
156
+
157
+ google_play:
158
+ service_account_json: "./google-play-service-account.json"
159
+
160
+ build:
161
+ type: "android" # android, flutter, react-native
162
+ gradle_file: "./app/build.gradle"
163
+
164
+ signing:
165
+ keystore_path: "./keystore/release.keystore"
166
+ keystore_password: "${KEYSTORE_PASSWORD}"
167
+ key_alias: "release"
168
+ key_password: "${KEY_PASSWORD}"
169
+
170
+ metadata:
171
+ default_language: "zh-CN"
172
+ title: "我的精彩应用"
173
+ short_description: "适合每个人的优秀应用"
174
+ full_description: "这是一个全面的描述..."
175
+
176
+ tracks:
177
+ internal:
178
+ rollout_percentage: 100
179
+ beta:
180
+ rollout_percentage: 50
181
+ production:
182
+ rollout_percentage: 10
183
+ ```
184
+
185
+ ## 全局选项
186
+
187
+ 所有命令都支持以下全局选项:
188
+
189
+ - `--verbose` - 显示更多调试信息
190
+ - `--silent` - 除错误外不显示任何内容
191
+ - `--help` - 显示命令帮助
192
+
193
+ ## 开发
194
+
195
+ 克隆仓库后,运行:
196
+
197
+ ```bash
198
+ bundle install
199
+ ```
200
+
201
+ 运行测试:
202
+
203
+ ```bash
204
+ bundle exec rspec
205
+ ```
206
+
207
+ 构建 gem:
208
+
209
+ ```bash
210
+ rake build
211
+ ```
212
+
213
+ ## 贡献
214
+
215
+ 欢迎在 GitHub 上提交错误报告和拉取请求:https://github.com/deployand/deployand
216
+
217
+ ## 许可证
218
+
219
+ 该 gem 在 [MIT 许可证](https://opensource.org/licenses/MIT) 条款下作为开源软件提供。
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require 'rubocop/rake_task'
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
data/bin/deployand ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'rubygems'
5
+ require 'deployand'
6
+
7
+ begin
8
+ Deployand::Command.run(ARGV)
9
+ rescue Interrupt
10
+ puts "\n[!] Cancelled"
11
+ exit 130
12
+ end
data/deployand.gemspec ADDED
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/deployand/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'deployand'
7
+ spec.version = Deployand::VERSION
8
+ spec.authors = ['DeployAnd Team']
9
+ spec.email = ['team@deployand.com']
10
+
11
+ spec.summary = 'Automated Google Play Store deployment tool'
12
+ spec.description = 'A command-line tool for automating Google Play Store app submission, compilation, and publishing processes'
13
+ spec.homepage = 'https://github.com/deployand/deployand'
14
+ spec.license = 'MIT'
15
+ spec.required_ruby_version = '>= 2.7.0'
16
+
17
+ spec.metadata['homepage_uri'] = spec.homepage
18
+ spec.metadata['source_code_uri'] = 'https://github.com/deployand/deployand'
19
+ spec.metadata['changelog_uri'] = 'https://github.com/deployand/deployand/blob/main/CHANGELOG.md'
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
23
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
24
+ end
25
+ spec.bindir = 'bin'
26
+ spec.executables = spec.files.grep(%r{\Abin/}) { |f| File.basename(f) }
27
+ spec.require_paths = ['lib']
28
+
29
+ # Dependencies
30
+ spec.add_dependency 'claide', '~> 1.1'
31
+ spec.add_dependency 'colored2', '~> 3.1'
32
+
33
+ # Development dependencies
34
+ spec.add_development_dependency 'bundler', '~> 2.0'
35
+ spec.add_development_dependency 'rake', '~> 13.0'
36
+ spec.add_development_dependency 'rspec', '~> 3.0'
37
+ spec.add_development_dependency 'rubocop', '~> 1.0'
38
+ end
@@ -0,0 +1,168 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Deployand
4
+ class Command
5
+ class Build < Command
6
+ self.summary = 'Build app for Google Play Store'
7
+ self.description = <<-DESC
8
+ Build and package your application for Google Play Store deployment.
9
+ Supports Android, Flutter, and React Native projects with automatic
10
+ signing and optimization.
11
+ DESC
12
+
13
+ self.arguments = [
14
+ CLAide::Argument.new('BUILD_TYPE', false)
15
+ ]
16
+
17
+ def self.options
18
+ [
19
+ ['--release', 'Build in release mode (default)'],
20
+ ['--debug', 'Build in debug mode'],
21
+ ['--clean', 'Clean build artifacts before building'],
22
+ ['--sign', 'Sign the APK/AAB with release keystore'],
23
+ ['--output=PATH', 'Specify output directory'],
24
+ ['--flavor=FLAVOR', 'Build specific flavor/variant'],
25
+ ['--arch=ARCH', 'Target architecture (arm64-v8a, armeabi-v7a, x86_64)']
26
+ ].concat(super)
27
+ end
28
+
29
+ def initialize(argv)
30
+ @build_type = argv.shift_argument || 'release'
31
+ @release = argv.flag?('release', true)
32
+ @debug = argv.flag?('debug')
33
+ @clean = argv.flag?('clean')
34
+ @sign = argv.flag?('sign', true)
35
+ @output = argv.option('output')
36
+ @flavor = argv.option('flavor')
37
+ @arch = argv.option('arch')
38
+ super
39
+ end
40
+
41
+ def validate!
42
+ super
43
+
44
+ valid_build_types = %w[release debug]
45
+ unless valid_build_types.include?(@build_type)
46
+ help! "Invalid build type '#{@build_type}'. Valid types: #{valid_build_types.join(', ')}"
47
+ end
48
+
49
+ @release = false if @debug
50
+ end
51
+
52
+ def run
53
+ print_info "Starting build process..."
54
+ print_info "Build type: #{@build_type}"
55
+ print_info "Flavor: #{@flavor}" if @flavor
56
+ print_info "Architecture: #{@arch}" if @arch
57
+
58
+ clean_build if @clean
59
+ detect_project_type
60
+ build_project
61
+ sign_build if @sign && @release
62
+ optimize_build if @release
63
+
64
+ print_success "Build completed successfully!"
65
+ print_info "Output location: #{build_output_path}"
66
+ end
67
+
68
+ private
69
+
70
+ def clean_build
71
+ print_info "Cleaning build artifacts..."
72
+
73
+ # TODO: Implement clean build logic
74
+ # - Remove build directories
75
+ # - Clear gradle cache
76
+ # - Clean Flutter/React Native build artifacts
77
+
78
+ print_verbose "Build artifacts cleaned"
79
+ end
80
+
81
+ def detect_project_type
82
+ print_verbose "Detecting project type..."
83
+
84
+ # TODO: Implement project type detection
85
+ # - Check for build.gradle (Android)
86
+ # - Check for pubspec.yaml (Flutter)
87
+ # - Check for package.json with react-native (React Native)
88
+
89
+ @project_type = 'android' # Default for now
90
+ print_verbose "Detected project type: #{@project_type}"
91
+ end
92
+
93
+ def build_project
94
+ print_info "Building #{@project_type} project..."
95
+
96
+ case @project_type
97
+ when 'android'
98
+ build_android_project
99
+ when 'flutter'
100
+ build_flutter_project
101
+ when 'react-native'
102
+ build_react_native_project
103
+ else
104
+ raise Error, "Unsupported project type: #{@project_type}"
105
+ end
106
+ end
107
+
108
+ def build_android_project
109
+ print_verbose "Building Android project with Gradle..."
110
+
111
+ # TODO: Implement Android build logic
112
+ # - Run gradle build commands
113
+ # - Handle different build variants
114
+ # - Generate APK/AAB files
115
+
116
+ print_verbose "Android build completed"
117
+ end
118
+
119
+ def build_flutter_project
120
+ print_verbose "Building Flutter project..."
121
+
122
+ # TODO: Implement Flutter build logic
123
+ # - Run flutter build apk/appbundle
124
+ # - Handle different flavors
125
+ # - Optimize for release builds
126
+
127
+ print_verbose "Flutter build completed"
128
+ end
129
+
130
+ def build_react_native_project
131
+ print_verbose "Building React Native project..."
132
+
133
+ # TODO: Implement React Native build logic
134
+ # - Run react-native build commands
135
+ # - Handle Metro bundler
136
+ # - Generate APK files
137
+
138
+ print_verbose "React Native build completed"
139
+ end
140
+
141
+ def sign_build
142
+ print_info "Signing build artifacts..."
143
+
144
+ # TODO: Implement build signing logic
145
+ # - Load keystore configuration
146
+ # - Sign APK/AAB files
147
+ # - Verify signatures
148
+
149
+ print_verbose "Build artifacts signed successfully"
150
+ end
151
+
152
+ def optimize_build
153
+ print_info "Optimizing build for release..."
154
+
155
+ # TODO: Implement build optimization
156
+ # - ProGuard/R8 optimization
157
+ # - Resource shrinking
158
+ # - APK alignment
159
+
160
+ print_verbose "Build optimization completed"
161
+ end
162
+
163
+ def build_output_path
164
+ @output || './build/outputs'
165
+ end
166
+ end
167
+ end
168
+ end
@@ -0,0 +1,103 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Deployand
4
+ class Command
5
+ class Iap < Command
6
+ self.summary = 'Manage In-App Purchase products'
7
+ self.description = <<-DESC
8
+ Manage In-App Purchase products on Google Play Console.
9
+ Create, update, and synchronize IAP products with your app.
10
+ DESC
11
+
12
+ self.arguments = [
13
+ CLAide::Argument.new('ACTION', false)
14
+ ]
15
+
16
+ def self.options
17
+ [
18
+ ['--product-id=PRODUCT_ID', 'Specify a product ID'],
19
+ ['--price=PRICE', 'Set product price'],
20
+ ['--title=TITLE', 'Set product title'],
21
+ ['--description=DESCRIPTION', 'Set product description'],
22
+ ['--sync', 'Sync with remote IAP configuration']
23
+ ].concat(super)
24
+ end
25
+
26
+ def initialize(argv)
27
+ @action = argv.shift_argument
28
+ @product_id = argv.option('product-id')
29
+ @price = argv.option('price')
30
+ @title = argv.option('title')
31
+ @description = argv.option('description')
32
+ @sync = argv.flag?('sync')
33
+ super
34
+ end
35
+
36
+ def validate!
37
+ super
38
+ help! 'An action is required (create, update, list, delete).' unless @action
39
+
40
+ valid_actions = %w[create update list delete]
41
+ help! "Invalid action '#{@action}'. Valid actions: #{valid_actions.join(', ')}" unless valid_actions.include?(@action)
42
+ end
43
+
44
+ def run
45
+ case @action
46
+ when 'create'
47
+ create_iap_product
48
+ when 'update'
49
+ update_iap_product
50
+ when 'list'
51
+ list_iap_products
52
+ when 'delete'
53
+ delete_iap_product
54
+ end
55
+ end
56
+
57
+ private
58
+
59
+ def create_iap_product
60
+ print_info "Creating IAP product: #{@product_id}"
61
+
62
+ # TODO: Implement IAP product creation logic
63
+ # - Validate product configuration
64
+ # - Create product on Google Play Console
65
+ # - Update local configuration
66
+
67
+ print_success "IAP product #{@product_id} created successfully!"
68
+ end
69
+
70
+ def update_iap_product
71
+ print_info "Updating IAP product: #{@product_id}"
72
+
73
+ # TODO: Implement IAP product update logic
74
+ # - Fetch existing product configuration
75
+ # - Apply updates
76
+ # - Sync with Google Play Console
77
+
78
+ print_success "IAP product #{@product_id} updated successfully!"
79
+ end
80
+
81
+ def list_iap_products
82
+ print_info "Listing IAP products..."
83
+
84
+ # TODO: Implement IAP products listing logic
85
+ # - Fetch products from Google Play Console
86
+ # - Display in formatted table
87
+
88
+ print_success "IAP products listed successfully!"
89
+ end
90
+
91
+ def delete_iap_product
92
+ print_warning "Deleting IAP product: #{@product_id}"
93
+
94
+ # TODO: Implement IAP product deletion logic
95
+ # - Confirm deletion with user
96
+ # - Remove from Google Play Console
97
+ # - Update local configuration
98
+
99
+ print_success "IAP product #{@product_id} deleted successfully!"
100
+ end
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Deployand
4
+ class Command
5
+ class Init < Command
6
+ self.summary = 'Initialize a new deployand project'
7
+ self.description = <<-DESC
8
+ Creates a new deployand configuration file and sets up the project
9
+ structure for Google Play Store deployment automation.
10
+ DESC
11
+
12
+ self.arguments = [
13
+ CLAide::Argument.new('PROJECT_NAME', false)
14
+ ]
15
+
16
+ def self.options
17
+ [
18
+ ['--template=TEMPLATE', 'Use a specific template (android, flutter, react-native)'],
19
+ ['--force', 'Overwrite existing configuration files']
20
+ ].concat(super)
21
+ end
22
+
23
+ def initialize(argv)
24
+ @project_name = argv.shift_argument
25
+ @template = argv.option('template', 'android')
26
+ @force = argv.flag?('force')
27
+ super
28
+ end
29
+
30
+ def validate!
31
+ super
32
+ help! 'A project name is required.' unless @project_name
33
+ end
34
+
35
+ def run
36
+ print_info "Initializing deployand project: #{@project_name}"
37
+ print_info "Using template: #{@template}"
38
+
39
+ # TODO: Implement project initialization logic
40
+ # - Create deployand.yml configuration file
41
+ # - Set up directory structure
42
+ # - Generate template files based on project type
43
+
44
+ print_success "Project #{@project_name} initialized successfully!"
45
+ print_info "Next steps:"
46
+ print_info " 1. Configure your Google Play Console credentials"
47
+ print_info " 2. Update deployand.yml with your app details"
48
+ print_info " 3. Run 'deployand build' to build your app"
49
+ end
50
+ end
51
+ end
52
+ end