fastlane-plugin-slack_train 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 66ca14c24867e6cec4ff792168a221d868b36308
4
- data.tar.gz: 60771c7c7d7fad500d9c18106bbdfb888b52a303
3
+ metadata.gz: 85dfa8b4f4861d66db1338773a10c68689604c74
4
+ data.tar.gz: e352565c17d538effd2a768fc3e866d8e9d062e6
5
5
  SHA512:
6
- metadata.gz: e90bb41e5d23e58007885322621021963db1d766966b69ba1b9970cb5856546b78d3258eec0da6e86921a588d5cc0a1c8cc7e0de613b08cc21c89ce2e7c1dd4b
7
- data.tar.gz: 9915737e84287199a4b22a962b0abf48f9b792b3e6b26b48b7b0ce9355dc24fcd1ebb3af65c9575b953f5dccb8615bce63d88e644ee7c5a79f14eb8c9f6e0760
6
+ metadata.gz: 6a9defe38493587a25b146e774471a547745727d7f07c0695a01c87e3d188d7f21256d3c54ee02bc2c15bb1dbe9f639f5bf66d06802236975f796343ad9e67a1
7
+ data.tar.gz: 90c5f88704edb69ad71317b216d3da750145ea3ac0a3c4722679d5c138dea8bb9dd5fe877e7a63b7010d6b28c9072f62d0bd8f085ecc77587180d157a1a5f6ab
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # slack_train plugin
2
2
 
