Class: Fastlane::Actions::GetLaneAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



49
50
51
# File 'lib/fastlane/plugin/schedule/actions/get_lane_action.rb', line 49

def self.authors
  ["marumemomo"]
end

.available_optionsObject



62
63
64
65
66
67
68
69
70
# File 'lib/fastlane/plugin/schedule/actions/get_lane_action.rb', line 62

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :timezone,
                            env_name: "TZ",
                         description: "timezone",
                            optional: true,
                                type: String)
  ]
end

.descriptionObject



45
46
47
# File 'lib/fastlane/plugin/schedule/actions/get_lane_action.rb', line 45

def self.description
  "Run lane from current time"
end

.detailsObject



57
58
59
60
# File 'lib/fastlane/plugin/schedule/actions/get_lane_action.rb', line 57

def self.details
  # Optional:
  "Run lane from current time"
end

.everyday_actionObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/fastlane/plugin/schedule/actions/get_lane_action.rb', line 30

def self.everyday_action
  schedule = YAML.load_file('./fastlane/schedule.yml')
  everydayActions = schedule['everyday']
  if everydayActions.nil?
    return nil
  end
  time = Time.now
  hour = time.hour
  action = everydayActions[hour]
  if action.nil?
    return nil
  end
  return action['lane']
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


72
73
74
75
76
77
78
# File 'lib/fastlane/plugin/schedule/actions/get_lane_action.rb', line 72

def self.is_supported?(platform)
  # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
  # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
  #
  # [:ios, :mac, :android].include?(platform)
  true
end

.return_valueObject



53
54
55
# File 'lib/fastlane/plugin/schedule/actions/get_lane_action.rb', line 53

def self.return_value
  # If your method provides a return value, you can describe here what it does
end

.run(params) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/fastlane/plugin/schedule/actions/get_lane_action.rb', line 9

def self.run(params)
  default_timezone = ENV['TZ']
  if !params[:timezone].nil?
    ENV['TZ'] = params[:timezone]
  end
  schedule = YAML.load_file('./fastlane/schedule.yml')
  time = Time.now
  wday = time.wday
  todayActions = schedule[wday]
  if todayActions.nil?
    return everyday_action
  end
  hour = time.hour
  action = todayActions[hour]
  if action.nil?
    return everyday_action
  end
  ENV['TZ'] = default_timezone
  action['lane']
end