Commit 8005b52a authored by Thierry's avatar Thierry

增加action支持

parent 4d11bc2e
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
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
......@@ -3,24 +3,22 @@
<testsuite name="fastlane.lanes">
<testcase classname="fastlane.lanes" name="0: Verifying required fastlane version" time="0.000417">
<testcase classname="fastlane.lanes" name="0: Verifying required fastlane version" time="0.000473">
</testcase>
<testcase classname="fastlane.lanes" name="1: default_platform" time="0.00029">
<testcase classname="fastlane.lanes" name="1: default_platform" time="0.000312">
</testcase>
<testcase classname="fastlane.lanes" name="2: ensure_git_branch" time="0.006278">
<testcase classname="fastlane.lanes" name="2: ensure_git_branch" time="0.006711">
</testcase>
<testcase classname="fastlane.lanes" name="3: ensure_git_status_clean" time="0.007946">
<failure message="/Users/Thierry/.rvm/gems/ruby-2.1.1@global/gems/fastlane-1.64.0/lib/fastlane/actions/actions_helper.rb:33:in `execute_action'&#10;/Users/Thierry/.rvm/gems/ruby-2.1.1@global/gems/fastlane-1.64.0/lib/fastlane/runner.rb:129:in `block in execute_action'&#10;/Users/Thierry/.rvm/gems/ruby-2.1.1@global/gems/fastlane-1.64.0/lib/fastlane/runner.rb:128:in `chdir'&#10;/Users/Thierry/.rvm/gems/ruby-2.1.1@global/gems/fastlane-1.64.0/lib/fastlane/runner.rb:128:in `execute_action'&#10;/Users/Thierry/.rvm/gems/ruby-2.1.1@global/gems/fastlane-1.64.0/lib/fastlane/fast_file.rb:149:in `method_missing'&#10;Fastfile:38:in `block (2 levels) in parsing_binding'&#10;/Users/Thierry/.rvm/gems/ruby-2.1.1@global/gems/fastlane-1.64.0/lib/fastlane/lane.rb:36:in `call'&#10;/Users/Thierry/.rvm/gems/ruby-2.1.1@global/gems/fastlane-1.64.0/lib/fastlane/lane.rb:36:in `call'&#10;/Users/Thierry/.rvm/gems/ruby-2.1.1@global/gems/fastlane-1.64.0/lib/fastlane/runner.rb:52:in `block in execute'&#10;/Users/Thierry/.rvm/gems/ruby-2.1.1@global/gems/fastlane-1.64.0/lib/fastlane/runner.rb:46:in `chdir'&#10;/Users/Thierry/.rvm/gems/ruby-2.1.1@global/gems/fastlane-1.64.0/lib/fastlane/runner.rb:46:in `execute'&#10;/Users/Thierry/.rvm/gems/ruby-2.1.1@global/gems/fastlane-1.64.0/lib/fastlane/lane_manager.rb:46:in `cruise_lane'&#10;/Users/Thierry/.rvm/gems/ruby-2.1.1@global/gems/fastlane-1.64.0/lib/fastlane/command_line_handler.rb:30:in `handle'&#10;/Users/Thierry/.rvm/gems/ruby-2.1.1@global/gems/fastlane-1.64.0/bin/fastlane:38:in `block (2 levels) in run'&#10;/Users/Thierry/.rvm/gems/ruby-2.1.1@global/gems/commander-4.3.5/lib/commander/command.rb:178:in `call'&#10;/Users/Thierry/.rvm/gems/ruby-2.1.1@global/gems/commander-4.3.5/lib/commander/command.rb:178:in `call'&#10;/Users/Thierry/.rvm/gems/ruby-2.1.1@global/gems/commander-4.3.5/lib/commander/command.rb:153:in `run'&#10;/Users/Thierry/.rvm/gems/ruby-2.1.1@global/gems/commander-4.3.5/lib/commander/runner.rb:428:in `run_active_command'&#10;/Users/Thierry/.rvm/gems/ruby-2.1.1@global/gems/fastlane_core-0.37.0/lib/fastlane_core/ui/fastlane_runner.rb:23:in `run!'&#10;/Users/Thierry/.rvm/gems/ruby-2.1.1@global/gems/commander-4.3.5/lib/commander/delegates.rb:15:in `run!'&#10;/Users/Thierry/.rvm/gems/ruby-2.1.1@global/gems/fastlane-1.64.0/bin/fastlane:156:in `run'&#10;/Users/Thierry/.rvm/gems/ruby-2.1.1@global/gems/fastlane-1.64.0/bin/fastlane:162:in `&lt;top (required)&gt;'&#10;/Users/Thierry/.rvm/gems/ruby-2.1.1/bin/fastlane:23:in `load'&#10;/Users/Thierry/.rvm/gems/ruby-2.1.1/bin/fastlane:23:in `&lt;main&gt;'&#10;/Users/Thierry/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'&#10;/Users/Thierry/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `&lt;main&gt;'&#10;&#10;[31mGit repository is dirty! Please ensure the repo is in a clean state by commiting/stashing/discarding all changes first.[0m" />
<testcase classname="fastlane.lanes" name="3: ensure_git_status_clean" time="0.008395">
</testcase>
......
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