Commit 2606eb8c authored by jinzhu's avatar jinzhu

add action

parent a8d0513c
...@@ -32,4 +32,4 @@ Carthage ...@@ -32,4 +32,4 @@ Carthage
# `pod install` in .travis.yml # `pod install` in .travis.yml
# #
Pods/ Pods/
fastlane/* #fastlane/*
module Fastlane
module Actions
class GetAppVersionAction < Action
def self.run(params)
command = []
command << "/usr/libexec/PlistBuddy"
command << "-c"
command << "'Print :CFBundleShortVersionString'"
command << "./Gengmei/Info.plist"
result = Actions.sh(command.join(' '))
return result
end
def self.description
"得到更美App版本号。"
end
def self.return_value
"当前app版本"
end
def self.authors
["汪洋"]
end
def self.is_supported?(platform)
platform == :ios
end
end
end
end
module Fastlane
module Actions
class GitCommitAllAction < Action
def self.run(params)
Actions.sh "git commit -am \"#{params[:message]}\""
end
#####################################################
# @!group Documentation
#####################################################
def self.description
"Commit all unsaved changes to git."
end
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :message,
env_name: "FL_GIT_COMMIT_ALL",
description: "The git message for the commit",
is_string: true)
]
end
def self.authors
# So no one will ever forget your contribution to fastlane :) You are awesome btw!
["thierry"]
end
def self.is_supported?(platform)
true
end
end
end
end
module Fastlane
module Actions
class PodInstallAction < Action
def self.run(params)
Actions.sh "cd Example && pod install"
Helper.log.info "Successfully pod install ⬆️ ".green
end
#####################################################
# @!group Documentation
#####################################################
def self.description
"Update all pods"
end
def self.details
"Update all pods"
end
def self.authors
["thierry"]
end
def self.is_supported?(platform)
true
end
end
end
end
module Fastlane
module Actions
# Updates the local clone of the spec-repo
class PodRepoUpdateAction < Action
def self.run(params)
cmd = []
repo = params[:repo]
result = Actions.sh("pod repo update #{repo}")
UI.success("Successfully pod repo update 💾.")
return result
end
#####################################################
# @!group Documentation
#####################################################
def self.description
"Updates the local clone of the spec-repo `NAME`. If `NAME` is omitted this will update all spec-repos in `~/.cocoapods/repos`."
end
def self.details
# Optional:
# this is your chance to provide a more detailed description of this action
"You can use this action to do cool things..."
end
def self.available_options
# Define all options your action supports.
[
FastlaneCore::ConfigItem.new(key: :repo,
description: "Repo",
is_string: false,
verify_block: proc do |value|
end),
]
end
def self.output
# Define the shared values you are going to provide
# Example
[
['POD_REPO_UPDATE_CUSTOM_VALUE', 'A description of what this value contains']
]
end
def self.return_value
# If you method provides a return value, you can describe here what it does
end
def self.authors
# So no one will ever forget your contribution to fastlane :) You are awesome btw!
["thierryxing"]
end
def self.is_supported?(platform)
platform == :ios
end
end
end
end
module Fastlane
module Actions
module SharedValues
BUILD_NUMBER = :BUILD_NUMBER
end
class SyncBuildNumberToGitAction < Action
def self.is_git?
Actions.sh 'git rev-parse HEAD'
return true
rescue
return false
end
def self.run(params)
if is_git?
command = 'git rev-list HEAD --count'
else
raise "Not in a git repository."
end
build_number = (Actions.sh command).strip
Fastlane::Actions::IncrementBuildNumberAction.run(build_number: build_number)
Actions.lane_context[SharedValues::BUILD_NUMBER] = build_number
end
def self.output
[
['BUILD_NUMBER', 'The new build number']
]
end
#####################################################
# @!group Documentation
#####################################################
def self.description
"Set the build version of your project to the same number of your total git commit count"
end
def self.authors
["thierry"]
end
def self.is_supported?(platform)
[:ios].include? platform
end
end
end
end
module Fastlane
module Actions
class UpdateBuildNumberAction < Action
#/usr/libexec/PlistBuddy -c "Set :CFBundleVersion 201605141556" GengmeiDoctor/Info.plist
def self.run(params)
command = []
command << "/usr/libexec/PlistBuddy"
command << "-c"
command << "\"Set :CFBundleVersion #{Time.now.strftime("%Y%m%d%H%M")}\""
command << "./Gengmei/Info.plist"
result = Actions.sh(command.join(' '))
UI.success("Update Build Number Successfully ⬆️ ")
return result
end
def self.description
"更新iOS app build号为最新"
end
def self.authors
["汪洋"]
end
def self.is_supported?(platform)
platform == :ios
end
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment