Class: Fastlane::Actions::PixieAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



27
28
29
# File 'lib/fastlane/plugin/pixie/actions/pixie_action.rb', line 27

def self.authors
  ["Piotrek Dubiel"]
end

.available_optionsObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/fastlane/plugin/pixie/actions/pixie_action.rb', line 31

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :device_id,
                            env_name: "PIXIE_DEVICE_ID",
                         description: "Device id of your Particle Photon/Core",
                            optional: false,
                                type: String),
    FastlaneCore::ConfigItem.new(key: :access_token,
                            env_name: "PIXIE_ACCESS_TOKEN",
                         description: "Access token to Particle Cloud",
                            optional: false,
                                type: String),
    FastlaneCore::ConfigItem.new(key: :status,
                            env_name: "PIXIE_STATUS",
                         description: "Build status to send",
                            optional: true,
                                type: String,
                       default_value: "success"),
    FastlaneCore::ConfigItem.new(key: :port,
                            env_name: "PIXIE_PORT",
                         description: "Port number",
                                type: String)
  ]
end

.descriptionObject



23
24
25
# File 'lib/fastlane/plugin/pixie/actions/pixie_action.rb', line 23

def self.description
  "Show your build status on PIXIE!"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/fastlane/plugin/pixie/actions/pixie_action.rb', line 56

def self.is_supported?(platform)
  true
end

.run(params) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/fastlane/plugin/pixie/actions/pixie_action.rb', line 9

def self.run(params)
  res = Particle.new(params[:access_token], params[:device_id]).function("statusPort#{params[:port]}", params[:status])
  if res.kind_of?(Net::HTTPSuccess)
    UI.success("PIXIE status set!")
  else
    UI.error("Error: #{res.body}")
  end
  sleep 1
end

.unique_id_from_git_remote_originObject



19
20
21
# File 'lib/fastlane/plugin/pixie/actions/pixie_action.rb', line 19

def self.unique_id_from_git_remote_origin
  Digest::MD5.hexdigest sh "git config --get remote.origin.url"
end