3
+ [![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/KrauseFx/fastlane-plugin-slack_train/blob/master/LICENSE)
4
+ [![Gem](https://img.shields.io/gem/v/fastlane-plugin-slack_train.svg?style=flat)](https://rubygems.org/gems/fastlane-plugin-slack_train)
3
5
  [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-slack_train)
4
6
 
5
7
  ## Getting Started
@@ -12,24 +14,57 @@ fastlane add_plugin slack_train
12
14
 
13
15
  ## About slack_train
14
16
 
17
+ Idea from [Paul Taykalo](https://twitter.com/TT_Kilew/status/766651907117023233)
18
+
15
19
  Show a train of the fastlane progress
16
20
 
17
- **Note to author:** Add a more detailed description about this plugin here. If your plugin contains multiple actions, make sure to mention them here.
21
+ Train | Rocket | Crash
22
+ ------|--------|-------
23
+ ![assets/train.png](assets/train.png) | ![assets/rocket.png](assets/rocket.png) | ![assets/crash.png](assets/crash.png)
18
24
 
19
25
  ## Example
20
26
 
21
27
  Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
22
28
 
23
- **Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
29
+ ```ruby
30
+ lane :beta do
31
+ slack_train_start(distance: 4)
32
+ slack_train
24
33
 
25
- ## Run tests for this plugin
34
+ cocoapods
35
+ slack_train
26
36
 
27
- To run both the tests, and code style validation, run
37
+ gym
38
+ slack_train
28
39
 
40
+ crashlytics
41
+ slack_train
42
+ end
29
43
  ```
30
- rake
44
+
45
+ Or use a rocket emoji:
46
+
47
+ ```ruby
48
+ lane :beta do
49
+ slack_train_start(distance: 4,
50
+ train: "🚀",
51
+ reverse_direction: true,
52
+ rail: "✨")
53
+ slack_train
54
+
55
+ cocoapods
56
+ slack_train
57
+
58
+ gym
59
+ slack_train
60
+
61
+ crashlytics
62
+ slack_train
63
+ end
31
64
  ```
32
65
 
66
+ ## Run tests for this plugin
67
+
33
68
  To automatically fix many of the styling issues, use
34
69
  ```
35
70
  rubocop -a
@@ -2,13 +2,26 @@ module Fastlane
2
2
  module Actions
3
3
  class SlackTrainAction < Action
4
4
  def self.run(params)
5
- train_emoji = params[:train]
5
+ train_emoji = lane_context[SharedValues::SLACK_TRAIN_EMOJI]
6
+ rail_emoji = lane_context[SharedValues::SLACK_TRAIN_RAIL]
6
7
  total_distance = lane_context[SharedValues::SLACK_TRAIN_DISTANCE]
8
+ current_position = lane_context[SharedValues::SLACK_TRAIN_CURRENT_TRAIN_POSITION]
9
+ speed = lane_context[SharedValues::SLACK_TRAIN_DIRECTION]
10
+ return if total_distance.nil? # train hasn't started yet
7
11
 
8
- before = "=" * (total_distance - 1)
12
+ UI.user_error!("train drove too far") if current_position < 0
13
+ UI.user_error!("train drove too far") if total_distance == current_position
9
14
 
10
- message = "#{before}#{train_emoji}"
11
- other_action.slack(message: message)
15
+ before = rail_emoji * current_position
16
+ after = rail_emoji * (total_distance - current_position - 1)
17
+ lane_name = lane_context[SharedValues::LANE_NAME]
18
+
19
+ message = ["`#{lane_name}` ", before, train_emoji, after].join("")
20
+ other_action.slack(message: message,
21
+ default_payloads: [])
22
+ UI.message(message)
23
+
24
+ lane_context[SharedValues::SLACK_TRAIN_CURRENT_TRAIN_POSITION] += speed
12
25
  end
13
26
 
14
27
  def self.description
@@ -16,26 +29,15 @@ module Fastlane
16
29
  end
17
30
 
18
31
  def self.authors
19
- ["Felix Krause"]
32
+ ["@KrauseFx"]
20
33
  end
21
34
 
22
35
  def self.return_value
23
- # If your method provides a return value, you can describe here what it does
24
- end
25
-
26
- def self.details
27
- # Optional:
28
- "Nope"
36
+ "A string that is being sent to slack"
29
37
  end
30
38
 
31
39
  def self.available_options
32
- [
33
- FastlaneCore::ConfigItem.new(key: :train,
34
- env_name: "SLACK_TRAIN_TRAIN",
35
- description: "Train emoji",
36
- default_value: "🚝",
37
- type: String)
38
- ]
40
+ []
39
41
  end
40
42
 
41
43
  def self.is_supported?(platform)
@@ -1,12 +1,12 @@
1
1
  module Fastlane
2
2
  module Actions
3
- module SharedValues
4
- SLACK_TRAIN_DISTANCE = :SLACK_TRAIN_DISTANCE
5
- end
6
-
7
3
  class SlackTrainCrashAction < Action
8
4
  def self.run(params)
9
- other_action.slack(message: "💥")
5
+ total_distance = lane_context[SharedValues::SLACK_TRAIN_DISTANCE]
6
+ return if total_distance.nil? # train hasn't started yet
7
+
8
+ message = "💥" * total_distance
9
+ other_action.slack(message: message, success: false, default_payloads: [])
10
10
  end
11
11
 
12
12
  def self.description
@@ -14,17 +14,7 @@ module Fastlane
14
14
  end
15
15
 
16
16
  def self.authors
17
- ["Felix Krause"]
18
- end
19
-
20
- def self.available_options
21
- [
22
- FastlaneCore::ConfigItem.new(key: :distance,
23
- env_name: "SLACK_TRAIN_DISTANCE",
24
- description: "How many rails do we need?",
25
- default_value: 5,
26
- type: Integer)
27
- ]
17
+ ["@KrauseFx"]
28
18
  end
29
19
 
30
20
  def self.is_supported?(platform)
@@ -2,12 +2,19 @@ module Fastlane
2
2
  module Actions
3
3
  module SharedValues
4
4
  SLACK_TRAIN_DISTANCE = :SLACK_TRAIN_DISTANCE
5
+ SLACK_TRAIN_EMOJI = :SLACK_TRAIN_EMOJI
6
+ SLACK_TRAIN_RAIL = :SLACK_TRAIN_RAIL
7
+ SLACK_TRAIN_CURRENT_TRAIN_POSITION = :SLACK_TRAIN_CURRENT_TRAIN_POSITION
8
+ SLACK_TRAIN_DIRECTION = :SLACK_TRAIN_DIRECTION
5
9
  end
6
10
 
7
11
  class SlackTrainStartAction < Action
8
12
  def self.run(params)
9
- # store the value somewhere
10
13
  lane_context[SharedValues::SLACK_TRAIN_DISTANCE] = params[:distance]
14
+ lane_context[SharedValues::SLACK_TRAIN_EMOJI] = params[:train]
15
+ lane_context[SharedValues::SLACK_TRAIN_RAIL] = params[:rail]
16
+ lane_context[SharedValues::SLACK_TRAIN_DIRECTION] = params[:reverse_direction] ? 1 : -1
17
+ lane_context[SharedValues::SLACK_TRAIN_CURRENT_TRAIN_POSITION] = params[:reverse_direction] ? 0 : (params[:distance] - 1)
11
18
  end
12
19
 
13
20
  def self.description
@@ -15,7 +22,7 @@ module Fastlane
15
22
  end
16
23
 
17
24
  def self.authors
18
- ["Felix Krause"]
25
+ ["@KrauseFx"]
19
26
  end
20
27
 
21
28
  def self.available_options
@@ -24,7 +31,22 @@ module Fastlane
24
31
  env_name: "SLACK_TRAIN_DISTANCE",
25
32
  description: "How many rails do we need?",
26
33
  default_value: 5,
27
- type: Integer)
34
+ type: Integer),
35
+ FastlaneCore::ConfigItem.new(key: :train,
36
+ env_name: "SLACK_TRAIN_TRAIN",
37
+ description: "Train emoji",
38
+ default_value: "🚝",
39
+ type: String),
40
+ FastlaneCore::ConfigItem.new(key: :rail,
41
+ env_name: "SLACK_TRAIN_RAIL",
42
+ description: "Character or emoji for the rail",
43
+ default_value: "=",
44
+ type: String),
45
+ FastlaneCore::ConfigItem.new(key: :reverse_direction,
46
+ env_name: "SLACK_TRAIN_REVERSE_DIRECTION",
47
+ description: "Pass true if you want the train to go from left to right",
48
+ default_value: false,
49
+ is_string: false)
28
50
  ]
29
51
  end
30
52
 
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module SlackTrain
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-slack_train
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Krause
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-01 00:00:00.000000000 Z
11
+ date: 2017-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  version: '0'
129
129
  requirements: []
130
130
  rubyforge_project:
131
- rubygems_version: 2.5.1
131
+ rubygems_version: 2.6.10
132
132
  signing_key:
133
133
  specification_version: 4
134
134
  summary: Show a train of the fastlane progress