omnitest-psychic 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.rspec +2 -0
- data/.rubocop.yml +5 -0
- data/.rubocop_todo.yml +36 -0
- data/.travis.yml +10 -0
- data/CONTRIBUTING.md +61 -0
- data/Gemfile +23 -0
- data/LICENSE.txt +22 -0
- data/README.md +234 -0
- data/Rakefile +12 -0
- data/appveyor.yml +9 -0
- data/bin/psychic +4 -0
- data/docs/code_samples.md +92 -0
- data/docs/index.md +128 -0
- data/lib/omnitest/output_helper.rb +84 -0
- data/lib/omnitest/psychic.rb +191 -0
- data/lib/omnitest/psychic/cli.rb +171 -0
- data/lib/omnitest/psychic/code2doc.rb +75 -0
- data/lib/omnitest/psychic/code2doc/code_helper.rb +122 -0
- data/lib/omnitest/psychic/code2doc/code_segmenter.rb +170 -0
- data/lib/omnitest/psychic/code2doc/comment_styles.rb +92 -0
- data/lib/omnitest/psychic/command_template.rb +35 -0
- data/lib/omnitest/psychic/error.rb +15 -0
- data/lib/omnitest/psychic/execution/default_strategy.rb +82 -0
- data/lib/omnitest/psychic/execution/env_strategy.rb +12 -0
- data/lib/omnitest/psychic/execution/flag_strategy.rb +14 -0
- data/lib/omnitest/psychic/execution/token_strategy.rb +68 -0
- data/lib/omnitest/psychic/factories/go_factories.rb +14 -0
- data/lib/omnitest/psychic/factories/hot_read_task_factory.rb +54 -0
- data/lib/omnitest/psychic/factories/java_factories.rb +81 -0
- data/lib/omnitest/psychic/factories/powershell_factories.rb +53 -0
- data/lib/omnitest/psychic/factories/ruby_factories.rb +56 -0
- data/lib/omnitest/psychic/factories/shell_factories.rb +89 -0
- data/lib/omnitest/psychic/factories/travis_factories.rb +33 -0
- data/lib/omnitest/psychic/factory_manager.rb +46 -0
- data/lib/omnitest/psychic/file_finder.rb +69 -0
- data/lib/omnitest/psychic/hints.rb +21 -0
- data/lib/omnitest/psychic/magic_task_factory.rb +98 -0
- data/lib/omnitest/psychic/script.rb +146 -0
- data/lib/omnitest/psychic/script_factory.rb +66 -0
- data/lib/omnitest/psychic/script_factory_manager.rb +24 -0
- data/lib/omnitest/psychic/script_runner.rb +45 -0
- data/lib/omnitest/psychic/task.rb +6 -0
- data/lib/omnitest/psychic/task_factory_manager.rb +19 -0
- data/lib/omnitest/psychic/task_runner.rb +30 -0
- data/lib/omnitest/psychic/tokens.rb +51 -0
- data/lib/omnitest/psychic/version.rb +5 -0
- data/lib/omnitest/psychic/workflow.rb +27 -0
- data/lib/omnitest/shell.rb +27 -0
- data/lib/omnitest/shell/buff_shellout_executor.rb +41 -0
- data/lib/omnitest/shell/execution_result.rb +61 -0
- data/lib/omnitest/shell/mixlib_shellout_executor.rb +66 -0
- data/mkdocs.yml +6 -0
- data/omnitest-psychic.gemspec +36 -0
- data/spec/fabricators/shell_fabricator.rb +9 -0
- data/spec/omnitest/psychic/code2doc/code_helper_spec.rb +123 -0
- data/spec/omnitest/psychic/execution/default_strategy_spec.rb +17 -0
- data/spec/omnitest/psychic/execution/env_strategy_spec.rb +17 -0
- data/spec/omnitest/psychic/execution/flag_strategy_spec.rb +26 -0
- data/spec/omnitest/psychic/execution/token_strategy_spec.rb +26 -0
- data/spec/omnitest/psychic/factories/java_factories_spec.rb +35 -0
- data/spec/omnitest/psychic/factories/powershell_factories_spec.rb +59 -0
- data/spec/omnitest/psychic/factories/ruby_factories_spec.rb +91 -0
- data/spec/omnitest/psychic/factories/shell_factories_spec.rb +79 -0
- data/spec/omnitest/psychic/factories/travis_factories_spec.rb +78 -0
- data/spec/omnitest/psychic/hot_read_task_factory_spec.rb +51 -0
- data/spec/omnitest/psychic/script_factory_manager_spec.rb +57 -0
- data/spec/omnitest/psychic/script_spec.rb +55 -0
- data/spec/omnitest/psychic/shell_spec.rb +68 -0
- data/spec/omnitest/psychic/workflow_spec.rb +46 -0
- data/spec/omnitest/psychic_spec.rb +170 -0
- data/spec/spec_helper.rb +52 -0
- metadata +352 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8a05adea6b9f3d8d88806abfe6604e963d2f51b5
|
4
|
+
data.tar.gz: 799f6663d4c7fd015559ba0d312cb5c84276a8de
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f1079d6dc3261791a67d03466bcf1a8bc5a1baed51869e1933434471bdcdda217aba2a234fe1a3e645b814b8d2fc77ffa953a72ad4af6d29e72a9c8318d654ad
|
7
|
+
data.tar.gz: a2097f3c4f04a6463ca02b4081fbb93f7d514197a8784a8b5c4bda4247cf820119294e8632a0605d906c3b35f17a1ec4e2dd6676431af40c79e0705293fce5cf
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# This configuration was generated by `rubocop --auto-gen-config`
|
2
|
+
# on 2015-02-12 11:21:09 -0500 using RuboCop version 0.27.0.
|
3
|
+
# The point is for the user to remove these configuration records
|
4
|
+
# one by one as the offenses are removed from the code base.
|
5
|
+
# Note that changes in the inspected code, or installation of new
|
6
|
+
# versions of RuboCop, may require this file to be generated again.
|
7
|
+
|
8
|
+
# Offense count: 2
|
9
|
+
Lint/AmbiguousOperator:
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
# Offense count: 2
|
13
|
+
Lint/UselessAssignment:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
# Offense count: 3
|
17
|
+
Metrics/AbcSize:
|
18
|
+
Max: 24
|
19
|
+
|
20
|
+
# Offense count: 121
|
21
|
+
# Configuration parameters: AllowURI, URISchemes.
|
22
|
+
Metrics/LineLength:
|
23
|
+
Max: 134
|
24
|
+
|
25
|
+
# Offense count: 73
|
26
|
+
Style/Documentation:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
# Offense count: 3
|
30
|
+
# Configuration parameters: MinBodyLength.
|
31
|
+
Style/GuardClause:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
# Offense count: 3
|
35
|
+
Style/RegexpLiteral:
|
36
|
+
MaxSlashes: 0
|
data/.travis.yml
ADDED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
## Adding support for new task tools
|
4
|
+
|
5
|
+
It's fairly easy to contribute support for new task runners to Psychic. Most can be implemented using the `MagicTaskFactory` class, which will look for a magic file to indicate a certain tool is being used, and then simply maps the tasks.
|
6
|
+
|
7
|
+
Here's an example for Gradle:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
class GradleFactory < MagicTaskFactory
|
11
|
+
TASK_PRIORITY = 6
|
12
|
+
magic_file 'build.gradle'
|
13
|
+
register_task_factory
|
14
|
+
|
15
|
+
task :compile do
|
16
|
+
'gradle assemble'
|
17
|
+
end
|
18
|
+
|
19
|
+
task :unit do
|
20
|
+
'gradle test'
|
21
|
+
end
|
22
|
+
|
23
|
+
task :integration do
|
24
|
+
'gradle check'
|
25
|
+
end
|
26
|
+
|
27
|
+
task :bootstrap do
|
28
|
+
# This is for projects using the maven plugin, may need to detect available
|
29
|
+
# tasks w/ gradle install first
|
30
|
+
'gradle install'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
```
|
34
|
+
|
35
|
+
You can also override or implement your own class with the `#active?`, `#priority_for_task(task)`, `#known_tasks` and `#task(alias)` methods. See the API documentation details.
|
36
|
+
|
37
|
+
## Adding support for new types of scripts
|
38
|
+
|
39
|
+
Adding support for different types of scripts is also fairly easy. You can either implement the methods `#active?`, `#known_scripts`, `#priority_for_script(script_object)` and `#script(script_object)`, or you can subclass from ScriptFactory and in which case you'll just need to define the patterns the class runs and the `#script(script_object)` method. Here's an example for running Java classes:
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
class RubyFactory < ScriptFactory
|
43
|
+
register_script_factory
|
44
|
+
runs '**.rb', 8
|
45
|
+
|
46
|
+
def script(_script)
|
47
|
+
cmd = bundler_active? ? 'bundle exec ' : ''
|
48
|
+
cmd << 'ruby {{script_file}}'
|
49
|
+
end
|
50
|
+
|
51
|
+
protected
|
52
|
+
|
53
|
+
def bundler_active?
|
54
|
+
psychic.task_factory_manager.active? BundlerTaskFactory
|
55
|
+
end
|
56
|
+
end
|
57
|
+
```
|
58
|
+
|
59
|
+
## Other
|
60
|
+
|
61
|
+
If you're interested in adding other features or support for other types of tools, please just create an issue on GitHub and we'll help you figure out the best way to proceed.
|
data/Gemfile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
# This hack inspired by rspec...
|
6
|
+
branch = begin
|
7
|
+
File.read(File.expand_path('../maintenance-branch', __FILE__)).chomp
|
8
|
+
rescue
|
9
|
+
'master'
|
10
|
+
end
|
11
|
+
|
12
|
+
%w(omnitest-core).each do |lib|
|
13
|
+
library_path = File.expand_path("../../#{lib}", __FILE__)
|
14
|
+
gem_name = lib.start_with?('omnitest') ? lib : "omnitest-#{lib}"
|
15
|
+
if File.exist?(library_path) && !ENV['USE_GIT_REPOS']
|
16
|
+
gem gem_name, path: library_path
|
17
|
+
else
|
18
|
+
gem gem_name, git: "git://github.com/omnitest/#{lib}.git", branch: branch
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
gem 'pry'
|
23
|
+
gem 'rouge'
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Max Lincoln
|
2
|
+
|
3
|
+
MIT License
|
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
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,234 @@
|
|
1
|
+
# Psychic
|
2
|
+
|
3
|
+
Psychic is a universal aliasing system for tasks and scripts. It provides a command-line tool to give humans easy-to-remember aliases for running tasks, and a API to give machines a standard way to interact with tasks and scripts across many projects.
|
4
|
+
|
5
|
+
It is part of the [Omnitest](https://github.com/omnitest/omnitest) suite of tools.
|
6
|
+
|
7
|
+
## Warning
|
8
|
+
|
9
|
+
Psychic is still pre-1.0 software that has **no** backwards compatibility guarantees until
|
10
|
+
the 1.0 release occurs!
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Psychic is installed as a gem. It's recommended that you install it with bunder. Add this to
|
15
|
+
you Gemfile:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem 'omnitest-psychic'
|
19
|
+
```
|
20
|
+
|
21
|
+
And run `bundle install`.
|
22
|
+
|
23
|
+
## Detection and Hints
|
24
|
+
|
25
|
+
Psychic itself is not a tool for implementing tasks, it's just a tool for detecting and aliasing
|
26
|
+
tasks and scripts that are handled by other tools. This is useful if you're dealing with a set of
|
27
|
+
projects and want to be able to use the same command alises for similar tasks, even if the actual
|
28
|
+
command to run the task differs.
|
29
|
+
|
30
|
+
This is similar to the approach taken by many CI systems, which map commands to stages of a lifecycle
|
31
|
+
and attempt to automatically detect appropriate commands if they are not explicitly mapped. The
|
32
|
+
[travis-build](https://github.com/travis-ci/travis-build) project is an example of this. It gives you
|
33
|
+
commands like `travis run install`, which will run the install commands for the project. Those commands
|
34
|
+
may be specified in your `travis.yml`, but if they aren't than it will examine your project and attempt
|
35
|
+
to choose an appropriate install command.
|
36
|
+
|
37
|
+
Psychic is similar. It will first look in `psychic.yaml` to see if you have explicitly mapped an alias to a command, and then it will look examine your project and attempt to infer an appropriate command. What makes Psychic different than travis-build is that it's designed as a more generic, standalone tool and API. It aims to detect and use the same idiomatic tools as Travis, but it is easier to install and use, does not perform optimizations that are appropriate on CI servers but may surprise developers, and offers some features that are useful in development environments but not on CI servers (like the `--interactive` mode).
|
38
|
+
|
39
|
+
## API
|
40
|
+
|
41
|
+
Psychic has a simple API. You simply create a Psychic instance and then ask it for tasks or scripts:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
psychic = Omnitest::Psychic.new
|
45
|
+
|
46
|
+
# Find and execute the bootstrap task
|
47
|
+
psychic.task('bootstrap').execute
|
48
|
+
|
49
|
+
# Find a runner and execute a specific script
|
50
|
+
# Psychic will figure out if it needs to do things
|
51
|
+
# like run `bundle exec` or `javac`.
|
52
|
+
psychic.script('samples/quine.rb').execute
|
53
|
+
|
54
|
+
# You can also find scripts by alias or by loosely matching
|
55
|
+
# the name.
|
56
|
+
psychic.script('hello world').source_file
|
57
|
+
# => 'src/main/java/HelloWorld.java'
|
58
|
+
```
|
59
|
+
|
60
|
+
See the full [API Documentation](http://www.rubydoc.info/github/omnitest/psychic) for more.
|
61
|
+
|
62
|
+
## CLI Usage
|
63
|
+
|
64
|
+
It's easy to list the available commands:
|
65
|
+
|
66
|
+
```
|
67
|
+
$ bundle exec psychic help
|
68
|
+
Scripts commands:
|
69
|
+
psychic bootstrap # Executes the bootstrap task
|
70
|
+
psychic help [COMMAND] # Describe available commands or one specific command
|
71
|
+
psychic list # List known tasks or scripts
|
72
|
+
psychic script <name> # Executes a script
|
73
|
+
psychic show # Show details about a task or script
|
74
|
+
psychic task <name> # Executes any task by name
|
75
|
+
```
|
76
|
+
|
77
|
+
### Tasks
|
78
|
+
|
79
|
+
It's easy to print or run a task:
|
80
|
+
|
81
|
+
```
|
82
|
+
$ bundle exec psychic bootstrap --print
|
83
|
+
bundle install
|
84
|
+
|
85
|
+
$ bundle exec psychic bootstrap
|
86
|
+
I, [2015-01-30T14:28:06.940072 #39505] INFO -- : Executing: bundle install
|
87
|
+
I, [2015-01-30T14:28:07.745404 #39505] INFO -- : Resolving dependencies...
|
88
|
+
I, [2015-01-30T14:28:07.749574 #39505] INFO -- : Using ast 2.0.0
|
89
|
+
I, [2015-01-30T14:28:07.749677 #39505] INFO -- : Using parser 2.2.0.2
|
90
|
+
I, [2015-01-30T14:28:07.749709 #39505] INFO -- : Using astrolabe 1.3.0
|
91
|
+
...
|
92
|
+
I, [2015-01-30T14:28:07.939301 #39505] INFO -- : Your bundle is complete!
|
93
|
+
I, [2015-01-30T14:28:07.939427 #39505] INFO -- : Use `bundle show [gemname]` to see where a bundled gem is installed.
|
94
|
+
```
|
95
|
+
|
96
|
+
#### Custom tasks
|
97
|
+
|
98
|
+
There are built-in aliases that correspond to common commands in a CI lifecycle, like `bootstrap` above. Psychic will usually find an appropriate command for these tasks in any project.
|
99
|
+
|
100
|
+
Psychic can also custom tasks that are not part of the default CI lifecycle and may not even exist in all projects. This could be anything from a fairly common name like `lint`, to something like `generate_report_for_my_boss`.
|
101
|
+
|
102
|
+
You can run these with the `psychic task <name>` command:
|
103
|
+
```
|
104
|
+
~/ruby $ bundle exec psychic task lint --print
|
105
|
+
bundle exec rubocop -D
|
106
|
+
|
107
|
+
~/java $ bundle exec psychic task lint --print
|
108
|
+
gradle checkstyleMain
|
109
|
+
|
110
|
+
~/python $ bundle exec psychic task lint --print
|
111
|
+
./scripts/lint.sh
|
112
|
+
```
|
113
|
+
|
114
|
+
#### travis-build integration
|
115
|
+
|
116
|
+
Psychic can delegate tasks that correspond to the travis lifecycle to travis-build if it is installed. This isn't enabled by default, because the travis-build uses optimizations for running on CI servers that could cause confusion in developer environments, like using sticky bundler flags like `--deployment`.
|
117
|
+
|
118
|
+
If you the working directory contains a .travis.yml file and you have travis-build installed you can delegate to it with the `--travis` option:
|
119
|
+
|
120
|
+
```
|
121
|
+
$ bundle exec psychic task bootstrap --print --travis
|
122
|
+
travis run --skip-version-check install
|
123
|
+
```
|
124
|
+
|
125
|
+
#### scripts/* integraiton
|
126
|
+
|
127
|
+
ThoughtBot, GitHub and others use a [bootstrap consistency pattern](http://wynnnetherland.com/linked/2013012801/bootstrapping-consistency) to provide "a consistent user experience to get from zero to productive on any new project". The scripts used vary but common examples are:
|
128
|
+
- Bootstrapping via `bin/setup` or `script/bootstrap`
|
129
|
+
- Running tests via `script/test` and/or `script/cibuild`
|
130
|
+
|
131
|
+
Psychic has built-in support for these patterns, and will automatically map anything in scripts/* to a task alias. It will also select a platform appropriate script, like `bootstrap.sh` for Linux and `bootstrap.ps` for Windows.
|
132
|
+
|
133
|
+
### Scripts
|
134
|
+
|
135
|
+
Psychic also supports running scripts, including ones that require input. You just use the `script` command, along with either the path to a script, or an alias for a script. This is useful for running code samples that are implemented in multiple languages:
|
136
|
+
|
137
|
+
```
|
138
|
+
~/java $ bundle exec psychic script src/main/java/HelloWorld.java
|
139
|
+
I, [2015-01-30T15:01:44.417646 #42722] INFO -- : Executing: ./scripts/run_script.sh src/main/java/HelloWorld.java
|
140
|
+
I, [2015-01-30T15:01:53.231440 #42722] INFO -- : Hello, world!
|
141
|
+
|
142
|
+
~/java $ bundle exec psychic script "hello world"
|
143
|
+
I, [2015-01-30T15:00:32.099182 #42637] INFO -- : Executing: ./scripts/run_script.sh src/main/java/HelloWorld.java
|
144
|
+
I, [2015-01-30T15:00:43.497285 #42637] INFO -- : Hello, world!
|
145
|
+
|
146
|
+
~/ruby $ bundle exec psychic script "hello world"
|
147
|
+
I, [2015-01-30T14:59:40.349071 #42524] INFO -- : Executing: bundle exec ruby katas/hello_world.rb
|
148
|
+
I, [2015-01-30T14:59:42.750909 #42524] INFO -- : Hello, world!
|
149
|
+
```
|
150
|
+
|
151
|
+
#### Input
|
152
|
+
|
153
|
+
Work in progress! This describes a feature that is still under development. This section describes the plan for handling input, but these strategies are not all implemented yet.
|
154
|
+
|
155
|
+
Psychic can bind key/value pairs to input for scripts. There are a few strategies planned for mapping input:
|
156
|
+
- Passing them as environment variables
|
157
|
+
- Passing them as key-value parameters to the command (e.g. `--foo=bar`)
|
158
|
+
- Performing a token-replacement on a script with [Mustache](mustache.github.io) style templates
|
159
|
+
- Passing as positional arguments to scripts with a templated command in `psychic.yaml`
|
160
|
+
|
161
|
+
The command `psychic show script` will show you what tokens have been detected for a script:
|
162
|
+
|
163
|
+
```
|
164
|
+
$ bundle exec psychic show script "create server"
|
165
|
+
Script Name: create server
|
166
|
+
Tokens:
|
167
|
+
- authUrl
|
168
|
+
- username
|
169
|
+
- apiKey
|
170
|
+
- region
|
171
|
+
- serverName
|
172
|
+
- imageId
|
173
|
+
- flavorId
|
174
|
+
Source File: Compute/create_server.php
|
175
|
+
```
|
176
|
+
|
177
|
+
#### Interactive Mode
|
178
|
+
|
179
|
+
You can run scripts interactive mode with the `--interactive` flag. Psychic will prompt you to provide values for input tokens. If you just the use the `--interactive` flag than it will prompt you for values that are not assigned a value. If you use `--interactive=always` then it will ask you to confirm or overwrite existing values as well:
|
180
|
+
|
181
|
+
```
|
182
|
+
$ bundle exec psychic script "create server" --interactive=always
|
183
|
+
Please set a value for authUrl: http://localhost:5000/
|
184
|
+
Please set a value for username (or enter to confirm "my_user"):
|
185
|
+
Please set a value for apiKey (or enter to confirm "1234abcd"):
|
186
|
+
Please set a value for region (or enter to confirm "ORD"):
|
187
|
+
Please set a value for serverName (or enter to confirm "my_server"):
|
188
|
+
Please set a value for imageId (or enter to confirm 45678):
|
189
|
+
Please set a value for flavorId (or enter to confirm 12345):
|
190
|
+
Executing: php Compute/create_server.php
|
191
|
+
```
|
192
|
+
|
193
|
+
#### Additional command-line arguments and parameters
|
194
|
+
|
195
|
+
You can also pass additional arguments to your the task or script that Psychic is going to run. This is generally a bad idea Psychic doesn't standardize the flags so the commands will no longer be portable, but it can be useful for passing simple flags like `--debug` or `--verbose`.
|
196
|
+
|
197
|
+
You use the end of options delimiter (` -- `) to mark the end of arguments that should be parsed by Psychic and the beginning of what should be passed, as-is, to the command Psychic invokes:
|
198
|
+
|
199
|
+
```
|
200
|
+
# Task without additional arguments
|
201
|
+
~/ruby $ bundle exec psychic task lint
|
202
|
+
I, [2015-01-30T17:21:10.564551 #46122] INFO -- : Executing: bundle exec rubocop -D
|
203
|
+
|
204
|
+
# Task plus the --help flag
|
205
|
+
$ bundle exec psychic task lint -- --help
|
206
|
+
I, [2015-01-30T17:24:40.084622 #46319] INFO -- : Executing: bundle exec rubocop -D --help
|
207
|
+
I, [2015-01-30T17:24:41.035289 #46319] INFO -- : warning: parser/current is loading parser/ruby21, which recognizes
|
208
|
+
I, [2015-01-30T17:24:41.035395 #46319] INFO -- : warning: 2.1.5-compliant syntax, but you are running 2.1.4.
|
209
|
+
I, [2015-01-30T17:24:41.359328 #46319] INFO -- : Usage: rubocop [options] [file1, file2, ...]
|
210
|
+
I, [2015-01-30T17:24:41.359413 #46319] INFO -- : --only [COP1,COP2,...] Run only the given cop(s).
|
211
|
+
I, [2015-01-30T17:24:41.359449 #46319] INFO -- : --only-guide-cops Run only cops for rules that link to a
|
212
|
+
I, [2015-01-30T17:24:41.359478 #46319] INFO -- : style guide.
|
213
|
+
...
|
214
|
+
```
|
215
|
+
|
216
|
+
## Acknowledgements
|
217
|
+
|
218
|
+
Portions of the Omnitest projects were based on [rocco](https://github.com/rtomayko/rocco) projects, which was a port of [docco](https://github.com/jashkenas/docco).
|
219
|
+
|
220
|
+
A lot of code, and the style of the CLI tools, are based on heavily modified code adapted from [test-kitchen](https://github.com/test-kitchen/test-kitchen).
|
221
|
+
|
222
|
+
## Related projects
|
223
|
+
|
224
|
+
### Skeptic
|
225
|
+
|
226
|
+
The [Skeptic](https://github.com/omnitest/skeptic) project is a companion to Psychic that tests the uses Psychic's script runner to test sample code. It captures and validates the output the exit code and output of the process, but can also capture additional data through "spies" like looking for HTTP calls it expects to see or files that should be created. So it let's you write assertions and reports on the behavior of code that's executed via Psychic.
|
227
|
+
|
228
|
+
### Omnitest
|
229
|
+
|
230
|
+
The [omnitest](https://github.com/omnitest/omnitest) project is for running tasks or tests across multiple projects. It uses Psychic (and Skeptic) in order to run the task in teach project, and then consolidates all of the results and produces reports.
|
231
|
+
|
232
|
+
## Contributing
|
233
|
+
|
234
|
+
It's easy to add most task runners to Psychic, we just need you to map the commands. See [CONTRIBUTING.md](CONTRIBUTING.md) for more details.
|
data/Rakefile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rubocop/rake_task'
|
3
|
+
require 'rake/notes/rake_task'
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
|
6
|
+
task default: [:spec, :rubocop, :notes]
|
7
|
+
|
8
|
+
RSpec::Core::RakeTask.new('spec')
|
9
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
10
|
+
# abort rake on failure
|
11
|
+
task.fail_on_error = true
|
12
|
+
end
|
data/appveyor.yml
ADDED
data/bin/psychic
ADDED