Class: Fastlane::Actions::UploadToBuglyAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/upload_to_bugly/actions/upload_to_bugly_action.rb

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



84
85
86
# File 'lib/fastlane/plugin/upload_to_bugly/actions/upload_to_bugly_action.rb', line 84

def self.authors
  ["fisherman"]
end

.available_optionsObject



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/fastlane/plugin/upload_to_bugly/actions/upload_to_bugly_action.rb', line 43

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :appid,
                                 env_name: "FL_UPLOAD_TO_BUGLY_APPID", # The name of the environment variable
                                 description: "bugly appid", # a short description of this parameter
                                 verify_block: proc do |value|
                                    UI.user_error!("No appid for UploadToBuglyAction given, pass using `appid: 'xxx'`") unless (value and not value.empty?)
                                 end),
    FastlaneCore::ConfigItem.new(key: :appkey,
                                 env_name: "FL_UPLOAD_TO_BUGLY_APPKEY", # The name of the environment variable
                                 description: "bugly appkey", # a short description of this parameter
                                 verify_block: proc do |value|
                                    UI.user_error!("No appkey for UploadToBuglyAction given, pass using `appkey: 'xxx'`") unless (value and not value.empty?)
                                 end),
    FastlaneCore::ConfigItem.new(key: :bundleid,
                                 env_name: "FL_UPLOAD_TO_BUGLY_BUNDLEID", # The name of the environment variable
                                 description: "app bundleid", # a short description of this parameter
                                 verify_block: proc do |value|
                                    UI.user_error!("No bundleid for UploadToBuglyAction given, pass using `bundleid: 'xxx'`") unless (value and not value.empty?)
                                 end),
    FastlaneCore::ConfigItem.new(key: :version,
                                 env_name: "FL_UPLOAD_TO_BUGLY_VERSION", # The name of the environment variable
                                 description: "app version", # a short description of this parameter
                                 verify_block: proc do |value|
                                    UI.user_error!("No version for UploadToBuglyAction given, pass using `version: 'xxx'`") unless (value and not value.empty?)
                                 end),
    FastlaneCore::ConfigItem.new(key: :platform,
                                 env_name: "FL_UPLOAD_TO_BUGLY_PLATFORM",
                                 description: "app platform",
                                 optional: true,
                                 is_string: true, # true: verifies the input is a string, false: every kind of value
                                 default_value: "IOS"), # the default value if the user didn't provide one
    FastlaneCore::ConfigItem.new(key: :inputSymbol,
                                env_name: "FL_UPLOAD_TO_BUGLY_INPUTSYMBOL", # The name of the environment variable
                                description: ".dsym path", # a short description of this parameter
                                verify_block: proc do |value|
                                  UI.user_error!("No inputSymbol for UploadToBuglyAction given, pass using `inputSymbol: 'xxx'`") unless (value and not value.empty?)
                                end)
  ]
end

.call_error_callback(params, result) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/fastlane/plugin/upload_to_bugly/actions/upload_to_bugly_action.rb', line 25

def self.call_error_callback(params, result)
  if params[:error_callback]
    Dir.chdir(FastlaneCore::FastlaneFolder.path) do
      params[:error_callback].call(result)
    end
  else
    UI.shell_error!(result)
  end
end

.descriptionObject



39
40
41
# File 'lib/fastlane/plugin/upload_to_bugly/actions/upload_to_bugly_action.rb', line 39

def self.description
  "通过 buglyqq-upload-symbol.jar 来上传 .dSYM 到 bugly"
end

.detailsObject



88
89
90
# File 'lib/fastlane/plugin/upload_to_bugly/actions/upload_to_bugly_action.rb', line 88

def self.details
  "upload .dSYM to bugly with buglyqq-upload-symbol.jar,具体操作查看 README.md"
end

.example_codeObject



96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/fastlane/plugin/upload_to_bugly/actions/upload_to_bugly_action.rb', line 96

def self.example_code
  [
    'upload_to_bugly(
      appid: "xxx",
      appkey: "xxx",
      bundleid: "xxx",
      version: "a.b.c",
      inputSymbol: "./xxx.dSYM"
    )
    '
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


92
93
94
# File 'lib/fastlane/plugin/upload_to_bugly/actions/upload_to_bugly_action.rb', line 92

def self.is_supported?(platform)
  platform == :ios
end

.run(params) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/fastlane/plugin/upload_to_bugly/actions/upload_to_bugly_action.rb', line 8

def self.run(params)
  cmd = []

  cmd << ["java -jar ~/bin/buglyqq-upload-symbol.jar"]
  cmd << "-appid #{params[:appid]}" 
  cmd << "-appkey #{params[:appkey]}" 
  cmd << "-bundleid #{params[:bundleid]}" 
  cmd << "-version #{params[:version]}" 
  cmd << "-platform #{params[:platform]}" 
  cmd << "-inputSymbol #{params[:inputSymbol]}" 

  Action.sh(cmd.join(' '), error_callback: lambda { |result|
    call_error_callback(params, result)
  })

end