mirror of
https://github.com/zhigang1992/fir-cli.git
synced 2026-04-28 17:44:55 +08:00
rename
This commit is contained in:
@@ -10,16 +10,18 @@ module FIR
|
||||
|
||||
desc "build_ipa", "Build iOS application (alias: 'b')."
|
||||
long_desc "You use `man xcodebuild` to get more information"
|
||||
map "b" => :build_ipa
|
||||
map "b bi build" => :build_ipa
|
||||
method_option :workspace, type: :boolean, aliases: "-w", desc: "Build the workspace specified by workspacename"
|
||||
method_option :scheme, type: :string, aliases: "-s", desc: "Build the scheme NAME"
|
||||
method_option :configuration, type: :string, aliases: "-C", desc: "Use the build configuration NAME for building each target"
|
||||
method_option :output, type: :string, aliases: "-o", desc: "IPA output path"
|
||||
method_option :publish, type: :boolean, aliases: "-p", desc: "Set true/false if publish to FIR.im"
|
||||
method_option :short, type: :string, aliases: "-s", desc: "Set custom short link if publish to FIR.im"
|
||||
method_option :changelog, type: :string, aliases: "-c", desc: "Set changelog if publish to FIR.im"
|
||||
def build_ipa *args
|
||||
prepare :build_ipa
|
||||
|
||||
FIR.build_ipa(args, options)
|
||||
FIR.build(args, options)
|
||||
end
|
||||
|
||||
desc "info APP_FILE_PATH", "Show iOS/Android application's information, support ipa/apk file (aliases: 'i')."
|
||||
@@ -28,17 +30,17 @@ module FIR
|
||||
def info *args
|
||||
prepare :info
|
||||
|
||||
FIR.app_info(args, options)
|
||||
FIR.info(args, options)
|
||||
end
|
||||
|
||||
desc "publish APP_FILE_PATH", "Publish iOS/Android application to FIR.im, support ipa/apk file (aliases: 'p')."
|
||||
map "p" => :publish
|
||||
method_option :short, type: :string, aliases: "-s", desc: "Custom short link"
|
||||
method_option :changelog, type: :string, aliases: "-c", desc: "Changelog (default: '')", default: ""
|
||||
method_option :short, type: :string, aliases: "-s", desc: "Set custom short link"
|
||||
method_option :changelog, type: :string, aliases: "-c", desc: "Set changelog"
|
||||
def publish *args
|
||||
prepare :publish
|
||||
|
||||
FIR.publish_app(args, options)
|
||||
FIR.publish(args, options)
|
||||
end
|
||||
|
||||
desc "login", "Login FIR.im (aliases: 'l')."
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
|
||||
require_relative './util/app_info'
|
||||
require_relative './util/build_ipa'
|
||||
require_relative './util/build'
|
||||
require_relative './util/publish_app'
|
||||
|
||||
module FIR
|
||||
@@ -9,9 +9,9 @@ module FIR
|
||||
|
||||
def self.included base
|
||||
base.extend ClassMethods
|
||||
base.extend AppInfo
|
||||
base.extend BuildIPA
|
||||
base.extend PublishApp
|
||||
base.extend Info
|
||||
base.extend Build
|
||||
base.extend Publish
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
|
||||
33
lib/fir/util/build.rb
Normal file
33
lib/fir/util/build.rb
Normal file
@@ -0,0 +1,33 @@
|
||||
# encoding: utf-8
|
||||
|
||||
module FIR
|
||||
module Build
|
||||
|
||||
def build args, options
|
||||
check_osx
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def check_osx
|
||||
unless OS.mac?
|
||||
logger.info "Unsupported OS type"
|
||||
end
|
||||
end
|
||||
|
||||
def zip_app2ipa app_path, ipa_path
|
||||
Dir.mktmpdir do |tmpdir|
|
||||
Dir.chdir(tmpdir) do
|
||||
Dir.mkdir "Payload"
|
||||
FileUtils.cp_r app_path, 'Payload'
|
||||
system("rm -rf #{ipa_path}") if File.file? ipa_path
|
||||
_puts "> 正在打包 app: #{File.basename app_path} 到 #{ipa_path}"
|
||||
_exec "zip -qr #{ipa_path} Payload"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,19 +0,0 @@
|
||||
# encoding: utf-8
|
||||
|
||||
module FIR
|
||||
module BuildIPA
|
||||
|
||||
def build_ipa args, options
|
||||
check_osx
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def check_osx
|
||||
unless OS.mac?
|
||||
logger.info "Unsupported OS type"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,9 +1,9 @@
|
||||
# encoding: utf-8
|
||||
|
||||
module FIR
|
||||
module AppInfo
|
||||
module Info
|
||||
|
||||
def app_info args, options
|
||||
def info args, options
|
||||
file_path = args.first
|
||||
is_all = !!options[:all]
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
# encoding: utf-8
|
||||
|
||||
module FIR
|
||||
module PublishApp
|
||||
module Publish
|
||||
|
||||
def publish_app args, options
|
||||
def publish args, options
|
||||
file_path = args.first
|
||||
token = options[:token] || current_token
|
||||
changelog = options[:changelog].to_s
|
||||
|
||||
check_supported_file file_path
|
||||
check_token_cannot_be_blank token
|
||||
@@ -38,7 +39,7 @@ module FIR
|
||||
versionShort: app_info[:short_version],
|
||||
devices: app_info[:devices],
|
||||
release_type: app_info[:release_type],
|
||||
changelog: options[:changelog],
|
||||
changelog: changelog,
|
||||
token: token)
|
||||
published_app_info = fetch_app_info(app_id, token)
|
||||
|
||||
Reference in New Issue
Block a user