sleeping_king_studios-tasks 0.1.0.rc.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +26 -0
- data/DEVELOPMENT.md +50 -0
- data/LICENSE +22 -0
- data/README.md +405 -0
- data/lib/sleeping_king_studios/tasks.rb +27 -0
- data/lib/sleeping_king_studios/tasks/apps.rb +49 -0
- data/lib/sleeping_king_studios/tasks/apps/app_configuration.rb +68 -0
- data/lib/sleeping_king_studios/tasks/apps/applications_task.rb +28 -0
- data/lib/sleeping_king_studios/tasks/apps/bundle.rb +8 -0
- data/lib/sleeping_king_studios/tasks/apps/bundle/install_runner.rb +21 -0
- data/lib/sleeping_king_studios/tasks/apps/bundle/install_task.rb +39 -0
- data/lib/sleeping_king_studios/tasks/apps/bundle/update_runner.rb +21 -0
- data/lib/sleeping_king_studios/tasks/apps/bundle/update_task.rb +39 -0
- data/lib/sleeping_king_studios/tasks/apps/ci.rb +8 -0
- data/lib/sleeping_king_studios/tasks/apps/ci/results_reporter.rb +69 -0
- data/lib/sleeping_king_studios/tasks/apps/ci/rspec_task.rb +29 -0
- data/lib/sleeping_king_studios/tasks/apps/ci/rspec_wrapper.rb +42 -0
- data/lib/sleeping_king_studios/tasks/apps/ci/rubocop_task.rb +29 -0
- data/lib/sleeping_king_studios/tasks/apps/ci/rubocop_wrapper.rb +29 -0
- data/lib/sleeping_king_studios/tasks/apps/ci/simplecov_task.rb +68 -0
- data/lib/sleeping_king_studios/tasks/apps/ci/step_wrapper.rb +49 -0
- data/lib/sleeping_king_studios/tasks/apps/ci/steps_runner.rb +37 -0
- data/lib/sleeping_king_studios/tasks/apps/ci/steps_task.rb +92 -0
- data/lib/sleeping_king_studios/tasks/ci.rb +8 -0
- data/lib/sleeping_king_studios/tasks/ci/cucumber_parser.rb +118 -0
- data/lib/sleeping_king_studios/tasks/ci/cucumber_results.rb +191 -0
- data/lib/sleeping_king_studios/tasks/ci/cucumber_runner.rb +53 -0
- data/lib/sleeping_king_studios/tasks/ci/cucumber_task.rb +47 -0
- data/lib/sleeping_king_studios/tasks/ci/results_helpers.rb +44 -0
- data/lib/sleeping_king_studios/tasks/ci/rspec_each_results.rb +118 -0
- data/lib/sleeping_king_studios/tasks/ci/rspec_each_task.rb +156 -0
- data/lib/sleeping_king_studios/tasks/ci/rspec_results.rb +126 -0
- data/lib/sleeping_king_studios/tasks/ci/rspec_runner.rb +62 -0
- data/lib/sleeping_king_studios/tasks/ci/rspec_task.rb +71 -0
- data/lib/sleeping_king_studios/tasks/ci/rubocop_results.rb +80 -0
- data/lib/sleeping_king_studios/tasks/ci/rubocop_runner.rb +46 -0
- data/lib/sleeping_king_studios/tasks/ci/rubocop_task.rb +44 -0
- data/lib/sleeping_king_studios/tasks/ci/simplecov_results.rb +62 -0
- data/lib/sleeping_king_studios/tasks/ci/simplecov_task.rb +25 -0
- data/lib/sleeping_king_studios/tasks/ci/steps_runner.rb +69 -0
- data/lib/sleeping_king_studios/tasks/ci/steps_task.rb +93 -0
- data/lib/sleeping_king_studios/tasks/configuration.rb +114 -0
- data/lib/sleeping_king_studios/tasks/file.rb +8 -0
- data/lib/sleeping_king_studios/tasks/file/new_task.rb +238 -0
- data/lib/sleeping_king_studios/tasks/process_runner.rb +70 -0
- data/lib/sleeping_king_studios/tasks/task.rb +95 -0
- data/lib/sleeping_king_studios/tasks/task_group.rb +37 -0
- data/lib/sleeping_king_studios/tasks/version.rb +58 -0
- metadata +271 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 23b7118b16d2e49bdf0cce8ae9fc851a9dc15e65
|
4
|
+
data.tar.gz: 871a76c2aca5508af7274c523b490b280e5bf88e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cd3215b9178f05d13cbc1242de1a29fadbe73b4d09c69c7fcb867135286e945df6ad16073945174afd352d93fe8393a6ad49c647c538a90a92cc8fdf6a1e96fb
|
7
|
+
data.tar.gz: 9d07f269ef18d991864ae874b6355c531d1c111857b4f4891adf8f782b1a490062e49c314790d762c581dce0d7bad25b363cc6f42ee062f29280ce6ef1c32289
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## 0.1.0
|
4
|
+
|
5
|
+
Initial commit.
|
6
|
+
|
7
|
+
- Implement SleepingKingStudios::Tasks::Task, TaskGroup.
|
8
|
+
|
9
|
+
### Apps
|
10
|
+
|
11
|
+
Tasks for managing multiple applications within a single repository. Each application can have a separate Gemfile and configuration.
|
12
|
+
|
13
|
+
- Implement tasks for installing and updating bundled gems.
|
14
|
+
- Implement tasks for running and aggregating CI steps across applications.
|
15
|
+
|
16
|
+
### Ci
|
17
|
+
|
18
|
+
Tasks for running and aggregating CI steps.
|
19
|
+
|
20
|
+
- Implement tasks for RSpec, Cucumber, RuboCop, SimpleCov, and running each RSpec file individually.
|
21
|
+
|
22
|
+
### File
|
23
|
+
|
24
|
+
Tasks for creating and managing source files.
|
25
|
+
|
26
|
+
- Implement task for generating new source files with template support and optional spec file.
|
data/DEVELOPMENT.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
## Tasks
|
2
|
+
|
3
|
+
### 0.1.0
|
4
|
+
|
5
|
+
- task names should be strings, not symbols
|
6
|
+
- formalize (public) task names as _Task, _task.rb ?
|
7
|
+
- documentation pass
|
8
|
+
|
9
|
+
### Future Tasks
|
10
|
+
|
11
|
+
- integration testing for RSpec, RSpecEach tasks
|
12
|
+
- sample spec files with known output(s)
|
13
|
+
- extract common Results object superclass
|
14
|
+
- defaults for #passing?, #pending?, #failing?, #errored?
|
15
|
+
- implement #==, #merge, #to_h
|
16
|
+
- simple DSL for hash-access-with-default method definitions
|
17
|
+
- also updates #to_h
|
18
|
+
- delegate #to_s to #summary
|
19
|
+
- configurable "base" namespace
|
20
|
+
|
21
|
+
#### Apps
|
22
|
+
|
23
|
+
#### CI
|
24
|
+
|
25
|
+
- task ci:steps: |
|
26
|
+
|
27
|
+
Add --diff option
|
28
|
+
|
29
|
+
only runs ci steps on changed files/parts of files.
|
30
|
+
|
31
|
+
- task ci:yard: |
|
32
|
+
|
33
|
+
Checks the number of undocumented modules, classes, constants, methods, etc.
|
34
|
+
|
35
|
+
### Files
|
36
|
+
|
37
|
+
- task file:new [filename]: |
|
38
|
+
|
39
|
+
add smarter/configurable pattern matching
|
40
|
+
e.g. configure _controller.rb to use controller.erb template
|
41
|
+
|
42
|
+
(optional) opens files in text editor?
|
43
|
+
|
44
|
+
- task file:move [source] [target]: |
|
45
|
+
|
46
|
+
Alias as file:refactor?
|
47
|
+
|
48
|
+
#### Git
|
49
|
+
|
50
|
+
- task git:delete-merged
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
(The MIT License)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Rob Smith
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,405 @@
|
|
1
|
+
# SleepingKingStudios::Tasks [![Build Status](https://travis-ci.org/sleepingkingstudios/sleeping_king_studios-tasks.svg?branch=master)](https://travis-ci.org/sleepingkingstudios/sleeping_king_studios-tasks)
|
2
|
+
|
3
|
+
A toolkit providing an encapsulation layer around the Thor CLI library, with predefined tasks for development and continuous integration.
|
4
|
+
|
5
|
+
See also [https://github.com/erikhuda/thor](https://github.com/erikhuda/thor).
|
6
|
+
|
7
|
+
## Contribute
|
8
|
+
|
9
|
+
### GitHub
|
10
|
+
|
11
|
+
The canonical repository for this gem is on [GitHub](https://github.com/sleepingkingstudios/sleeping_king_studios-tasks).
|
12
|
+
|
13
|
+
### A Note From The Developer
|
14
|
+
|
15
|
+
Hi, I'm Rob Smith, a Ruby Engineer and the developer of this library. I use these tools every day, but they're not just written for me. If you find this project helpful in your own work, or if you have any questions, suggestions or critiques, please feel free to get in touch! I can be reached on GitHub (see above, and feel encouraged to submit bug reports or merge requests there) or via email at `merlin@sleepingkingstudios.com`. I look forward to hearing from you!
|
16
|
+
|
17
|
+
## Task Classes
|
18
|
+
|
19
|
+
SleepingKingStudios::Tasks defines a wrapper around the Thor CLI.
|
20
|
+
|
21
|
+
### SleepingKingStudios::Tasks::Task
|
22
|
+
|
23
|
+
A class for encapsulating an individual Thor task. Provides built-in support for setting Thor metadata (task name, description, and options) and for automatically silencing output.
|
24
|
+
|
25
|
+
class GreeterTask < SleepingKingStudios::Tasks::Task
|
26
|
+
def self.description
|
27
|
+
'Displays a cheery greeting!'
|
28
|
+
end # class method description
|
29
|
+
|
30
|
+
option :greeting,
|
31
|
+
:type => :String,
|
32
|
+
:default => 'Greetings',
|
33
|
+
:desc => 'The greeting to use.'
|
34
|
+
|
35
|
+
def call name
|
36
|
+
say "Greetings, #{name}!"
|
37
|
+
end # method call
|
38
|
+
end # class
|
39
|
+
|
40
|
+
GreeterTask.new({}).call('Alan')
|
41
|
+
#=> 'Greetings, Alan!'
|
42
|
+
|
43
|
+
GreeterTask.new('greeting' => 'Hello').call('Alan')
|
44
|
+
#=> 'Hello, Dave!'
|
45
|
+
|
46
|
+
Command line arguments are passed in to the `#call` method as arguments, and options are passed in to the constructor and are available as an `options` instance method.
|
47
|
+
|
48
|
+
#### Class Methods
|
49
|
+
|
50
|
+
##### `::description`
|
51
|
+
|
52
|
+
Sets the description of the Thor task, which is displayed when running `thor help [COMMAND]`.
|
53
|
+
|
54
|
+
##### `::option(option_name, option_params)`
|
55
|
+
|
56
|
+
Defines an option for the task. For more information on task options, see [https://github.com/erikhuda/thor/wiki/Method-Options](https://github.com/erikhuda/thor/wiki/Method-Options).
|
57
|
+
|
58
|
+
##### `::task_name`
|
59
|
+
|
60
|
+
Sets the default name of the Thor task, which is used to call the task from the command line or displayed when running `thor list`. Note that the task group (see below) can override or alias the task name. Defaults to the underscored, unqualified class name, with any Task suffix also removed.
|
61
|
+
|
62
|
+
GreeterTask.task_name
|
63
|
+
#=> 'greeter'
|
64
|
+
|
65
|
+
MyModule::DoSomethingTask.task_name
|
66
|
+
#=> 'do_something'
|
67
|
+
|
68
|
+
class TaskWithCustomName < SleepingKingStudios::Tasks::Task
|
69
|
+
def self.task_name
|
70
|
+
'custom_name'
|
71
|
+
end # class method task_name
|
72
|
+
end # class
|
73
|
+
TaskWithCustomName.task_name
|
74
|
+
#=> 'custom_name'
|
75
|
+
|
76
|
+
#### Instance Methods
|
77
|
+
|
78
|
+
##### `#call`
|
79
|
+
|
80
|
+
Executes the command. Can specify one or more arguments, which can be passed in from the command line.
|
81
|
+
|
82
|
+
##### `#options` (Private)
|
83
|
+
|
84
|
+
Exposes the options passed in from the command line in Hash format.
|
85
|
+
|
86
|
+
##### `#mute!` (Private)
|
87
|
+
|
88
|
+
Disables console output.
|
89
|
+
|
90
|
+
##### `#mute?` (Private) - Also `#muted?`
|
91
|
+
|
92
|
+
Checks if console output is disabled.
|
93
|
+
|
94
|
+
##### `#say` (Private)
|
95
|
+
|
96
|
+
Writes the given text to the console unless output is disabled.
|
97
|
+
|
98
|
+
### SleepingKingStudios::Tasks::TaskGroup
|
99
|
+
|
100
|
+
Exposes one or more tasks to the Thor interface.
|
101
|
+
|
102
|
+
class SayTasks < SleepingKingStudios::Tasks::TaskGroup
|
103
|
+
namespace :say
|
104
|
+
|
105
|
+
task GreeterTask, :as => 'greet'
|
106
|
+
end # class
|
107
|
+
|
108
|
+
thor say:greet Alan
|
109
|
+
#=> 'Greetings, Alan!'
|
110
|
+
|
111
|
+
#### Class Methods
|
112
|
+
|
113
|
+
##### `::namespace(name)`
|
114
|
+
|
115
|
+
Sets the namespace for the tasks in the group. For more information on namespaces, see [https://github.com/erikhuda/thor/wiki/Namespaces](https://github.com/erikhuda/thor/wiki/Namespaces).
|
116
|
+
|
117
|
+
##### `::task(definition, options = {})`
|
118
|
+
|
119
|
+
`param definition [Class]` A class that extends SleepingKingStudios::Task. When the task is called, an instance of the class will be created with the parsed command line options, and `#call` will be executed on the instance with the command line arguments (if any).
|
120
|
+
|
121
|
+
`option as [String]` The name of the task. If set, this overrides the `::task_name` method on the class.
|
122
|
+
|
123
|
+
Registers a task in the current namespace.
|
124
|
+
|
125
|
+
## Defined Tasks
|
126
|
+
|
127
|
+
SleepingKingStudios::Tasks also includes a set of predefined tasks for local development and continuous integration.
|
128
|
+
|
129
|
+
To include the predefined tasks, `load` (not `require`) the relevant files in your PROJECT_NAME.thor file at the root of your project directory.
|
130
|
+
|
131
|
+
### Configuration
|
132
|
+
|
133
|
+
SleepingKingStudios::Tasks has a number of configuration options, which can be set in your PROJECT_NAME.thor file.
|
134
|
+
|
135
|
+
require 'sleeping_king_studios/tasks'
|
136
|
+
|
137
|
+
SleepingKingStudios::Tasks.configure do |config|
|
138
|
+
config.ci do |ci|
|
139
|
+
ci.steps = %i(rspec cucumber)
|
140
|
+
end # ci
|
141
|
+
end # configure
|
142
|
+
|
143
|
+
The above code configures the `ci:steps` task to run the RSpec and Cucumber steps.
|
144
|
+
|
145
|
+
The following configuration options are defined:
|
146
|
+
|
147
|
+
`config.apps.ci.rspec [Hash]`: Step configuration for the RSpec step when running it across multiple applications (see Apps Tasks, below). All apps step configuration hashes have the same options:
|
148
|
+
|
149
|
+
- `class [String]`: The class defining the step task. Each app step task must take an application name and run the task for that application, unless the `global` option is set (see below). In either case, the step must return a results object.
|
150
|
+
- `require [String]`: The file path of the task for the step.
|
151
|
+
- `title [String]`: The title of the step, used in generating reports.
|
152
|
+
- `global [String]`: Defaults to false. If true, then the step applies to the entire repository, rather than to individual applications, and is added only to the Totals in the report.
|
153
|
+
|
154
|
+
`config.apps.ci.rubocop [Hash]`: Step configuration for the RuboCop step.
|
155
|
+
|
156
|
+
`config.apps.ci.simplecov [Hash]`: Step configuration for the RuboCop step.
|
157
|
+
|
158
|
+
`config.apps.ci.steps [Array]`: The names of the steps to run when calling `thor apps:ci:steps`. By default, the RSpec, RuboCop and SimpleCov steps are run.
|
159
|
+
|
160
|
+
`config.apps.config_file [String]`: The configuration file used to define the applications (see Apps Tasks, below). The default config file is 'applications.yml', in the root directory of your project.
|
161
|
+
|
162
|
+
`config.ci.cucumber [Hash]`: Step configuration for the Cucumber step. All ci step configuration hashes have the following options:
|
163
|
+
|
164
|
+
- `class [String]`: The class defining the step task. Each step task must take an optional list of files and run the task for matching files, or for all files relevant to that task if no files are specified. The step must return a results object.
|
165
|
+
- `require [String]`: The file path of the task for the step.
|
166
|
+
- `title [String]`: The title of the step, used in generating reports.
|
167
|
+
|
168
|
+
In addition, the cucumber step has the additional option:
|
169
|
+
|
170
|
+
- `default_files [Array]`: Files that are always loaded when running Cucumber, such as step definitions or support files. By default, this includes 'step_definitions.rb' and the 'step_definitions' directory inside 'features'.
|
171
|
+
|
172
|
+
`config.ci.rspec [Hash]`: Step configuration for the RSpec step. Has the same options as `config.ci.cucumber`, above, except for the aforementioned `default_files` option.
|
173
|
+
|
174
|
+
`config.ci.rspec_each [Hash]`: Step configuration for the RSpec Each step.
|
175
|
+
|
176
|
+
`config.ci.rubocop [Hash]`: Step configuration for the RuboCop step.
|
177
|
+
|
178
|
+
`config.ci.simplecov [Hash]`: Step configuration for the RuboCop step.
|
179
|
+
|
180
|
+
`config.ci.steps [Array]`: The names of the steps to run when calling `thor ci:steps`. By default, the RSpec, RuboCop and SimpleCov steps are run.
|
181
|
+
|
182
|
+
`config.file.template_paths`: The paths for templates to use in generating new files with the `thor file:new` command. Each template path is checked in order for a template matching the file to be created, and if a match is found the file is pregenerated using the given template, which is evaluated using `erubi`.
|
183
|
+
|
184
|
+
### Apps Tasks
|
185
|
+
|
186
|
+
load 'sleeping_king_studios/tasks/apps/bundle/tasks.thor'
|
187
|
+
|
188
|
+
load 'sleeping_king_studios/tasks/apps/ci/tasks.thor'
|
189
|
+
|
190
|
+
Tasks defined in SleepingKingStudios::Tasks::Apps are intended for a particular use case, namely a project where multiple "applications" (or more generally, self-contained groupings of code) are developed together in a single directory or repository. These tasks allow the developer to maintain separate environments, including different Gemfiles.
|
191
|
+
|
192
|
+
Tasks in the `apps:bundle` namespace provide support for multiple Gemfiles, running `bundler` tasks for each unique gemfile specified.
|
193
|
+
|
194
|
+
Tasks in the `apps:ci` namespace run CI actions for each application and generate a report on the results.
|
195
|
+
|
196
|
+
#### application.yml
|
197
|
+
|
198
|
+
Each of these tasks depends on a configuration file which defines the applications. By default, this file is located at the project root directory as 'applications.yml'; this can be changed in the configuration (see Configuration, above).
|
199
|
+
|
200
|
+
Here is a sample application.yml file:
|
201
|
+
|
202
|
+
my_gem-core: {}
|
203
|
+
my_gem-rails:
|
204
|
+
name: "Rails integration"
|
205
|
+
gemfile: "gemfiles/rails"
|
206
|
+
my_gem-sinatra:
|
207
|
+
name: "Sinatra integration"
|
208
|
+
gemfile: "gemfiles/sinatra"
|
209
|
+
my_gem-utilities:
|
210
|
+
source_files:
|
211
|
+
- lib/utils
|
212
|
+
spec_files:
|
213
|
+
- spec/utils
|
214
|
+
|
215
|
+
This file defines four applications - two core libraries and two integrations. Each of the integrations has a custom name set, which will be used when generating CI reports, and a gemfile, which allows those applications to have isolated environments with their own dependencies. The utilities application also specifies where the source and spec files for that application can be found.
|
216
|
+
|
217
|
+
The following options can be configured for each application:
|
218
|
+
|
219
|
+
`gemfile [String]` The gemfile used for the application. The `app:bundle` commands will install or upgrade the gems for each gemfile listed in applications.yml, and tasks for an application (including CI) will run using the specified bundle.
|
220
|
+
|
221
|
+
`name [String]` The name of the application; used in generating CI reports. Defaults to the application's key, e.g. 'my_gem-core' in the example above.
|
222
|
+
|
223
|
+
`source_files [Array]` A list of files and/or directories where the source code of the application is defined. By default, source files are expected in either apps/APP_NAME or lib/APP_NAME.
|
224
|
+
|
225
|
+
`spec_files [Array]` A list of directories where spec files for the application are defined. By default, spec files are expected either in apps/APP_NAME/spec or spec/APP_NAME.
|
226
|
+
|
227
|
+
#### Bundle - Install
|
228
|
+
|
229
|
+
thor apps:bundle:install
|
230
|
+
|
231
|
+
`param *applications [Array]` An optional array of application keys (see application.yml, above). If any applications are specified, the task will only run for the specified application or applications.
|
232
|
+
|
233
|
+
Equivalent to running `BUNDLE_GEMFILE=gemfile bundle install` for each unique gemfile in applications.yml.
|
234
|
+
|
235
|
+
#### Bundle - Update
|
236
|
+
|
237
|
+
thor apps:bundle:update
|
238
|
+
|
239
|
+
`param *applications [Array]` An optional array of application keys (see application.yml, above). If any applications are specified, the task will only run for the specified application or applications.
|
240
|
+
|
241
|
+
Equivalent to running `BUNDLE_GEMFILE=gemfile bundle update` for each unique gemfile in applications.yml.
|
242
|
+
|
243
|
+
#### Ci - RSpec
|
244
|
+
|
245
|
+
thor apps:ci:rspec
|
246
|
+
# Runs RSpec for each application.
|
247
|
+
|
248
|
+
`option --quiet [Boolean]` Suppress console output. Defaults to false.
|
249
|
+
|
250
|
+
`param *applications [Array]` An optional array of application keys (see application.yml, above). If any applications are specified, the task will only run for the specified application or applications.
|
251
|
+
|
252
|
+
Runs the RSpec suite for each specified application, using the Gemfile and spec files configured for that application, and generates a report listing the results for each application.
|
253
|
+
|
254
|
+
#### Ci - RuboCop
|
255
|
+
|
256
|
+
thor apps:ci:rubocop
|
257
|
+
# Runs RuboCop for each application.
|
258
|
+
|
259
|
+
`option --quiet [Boolean]` Suppress console output. Defaults to false.
|
260
|
+
|
261
|
+
`param *applications [Array]` An optional array of application keys (see application.yml, above). If any applications are specified, the task will only run for the specified application or applications.
|
262
|
+
|
263
|
+
Runs the RuboCop linter for each specified application, using the Gemfile and source and spec files configured for that application, and generates a report listing the results for each application.
|
264
|
+
|
265
|
+
#### Ci - SimpleCov
|
266
|
+
|
267
|
+
thor apps:ci:simplecov
|
268
|
+
|
269
|
+
Aggregates the most recent SimpleCov results and returns the results as a results object.
|
270
|
+
|
271
|
+
#### Ci - Steps
|
272
|
+
|
273
|
+
thor apps:ci:steps
|
274
|
+
# Runs each configured CI step for each application and generates a report.
|
275
|
+
|
276
|
+
`option --except [Array]` Skips the specified steps.
|
277
|
+
|
278
|
+
`option --only [Array]` Runs only the specified steps.
|
279
|
+
|
280
|
+
`option --quiet [Boolean]` If set, the results of each step will not be printed to the console.
|
281
|
+
|
282
|
+
`param *applications [Array]` An optional array of application keys (see application.yml, above). If any applications are specified, the task will only run for the specified application or applications.
|
283
|
+
|
284
|
+
Runs each configured CI step (see Configuration, above) and generates a report on the results of each step for each application, as well as an aggregate total. The task will exit with an error code if any of the steps returns a results object that identifies as failing, so this task can be used in a CI provider to aggregate the results of different steps into a pass/fail condition.
|
285
|
+
|
286
|
+
### Ci Tasks
|
287
|
+
|
288
|
+
load 'sleeping_king_studios/tasks/ci/tasks.thor'
|
289
|
+
|
290
|
+
Tasks defined in SleepingKingStudios::Tasks::Ci are designed to support continuous integration, encapsulating common testing requirements (running specs, linting, checking code coverage) with a common interface.
|
291
|
+
|
292
|
+
#### Cucumber
|
293
|
+
|
294
|
+
thor ci:cucumber
|
295
|
+
# Runs Cucumber on the entire feature suite.
|
296
|
+
|
297
|
+
thor ci:cucumber features/path/to/files
|
298
|
+
# Runs Cucumber for the features in features/path/to/files
|
299
|
+
|
300
|
+
`option --quiet [Boolean]` If set, the Cucumber results will not be printed to the console.
|
301
|
+
|
302
|
+
`option --raw [Boolean]` If true, the returned results will be in Hash format rather than a results object.
|
303
|
+
|
304
|
+
`param *files [Array]` An optional array of file paths. If any files or directories are given, Cucumber will run only the indicated features.
|
305
|
+
|
306
|
+
Runs the Cucumber feature suite and returns the results as either a results object or a Hash. If the `--quiet` option is not set, the results will also be printed to the console.
|
307
|
+
|
308
|
+
#### RSpec
|
309
|
+
|
310
|
+
thor ci:rspec
|
311
|
+
# Runs RSpec on the entire test suite.
|
312
|
+
|
313
|
+
thor ci:rspec spec/path/to/files
|
314
|
+
# Runs RSpec for the specs in spec/path/to/files
|
315
|
+
|
316
|
+
`option --coverage [Boolean]` Sets or clears the ENV['COVERAGE'] environment variable; configure your code coverage library to check for this variable. If the option is not set, then coverage is run by default if no file arguments are given (see below), and not run if any files are given, indicating that only part of the spec suite is to be run.
|
317
|
+
|
318
|
+
`option --gemfile [String]` The path to the gemfile to use when running the tests. If no gemfile is specified, will run the test with the gemfile at ENV['BUNDLE_GEMFILE'], which defaults to /Gemfile.
|
319
|
+
|
320
|
+
`option --quiet [Boolean]` If set, the RSpec results will not be printed to the console.
|
321
|
+
|
322
|
+
`option --raw [Boolean]` If true, the returned results will be in Hash format rather than a results object.
|
323
|
+
|
324
|
+
`param *files [Array]` An optional array of file paths. If any files or directories are given, RSpec will run only the indicated specs.
|
325
|
+
|
326
|
+
Runs the RSpec test suite and returns the results as either a results object or a Hash. If the `--quiet` option is not set, the results will also be printed to the console.
|
327
|
+
|
328
|
+
#### RSpec (Each)
|
329
|
+
|
330
|
+
thor ci:rspec_each
|
331
|
+
# Runs each spec file individually.
|
332
|
+
|
333
|
+
thor ci:rspec spec/path/to/files
|
334
|
+
# Runs each spec file in spec/path/to/files individually.
|
335
|
+
|
336
|
+
`option --quiet [Boolean]` If set, the results of each file will not be printed to the console.
|
337
|
+
|
338
|
+
`option --raw [Boolean]` If true, the returned results will be in Hash format rather than a results object.
|
339
|
+
|
340
|
+
`param *files [Array]` An optional array of file paths. If any files or directories are given, RSpec will run only the indicated specs.
|
341
|
+
|
342
|
+
For each spec file, runs the file in RSpec separately and aggregates the number of passing, pending, failing, and errored files. Running the files separately can expose issues, particularly around missing dependencies, and is recommended for gems or libraries.
|
343
|
+
|
344
|
+
#### RuboCop
|
345
|
+
|
346
|
+
thor ci:rubocop
|
347
|
+
# Runs the RuboCop linter.
|
348
|
+
|
349
|
+
thor ci:rubocop path/to/files
|
350
|
+
# Runs the RuboCop linter on the files at path/to/files.
|
351
|
+
|
352
|
+
`option --quiet [Boolean]` If set, the RuboCop results will not be printed to the console.
|
353
|
+
|
354
|
+
`option --raw [Boolean]` If true, the returned results will be in Hash format rather than a results object.
|
355
|
+
|
356
|
+
`param *files [Array]` An optional array of file paths. If any files or directories are given, RSpec will run only the indicated specs.
|
357
|
+
|
358
|
+
Runs the RuboCop linter and returns the results as either a results object or a Hash. If the `--quiet` option is not set, the results will also be printed to the console.
|
359
|
+
|
360
|
+
#### SimpleCov
|
361
|
+
|
362
|
+
thor ci:simplecov
|
363
|
+
# Retrieves the most recent SimpleCov results.
|
364
|
+
|
365
|
+
Retrieves the most recent SimpleCov results and returns the results as a results object.
|
366
|
+
|
367
|
+
#### Steps
|
368
|
+
|
369
|
+
thor ci:steps
|
370
|
+
# Runs each configured CI step and generates a report.
|
371
|
+
|
372
|
+
`option --except [Array]` Skips the specified steps.
|
373
|
+
|
374
|
+
`option --only [Array]` Runs only the specified steps.
|
375
|
+
|
376
|
+
`option --quiet [Boolean]` If set, the results of each step will not be printed to the console.
|
377
|
+
|
378
|
+
Runs each configured CI step (see Configuration, above) and generates a report on the results of each step. The task will exit with an error code if any of the steps returns a results object that identifies as failing, so this task can be used in a CI provider to aggregate the results of different steps into a pass/fail condition.
|
379
|
+
|
380
|
+
### File Tasks
|
381
|
+
|
382
|
+
load 'sleeping_king_studios/tasks/file/tasks.thor'
|
383
|
+
|
384
|
+
#### New
|
385
|
+
|
386
|
+
thor file:new lib/path/to/file.rb
|
387
|
+
# Creates a new Ruby file at lib/path/to/file.rb and spec/path/to/file_spec.rb
|
388
|
+
|
389
|
+
`option --dry-run [Boolean]` Lists the file(s) to create, but does not change the filesystem. Defaults to false.
|
390
|
+
|
391
|
+
`option --force [Boolean]` Overwrite the files if the files already exist. Defaults to false.
|
392
|
+
|
393
|
+
`option --prompt [Boolean]` Prompt the user for confirmation before creating the files. Defaults to false.
|
394
|
+
|
395
|
+
`option --quiet [Boolean]` Suppress console output. Defaults to false.
|
396
|
+
|
397
|
+
`option --spec [Boolean]` If set, a spec file will be automatically generated. Defaults to true. Use `--spec=false` or `--no-spec` to disable the spec file generation.
|
398
|
+
|
399
|
+
`option --verbose [Boolean]` If set, additional information will be printed to the console. Ignored if `--quiet` is set. Defaults to false.
|
400
|
+
|
401
|
+
`param file_path [String]` The path to the file to be created.
|
402
|
+
|
403
|
+
Creates a new file at the specified file path, generating any intermediate directories as needed. Unless the `--no-spec` option is set, also automatically creates a spec file in /spec with the same relative path, e.g. at /spec/path/to/file_spec.rb.
|
404
|
+
|
405
|
+
By default, uses the pregenerated templates which create an empty module definition and RSpec description with pending flag. You can specify an alternate template directory in the configuration (see Configuration, above).
|