fastlane-plugin-queue 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cdacfd6b25670d732c568e5dc5241b3a13e8fe61
4
+ data.tar.gz: cad53d3beab7cd475c7e8ef71856783d7ac15e8f
5
+ SHA512:
6
+ metadata.gz: f78af491b790c137cdeb17e3f6cd1423309113bc4e09143c02a0bd9df17a23ac54523bb1938aedb2f98f780585dea8295ac41bac128b2d89bc1b32d55a32a567
7
+ data.tar.gz: 99cbe8c10c7cd7e2920b58ab3a6338e96f64dde1af8f15230834b05bfea8e576ef42b2ba2721dda188425252bedb5b42e6490f5ae9f42e7c5e0001c1ac2e077c
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Josh Holtz <josh@rokkincat.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,123 @@
1
+ # fastlane-plugin-queue
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-queue)
4
+
5
+ ## About fastlane-plugin-queue
6
+
7
+ Easily queue up `fastlane` jobs using [Resque](https://github.com/resque/resque).
8
+
9
+ ### Current Features
10
+ - Queue any of your lanes into a `resque` queue
11
+ - Manage queue using `resque`'s web interface
12
+ - View queued, running, and failed jobs
13
+ - Retry failed jobs
14
+
15
+ ### Planned Features
16
+ - Configure any `resque` settings
17
+ - Ex: port, redis connection settings, plugins
18
+ - Custom web interface for starting `fastlane` jobs
19
+ - Allow different `dotenv` settings per job
20
+
21
+ ![Screenshot - Overview](screenshots/screenshot_overview.png)
22
+
23
+ ## Getting Started
24
+
25
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-queue`, add it to your project by running:
26
+
27
+ ```bash
28
+ fastlane add_plugin queue
29
+ ```
30
+
31
+ This plugin also require [Redis](https://redis.io). Install using `brew install redis` or instructions [here](https://redis.io/download)
32
+
33
+ ### Step 0 - Start Redis server
34
+ Make sure you Redis server is running. This is usually done by running `redis-server` (but this may be different based on how Redis was installed).
35
+
36
+ ### Step 1 - Start queue
37
+ Start the queue web server and worker by running the following command. This will be a **blocking** command so you will need to open to open a second terminal window/tab to add your fastlane jobs to the queue. To kill the web server and worker, you will need to hit `CONTROL + C`.
38
+ ```rb
39
+ fastlane run start_queue
40
+ ```
41
+
42
+ ### Step 2 - Add to queue
43
+ The easiest way to add a job to a queue is to run the `queue` action direction using the following command. The `run` parameter will run anything you would put after the "fastlane" command you would usually run. Below are some examples:
44
+ ```rb
45
+ fastlane run queue run:"ios deploy"
46
+ ```
47
+
48
+ ```rb
49
+ fastlane run queue run:"android deploy"
50
+ ```
51
+
52
+ ```rb
53
+ fastlane run queue run:"build"
54
+ ```
55
+
56
+ ```rb
57
+ fastlane run queue run:"ios beta group:staging"
58
+ ```
59
+
60
+ ## Advanced
61
+ It is possible add fastlane jobs to your queue by using standard fastlane syntax by adding `queue:true` (see below)
62
+
63
+ ```sh
64
+ fastlane ios beta queue:true
65
+ ```
66
+
67
+ To do this, add the following setup in your `Fastfile`...
68
+
69
+ ```rb
70
+ before_all do |lane, options|
71
+ if options[:queue]
72
+ queue(
73
+ platform: Actions.lane_context[Actions::SharedValues::PLATFORM_NAME],
74
+ lane: lane.to_s,
75
+ lane_parameters: options
76
+ )
77
+ UI.abort_with_message! "We queued this so not running"
78
+ end
79
+ end
80
+ ```
81
+
82
+ This will abort the fastlane process before any of the lanes can get called but **will** add a job to the queue platform, lane, and parameters that you specified in your command.
83
+
84
+ ## Example Resque Screenshots
85
+
86
+ |Resque Screen|Screenshot|
87
+ |---|---|
88
+ |Overview|![Screenshot - Overview](screenshots/screenshot_overview.png)|
89
+ |Pending|![Screenshot - Pending](screenshots/screenshot_pending.png)|
90
+ |Failed|![Screenshot - Failed](screenshots/screenshot_failed.png)|
91
+
92
+ ## Example
93
+
94
+ 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`.
95
+
96
+ ## Run tests for this plugin
97
+
98
+ To run both the tests, and code style validation, run
99
+
100
+ ```
101
+ rake
102
+ ```
103
+
104
+ To automatically fix many of the styling issues, use
105
+ ```
106
+ rubocop -a
107
+ ```
108
+
109
+ ## Issues and Feedback
110
+
111
+ For any other issues and feedback about this plugin, please submit it to this repository.
112
+
113
+ ## Troubleshooting
114
+
115
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
116
+
117
+ ## Using _fastlane_ Plugins
118
+
119
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
120
+
121
+ ## About _fastlane_
122
+
123
+ _fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
@@ -0,0 +1,72 @@
1
+ require 'resque'
2
+
3
+ module Fastlane
4
+ module Actions
5
+ class QueueAction < Action
6
+ def self.run(params)
7
+ # Should be value like "<platform> <lane> <parameters...>"
8
+ # Ex: "ios build environment:production"
9
+ # Usage: fastlane run queue run:"ios build environment:production"
10
+ run = params[:run]
11
+
12
+ # These values come in from running the queue action in a Fastfile
13
+ platform = params[:platform]
14
+ lane = params[:lane]
15
+ lane_parameters = params[:lane_parameters]
16
+
17
+ if lane_parameters
18
+ lane_parameters['queue'] = nil
19
+ lane_parameters[:queue] = nil
20
+ end
21
+
22
+ Resque.enqueue(Job, {
23
+ 'run' => run,
24
+ 'platform' => platform,
25
+ 'lane' => lane,
26
+ 'lane_parameters' => lane_parameters
27
+ })
28
+ end
29
+
30
+ def self.description
31
+ "Adds fastlane jobs to a queue"
32
+ end
33
+
34
+ def self.authors
35
+ ["Josh Holtz"]
36
+ end
37
+
38
+ def self.return_value
39
+ # If your method provides a return value, you can describe here what it does
40
+ end
41
+
42
+ def self.details
43
+ "Adds fastlane jobs to a Resque queue"
44
+ end
45
+
46
+ def self.available_options
47
+ [
48
+ FastlaneCore::ConfigItem.new(key: :run,
49
+ description: "Run that stuff",
50
+ optional: true,
51
+ type: String),
52
+ FastlaneCore::ConfigItem.new(key: :platform,
53
+ description: "Run that stuff",
54
+ optional: true,
55
+ type: String),
56
+ FastlaneCore::ConfigItem.new(key: :lane,
57
+ description: "Run that stuff",
58
+ optional: true,
59
+ type: String),
60
+ FastlaneCore::ConfigItem.new(key: :lane_parameters,
61
+ description: "Run that stuff",
62
+ optional: true,
63
+ type: Hash)
64
+ ]
65
+ end
66
+
67
+ def self.is_supported?(platform)
68
+ true
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,59 @@
1
+ module Fastlane
2
+ module Actions
3
+ class QueueStartAction < Action
4
+ def self.run(params)
5
+ UI.message("Starting the queue's web server and worker!")
6
+
7
+ # Gotta do the fork thing
8
+ # Otherwise this process will block the worker from starting
9
+ # This can get called multiple times and only one server will be run
10
+ Process.fork do
11
+ require 'vegas'
12
+ require 'resque/server'
13
+ Vegas::Runner.new(Resque::Server, 'fastlane-plugin-queue-resque-web')
14
+ end
15
+
16
+ # Starts a blocking worker
17
+ require 'resque'
18
+ worker = Resque::Worker.new("fastlane")
19
+ worker.prepare
20
+ worker.log "Starting worker #{self}"
21
+ worker.work(5) # interval, will block
22
+
23
+ # Stops the queue and webserver
24
+ other_action.queue_stop
25
+ end
26
+
27
+ def self.description
28
+ "Starts web server and worker for queueing fastlane jobs"
29
+ end
30
+
31
+ def self.authors
32
+ ["Josh Holtz"]
33
+ end
34
+
35
+ def self.return_value
36
+ # This action will NEVER return because the worker is blocking
37
+ end
38
+
39
+ def self.details
40
+ "Starts a Resque web server and worker for queueing fastlane jobs"
41
+ end
42
+
43
+ def self.available_options
44
+ # No options right now but probably allow Resque options to be set
45
+ [
46
+ # FastlaneCore::ConfigItem.new(key: :your_option,
47
+ # env_name: "QUEUE_YOUR_OPTION",
48
+ # description: "A description of your option",
49
+ # optional: false,
50
+ # type: String)
51
+ ]
52
+ end
53
+
54
+ def self.is_supported?(platform)
55
+ true
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,60 @@
1
+ module Fastlane
2
+ module Actions
3
+ class QueueStopAction < Action
4
+ def self.run(params)
5
+ UI.message("Stopping the queue's web server and worker!")
6
+
7
+ # I feel bad about this but need to kill the process of the worker
8
+ # and shutdown the worker and prunce dead workers from showing
9
+ # in the Resque web interface
10
+ require 'resque'
11
+ begin
12
+ Resque::Worker.all.each do |worker|
13
+ begin
14
+ Process.kill("KILL", worker.pid)
15
+ rescue StandardError
16
+ true
17
+ end
18
+ worker.shutdown!
19
+ worker.prune_dead_workers
20
+ end
21
+ rescue StandardError
22
+ UI.warning("Nothing to stop")
23
+ end
24
+
25
+ # Shut down our web server
26
+ begin
27
+ require 'vegas'
28
+ require 'resque/server'
29
+ Vegas::Runner.new(Resque::Server, 'fastlane-plugin-queue-resque-web', {}, ["--kill"])
30
+ rescue StandardError
31
+ UI.warning("Nothing to stop")
32
+ end
33
+ end
34
+
35
+ def self.description
36
+ "Stops web server and worker for queueing fastlane jobs"
37
+ end
38
+
39
+ def self.authors
40
+ ["Josh Holtz"]
41
+ end
42
+
43
+ def self.return_value
44
+ # No return value right now
45
+ end
46
+
47
+ def self.details
48
+ "Stops a Resque web server and worker for queueing fastlane jobs"
49
+ end
50
+
51
+ def self.available_options
52
+ # No options right now
53
+ end
54
+
55
+ def self.is_supported?(platform)
56
+ true
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,26 @@
1
+ class MockOptions
2
+ attr_accessor :env
3
+ end
4
+
5
+ class Job
6
+ @queue = :fastlane
7
+
8
+ def self.perform(params)
9
+ run = params['run']
10
+
11
+ platform = params['platform']
12
+ lane = params['lane']
13
+ lane_parameters = params['lane_parameters']
14
+
15
+ if run
16
+ args = run.split(' ')
17
+ Fastlane::CommandLineHandler.handle(args, MockOptions.new)
18
+ else
19
+ platform = nil if platform.to_s.size == 0
20
+ lane_parameters = lane_parameters.each_with_object({}) { |(k, v), memo| memo[k.to_sym] = v; }
21
+
22
+ dot_env = nil
23
+ Fastlane::LaneManager.cruise_lane(platform, lane, lane_parameters, dot_env)
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,12 @@
1
+ module Fastlane
2
+ module Helper
3
+ class QueueHelper
4
+ # class methods that you define here become available in your action
5
+ # as `Helper::QueueHelper.your_method`
6
+ #
7
+ def self.show_message
8
+ UI.message("Hello from the queue plugin helper!")
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module Queue
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/queue/version'
2
+
3
+ module Fastlane
4
+ module Queue
5
+ # Return all .rb files inside the "actions" and "helper" directory
6
+ def self.all_classes
7
+ Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
8
+ end
9
+ end
10
+ end
11
+
12
+ # By default we want to import all available actions and helpers
13
+ # A plugin can contain any number of actions and plugins
14
+ Fastlane::Queue.all_classes.each do |current|
15
+ require current
16
+ end
@@ -0,0 +1,2 @@
1
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../../lib'
2
+ require 'resque/tasks'
metadata ADDED
@@ -0,0 +1,180 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-queue
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Josh Holtz
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-10-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: resque
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.27'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.27'
27
+ - !ruby/object:Gem::Dependency
28
+ name: vegas
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: fastlane
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 2.53.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 2.53.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: simplecov
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ description:
140
+ email: josh@rokkincat.com
141
+ executables: []
142
+ extensions: []
143
+ extra_rdoc_files: []
144
+ files:
145
+ - LICENSE
146
+ - README.md
147
+ - lib/fastlane/plugin/queue.rb
148
+ - lib/fastlane/plugin/queue/actions/queue_action.rb
149
+ - lib/fastlane/plugin/queue/actions/queue_start_action.rb
150
+ - lib/fastlane/plugin/queue/actions/queue_stop_action.rb
151
+ - lib/fastlane/plugin/queue/helper/job.rb
152
+ - lib/fastlane/plugin/queue/helper/queue_helper.rb
153
+ - lib/fastlane/plugin/queue/version.rb
154
+ - lib/tasks/resque.rake
155
+ homepage:
156
+ licenses:
157
+ - MIT
158
+ metadata: {}
159
+ post_install_message:
160
+ rdoc_options: []
161
+ require_paths:
162
+ - lib
163
+ required_ruby_version: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
168
+ required_rubygems_version: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: '0'
173
+ requirements: []
174
+ rubyforge_project:
175
+ rubygems_version: 2.5.2
176
+ signing_key:
177
+ specification_version: 4
178
+ summary: Queue up fastlane jobs
179
+ test_files: []
180
+ has_rdoc: