Commit 9763dafa authored by gm's avatar gm

Merge branch 'master' of git.wanmeizhensuo.com:gengmeiios/GMPhobos

parents 5f99a1bc d0bd4610
module Fastlane
module Actions
module SharedValues
ANDROID_MONKEY_CUSTOM_VALUE = :ANDROID_MONKEY_CUSTOM_VALUE
end
#adb shell monkey -p com.wanmeizhensuo.zhensuo --ignore-security-exceptions --ignore-crashes --ignore-timeouts --monitor-native-crashes --throttle 300 --pct-touch 94 --pct-motion 6 -s 1000 -v -v -v 6000
class AndroidMonkeyAction < Action
def self.run(params)
package_name = params[:package_name]
count = params[:count]
seed = params[:seed]
command = ['adb shell monkey']
command << "-p #{package_name}"
command << '--ignore-security-exceptions'
command << '--ignore-crashes'
command << '--ignore-timeouts'
command << '--monitor-native-crashes'
command << '--monitor-native-crashes'
command << "--throttle 500"
command << "--pct-touch 94"
command << "--pct-motion 6"
command << "-s #{seed}"
command << "-v -v -v"
command << "#{count}"
Action.sh command.join(' ')
end
#####################################################
# @!group Documentation
#####################################################
def self.description
"Android Monkey Test"
end
def self.details
"Android Monkey Test"
end
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :package_name,
description: "Android App Package Name"),
FastlaneCore::ConfigItem.new(key: :count,
description: "Event count"),
FastlaneCore::ConfigItem.new(key: :seed,
description: "Seed count")
]
end
def self.output
# Define the shared values you are going to provide
# Example
[
['ANDROID_MONKEY_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 == :android
end
end
end
end
module Fastlane
module Actions
class AppiumExecuteTestcaseAction < Action
def self.run(params)
# fastlane will take care of reading in the parameter and fetching the environment variable:
# appium --session-override --default-capabilities '{"noReset":true}'
# . /Users/Thierry/Code/Python/env/bin/activate
# python -m unittest discover -s /Users/Thierry/Code/Python/saturn/ios/wiki -p "test_*.py"
# sh "shellcommand ./path"
Action.sh ". #{params[:python_env_path]}"
Dir.chdir(params[:python_testcase_path]) do
command = ['python']
command << '-m unittest'
command << "discover -s #{params[:script_path]}"
command << "-p '#{params[:file_name]}'"
Actions.sh command.join(' ')
end
end
#####################################################
# @!group Documentation
#####################################################
def self.description
"A short description with <= 80 characters of what this action does"
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.
# Below a few examples
[
FastlaneCore::ConfigItem.new(key: :python_env_path,
description: "Python virtual env folder path",
is_string: true
),
FastlaneCore::ConfigItem.new(key: :script_path,
description: "Python script path",
is_string: true
),
FastlaneCore::ConfigItem.new(key: :python_testcase_path,
description: "Python testcase project path",
is_string: true
),
FastlaneCore::ConfigItem.new(key: :file_name,
description: "Python testcase file name",
is_string: true
)
]
end
def self.output
# Define the shared values you are going to provide
# Example
[
['APPIUM_EXECUTE_TESTCASE_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!
["Your GitHub/Twitter Name"]
end
def self.is_supported?(platform)
# you can do things like
#
# true
#
# platform == :ios
#
# [:ios, :mac].include?(platform)
#
platform == :ios
end
end
end
end
require "java-properties"
module Fastlane
module Actions
class CreateLocalPropertiesAction < Action
def self.run(params)
properties = {}
properties['sdk.dir'] = ENV["JG_ANDROID_SDK_DIR"]
properties[:user] = params[:user]
properties[:password] = params[:password]
UI.message("sdk.dir:#{properties['sdk.dir']}")
JavaProperties.write(properties, "local.properties")
end
def self.description
"Create a local.properties file , and write into android sdk path and maven access account"
end
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :user,
description: "maven username",
is_string: true),
FastlaneCore::ConfigItem.new(key: :password,
description: "maven password",
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
GET_DEBUG_APP_PATH_CUSTOM_VALUE = :GET_DEBUG_APP_PATH_CUSTOM_VALUE
end
# To share this integration with the other fastlane users:
# - Fork https://github.com/fastlane/fastlane/tree/master/fastlane
# - Clone the forked repository
# - Move this integration into lib/fastlane/actions
# - Commit, push and submit the pull request
class GetDebugAppPathAction < Action
def self.run(params)
# fastlane will take care of reading in the parameter and fetching the environment variable:
project = params[:project]
scheme = params[:scheme]
ios_sdk = params[:ios_sdk]
command = ['xcodebuild']
command << '-workspace'
command << "#{project}.xcworkspace"
command << '-scheme'
command << "#{scheme}"
command << '-sdk'
command << ios_sdk
command << '-arch'
command << "x86_64"
command << '-configuration UnitTest -showBuildSettings | grep CONFIGURATION_BUILD_DIR'
output_result = Actions.sh command.join(' ')
configure = output_result.match(/CONFIGURATION_BUILD_DIR = (.*)/i).captures
File.join(configure[0],"#{scheme}.app")
end
#####################################################
# @!group Documentation
#####################################################
def self.description
# like: /Users/Thierry/Library/Developer/Xcode/DerivedData/Gengmei-fwlefrcslagvocbtnylgubtdgofr/Build/Products/Debug-iphonesimulator/Gengmei.app
"Get Xcode build app path of simlulator's debug enviroment"
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: :project,
description: "project name",
is_string: true),
FastlaneCore::ConfigItem.new(key: :scheme,
description: "scheme name",
is_string: true),
FastlaneCore::ConfigItem.new(key: :ios_sdk,
description: ":ios sdk",
is_string: true)
]
end
def self.output
end
def self.return_value
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
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 GitCommitAllAction < Action
def self.run(params)
Actions.sh "git commit -am \"#{params[:message]}\""
end
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 GitPushAction < Action
def self.run(params)
cmd = "git push"
if params[:branch]
cmd << " origin #{params[:branch]}"
end
result = Actions.sh(cmd.to_s)
UI.success("Successfully pushed 💾.")
return result
end
def self.description
"Directly commit the given file with the given message"
end
def self.details
""
end
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :branch,
description: "The branch you want to push",
is_string: false,
verify_block: proc do |value|
end),
]
end
def self.output
end
def self.return_value
nil
end
def self.authors
["thierryxing"]
end
def self.is_supported?(platform)
true
end
end
end
end
module Fastlane
module Actions
class InstallAppOnSimulatorAction < Action
def self.run(params)
device_type = params[:device_type]
app_path = params[:app_path]
command = ['set -o pipefail && ios-sim']
command << "install #{app_path}"
command << "--devicetypeid #{device_type}"
command << "--exit"
Action.sh command.join(' ')
end
# ios-sim install /Users/Thierry/Library/Developer/Xcode/DerivedData/Gengmei-fwlefrcslagvocbtnylgubtdgofr/Build/Products/Debug-iphonesimulator/Gengmei.app --devicetypeid iPhone-6s, 9.3 --exit
def self.description
"A short description with <= 80 characters of what this action does"
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.
# Below a few examples
[
FastlaneCore::ConfigItem.new(key: :device_type,
description: "Device Type"
),
FastlaneCore::ConfigItem.new(key: :app_path,
description: "App Path")
]
end
def self.output
# Define the shared values you are going to provide
# Example
[
['INSTALL_APP_ON_SIMULATOR_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
INSTRUMENTS_UI_AUTOMATION_CUSTOM_VALUE = :INSTRUMENTS_UI_AUTOMATION_CUSTOM_VALUE
end
class InstrumentsUiAutomationAction < Action
def self.run(params)
automation_template_path = ENV["FL_AUTOMATION_TEMPLATE"]
device = params[:device]
app_path = params[:app_path]
script = params[:script]
report_output_path = params[:report_output_path]
command = ['set -o pipefail && instruments']
command << "-t #{automation_template_path}"
command << "-w #{device} #{app_path}"
command << "-e UIASCRIPT #{script}"
command << "-e UIARESULTSPATH #{report_output_path}"
begin
Action.sh command.join(' ')
rescue => ex
exit_status = $?.exitstatus
raise_error = true
if exit_status.eql? 65
iphone_simulator_time_out_error = /iPhoneSimulator: Timed out waiting/
if (iphone_simulator_time_out_error =~ ex.message) != nil
raise_error = false
UI.important("First attempt failed with iPhone Simulator error: #{iphone_simulator_time_out_error.source}")
UI.important("Retrying once more...")
Action.sh command.join(' ')
end
end
raise ex if raise_error
end
# Clear All instrument trace file
Action.sh 'rm -rf instruments*.trace'
# Close Simulator
Action.sh 'killall "Simulator"'
end
# set -o pipefail && instruments
# -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate
# -w 68430CE4-8FC9-41EA-A9E3-5D3127BC9086 /Users/Thierry/Library/Developer/Xcode/DerivedData/Gengmei-fwlefrcslagvocbtnylgubtdgofr/Build/Products/Debug-iphonesimulator/Gengmei.app
# -e UIASCRIPT /Users/Thierry/.Jaguar/script/monkey/monkey.js
# -e UIARESULTSPATH /Users/Thierry/.Jaguar/log/testin
def self.description
"Xcode instrument command"
end
def self.available_options
# Define all options your action supports.
# Below a few examples
[
FastlaneCore::ConfigItem.new(key: :device,
description: "Device ID"),
FastlaneCore::ConfigItem.new(key: :app_path,
description: "App Path"),
FastlaneCore::ConfigItem.new(key: :report_output_path,
description: "Report Output Path"),
FastlaneCore::ConfigItem.new(key: :script,
description: "Monkey Script Path")
]
end
def self.output
# Define the shared values you are going to provide
# Example
[
['INSTRUMENTS_UI_AUTOMATION_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
......@@ -2,8 +2,7 @@ module Fastlane
module Actions
class PodInstallAction < Action
def self.run(params)
Actions.sh "cd Example && pod install"
Helper.log.info "Successfully pod install ⬆️ ".green
Actions.sh "pod repo update #{params[:repo]} && cd Example && pod install"
end
#####################################################
......@@ -17,6 +16,17 @@ module Fastlane
def self.details
"Update all pods"
end
def self.available_options
# Define all options your action supports.
[
FastlaneCore::ConfigItem.new(key: :repo,
description: "Repo",
is_string: true,
verify_block: proc do |value|
end),
]
end
def self.authors
["thierry"]
......
......@@ -5,28 +5,49 @@ module Fastlane
#/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"
command << "\"Set :CFBundleVersion #{params[:version]}\""
command << params[:plist]
result = Actions.sh(command.join(' '))
UI.success("Update Build Number Successfully ⬆️ ")
return result
end
def self.output
[
['BUILD_NUMBER', 'The new build number']
]
end
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :version,
description: "Build version",
is_string: true),
FastlaneCore::ConfigItem.new(key: :plist,
description: "Plist file",
is_string: true)
]
end
#####################################################
# @!group Documentation
#####################################################
def self.description
"更新iOS app build号为最新"
"Set the build version of your project"
end
def self.authors
["汪洋"]
["thierry"]
end
def self.is_supported?(platform)
platform == :ios
[:ios].include? platform
end
end
end
......
require "java-properties"
module Fastlane
module Actions
class UpdateGradleVersionAction < Action
def self.run(params)
properties = JavaProperties.load("gradle.properties")
properties[:VERSION_NAME] = params[:version]
JavaProperties.write(properties, "gradle.properties")
end
def self.description
"Update gradle aar version"
end
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :version,
description: "The value for VERSION_NAME in gradle.properties",
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
UPLOAD_APP_TO_FIR_CUSTOM_VALUE = :UPLOAD_APP_TO_FIR_CUSTOM_VALUE
end
class UploadAppToFirAction < Action
# fir p ./ipaout/Gengmei.ipa -T $fir_key
def self.run(params)
# fastlane will take care of reading in the parameter and fetching the environment variable:
unless params[:file_path] and params[:app_key]
UI.message("file_path or app_key can not be empty")
end
Action.sh "fir p #{params[:file_path]} -T #{params[:app_key]}"
end
#####################################################
# @!group Documentation
#####################################################
def self.description
"A short description with <= 80 characters of what this action does"
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.
# Below a few examples
[
FastlaneCore::ConfigItem.new(key: :file_path,
description: "App path", # a short description of this parameter
is_string: true
),
FastlaneCore::ConfigItem.new(key: :app_key,
description: "Fir key",
is_string: true
) # the default value if the user didn't provide one
]
end
def self.output
# Define the shared values you are going to provide
# Example
[
['UPLOAD_APP_TO_FIR_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)
# you can do things like
#
# true
#
# platform == :ios
#
# [:ios, :mac].include?(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