验证中...
Languages: Ruby
Categories: iOS 组件
Latest update 2018-12-09 10:01
fastlane自定义action文件格式
Raw Copy
module Fastlane
module Actions
module SharedValues
REMOVE_TAG_CUSTOM_VALUE = :REMOVE_TAG_CUSTOM_VALUE
end
class RemoveTagAction < Action
def self.run(params)
#写具体操作
end
#####################################################
# @!group Documentation 文档
#####################################################
#描述
def self.description
"remove tag"
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 remove tag"
end
#参数定义
def self.available_options
# Define all options your action supports.
# Below a few examples
[
FastlaneCore::ConfigItem.new(key: :tag,
env_name: "FL_GIT_TAG_NAME",
description: "需要删除的tag名称",
is_string: true,
optional: false),
FastlaneCore::ConfigItem.new(key: :rl,
env_name: "FL_GIT_IS_REMOVE_LOCAL_TAG",
description: "是否需要删除本地tag",
optional: true,
is_string: false,
default_value: true),
FastlaneCore::ConfigItem.new(key: :rr,
env_name: "FL_GIT_IS_REMOVE_REMOTE_TAG",
description: "是否需要删除远程仓库tag",
optional: true,
is_string: false,
default_value: true)
]
end
#例子
def self.output
# Define the shared values you are going to provide
# Example
[
['REMOVE_TAG_CUSTOM_VALUE', 'A description of what this value contains']
]
end
#返回值
def self.return_value
nil
end
#作者
def self.authors
# So no one will ever forget your contribution to fastlane :) You are awesome btw!
["hexiaoba"]
end
#支持平台
def self.is_supported?(platform)
# you can do things like
#
# true
#
# platform == :ios
#
# [:ios, :mac].include?(platform)
#
platform == :ios
end
end
end
end
remove_tag.rb
Raw Copy
module Fastlane
module Actions
module SharedValues
REMOVE_TAG_CUSTOM_VALUE = :REMOVE_TAG_CUSTOM_VALUE
end
class RemoveTagAction < Action
def self.run(params)
tagName = params[:tag]
isRemoveLocalTag = params[:rl]
isRemoveRemoteTag = params[:rr]
# 1. 先定义一个数组,用来存储所有需要执行的命令
cmds = []
# 2、往数组中添加命令
if isRemoveLocalTag
cmds << "git tag -d #{tagName} "
end
if isRemoveRemoteTag
cmds << " git push origin :#{tagName}"
end
# 3、执行命令
Actions.sh(cmds.join('&'));
end
#####################################################
# @!group Documentation
#####################################################
def self.description
"remove tag"
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 remove tag"
end
def self.available_options
# Define all options your action supports.
# Below a few examples
[
FastlaneCore::ConfigItem.new(key: :tag,
env_name: "FL_GIT_TAG_NAME",
description: "需要删除的tag名称",
is_string: true,
optional: false),
FastlaneCore::ConfigItem.new(key: :rl,
env_name: "FL_GIT_IS_REMOVE_LOCAL_TAG",
description: "是否需要删除本地tag",
optional: true,
is_string: false,
default_value: true),
FastlaneCore::ConfigItem.new(key: :rr,
env_name: "FL_GIT_IS_REMOVE_REMOTE_TAG",
description: "是否需要删除远程仓库tag",
optional: true,
is_string: false,
default_value: true)
]
end
def self.output
# Define the shared values you are going to provide
# Example
[
['REMOVE_TAG_CUSTOM_VALUE', 'A description of what this value contains']
]
end
def self.return_value
nil
end
def self.authors
# So no one will ever forget your contribution to fastlane :) You are awesome btw!
["hexiaoba"]
end
def self.is_supported?(platform)
# you can do things like
#
# true
#
# platform == :ios
#
# [:ios, :mac].include?(platform)
#
platform == :ios
end
end
end
end

Comment list( 0 )

You need to Sign in for post a comment

Help Search

183227_9af5e6a8_1826025 111910_4d91f001_1826025