psychic-runner 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/psychic +1 -1
- data/lib/psychic/cli.rb +0 -56
- data/lib/psychic/runner/cli.rb +62 -0
- data/lib/psychic/runner/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 966decba16f73cabfd0e9c5ec9b06264da9cff30
|
4
|
+
data.tar.gz: 124f2dda5812f6ef48ab04e626f0f1fc92a612e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2677291d81e7f08bf56415062a19f2b4eee25fdb3e8a539c2d4b5b84e1e1e8ab65470a5c2b137e91f5c5c3b4a91e550739f93ed077dac6e28776f5d5c006d265
|
7
|
+
data.tar.gz: 2528ceea531136d5b1e1125965fdb95e29a1074398a3f1fb32bc918ecf34066491c762f4ee16264195e35bda8fe144783898ff1d9a48deb6b21f77682f0db438
|
data/bin/psychic
CHANGED
data/lib/psychic/cli.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'English'
|
2
2
|
require 'thor'
|
3
|
-
require 'psychic/runner'
|
4
3
|
|
5
4
|
module Psychic
|
6
5
|
class CLI < Thor
|
@@ -24,60 +23,5 @@ module Psychic
|
|
24
23
|
self.class.extra_args
|
25
24
|
end
|
26
25
|
end
|
27
|
-
|
28
|
-
desc 'task <name>', 'Executes any task by name'
|
29
|
-
def task(task_name)
|
30
|
-
result = runner.execute_task(task_name, *extra_args)
|
31
|
-
result.error!
|
32
|
-
say_status :success, task_name
|
33
|
-
rescue Psychic::Shell::ExecutionError => e
|
34
|
-
say_status :failed, task_name, :red
|
35
|
-
say e.execution_result if e.execution_result
|
36
|
-
end
|
37
|
-
|
38
|
-
BUILT_IN_TASKS.each do |task_name|
|
39
|
-
desc task_name, "Executes the #{task_name} task"
|
40
|
-
define_method(task_name) do
|
41
|
-
task(task_name)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
desc 'sample <name>', 'Executes a code sample'
|
46
|
-
# rubocop:disable Metrics/LineLength
|
47
|
-
method_option :interactive, desc: 'Prompt for parameters?', enum: %w(always missing), lazy_default: 'missing'
|
48
|
-
method_option :parameters, desc: 'YAML file containing key/value parameters. Default: psychic-parameters.yaml'
|
49
|
-
method_option :parameter_mode, desc: 'How should the parameters be passed?', enum: %w(tokens arguments env)
|
50
|
-
method_option :dry_run, desc: 'Do not execute - just show what command would be run', lazy_default: true
|
51
|
-
# rubocop:enable Metrics/LineLength
|
52
|
-
def sample(*sample_names)
|
53
|
-
sample_names.each do | sample_name |
|
54
|
-
say_status :executing, sample_name
|
55
|
-
begin
|
56
|
-
run_sample sample_name
|
57
|
-
rescue Errno::ENOENT
|
58
|
-
say_status :failed, "No code sample found for #{sample_name}", :red
|
59
|
-
# TODO: Fail on missing? Fail fast?
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
private
|
65
|
-
|
66
|
-
def run_sample(sample_name)
|
67
|
-
result = runner.run_sample(sample_name, *extra_args)
|
68
|
-
if options.dry_run
|
69
|
-
say_status :dry_run, sample_name
|
70
|
-
else
|
71
|
-
result.error!
|
72
|
-
say_status :success, sample_name
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def runner
|
77
|
-
runner_opts = Util.symbolized_hash(options).merge(
|
78
|
-
cwd: Dir.pwd, cli: shell, parameters: options.parameters
|
79
|
-
)
|
80
|
-
@runner ||= Psychic::Runner.new(runner_opts)
|
81
|
-
end
|
82
26
|
end
|
83
27
|
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'psychic/runner'
|
2
|
+
|
3
|
+
module Psychic
|
4
|
+
module Runner
|
5
|
+
class CLI < Psychic::CLI
|
6
|
+
desc 'task <name>', 'Executes any task by name'
|
7
|
+
def task(task_name)
|
8
|
+
result = runner.execute_task(task_name, *extra_args)
|
9
|
+
result.error!
|
10
|
+
say_status :success, task_name
|
11
|
+
rescue Psychic::Shell::ExecutionError => e
|
12
|
+
say_status :failed, task_name, :red
|
13
|
+
say e.execution_result if e.execution_result
|
14
|
+
end
|
15
|
+
|
16
|
+
BUILT_IN_TASKS.each do |task_name|
|
17
|
+
desc task_name, "Executes the #{task_name} task"
|
18
|
+
define_method(task_name) do
|
19
|
+
task(task_name)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
desc 'sample <name>', 'Executes a code sample'
|
24
|
+
# rubocop:disable Metrics/LineLength
|
25
|
+
method_option :interactive, desc: 'Prompt for parameters?', enum: %w(always missing), lazy_default: 'missing'
|
26
|
+
method_option :parameters, desc: 'YAML file containing key/value parameters. Default: psychic-parameters.yaml'
|
27
|
+
method_option :parameter_mode, desc: 'How should the parameters be passed?', enum: %w(tokens arguments env)
|
28
|
+
method_option :dry_run, desc: 'Do not execute - just show what command would be run', lazy_default: true
|
29
|
+
# rubocop:enable Metrics/LineLength
|
30
|
+
def sample(*sample_names)
|
31
|
+
sample_names.each do | sample_name |
|
32
|
+
say_status :executing, sample_name
|
33
|
+
begin
|
34
|
+
run_sample sample_name
|
35
|
+
rescue Errno::ENOENT
|
36
|
+
say_status :failed, "No code sample found for #{sample_name}", :red
|
37
|
+
# TODO: Fail on missing? Fail fast?
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def run_sample(sample_name)
|
45
|
+
result = runner.run_sample(sample_name, *extra_args)
|
46
|
+
if options.dry_run
|
47
|
+
say_status :dry_run, sample_name
|
48
|
+
else
|
49
|
+
result.error!
|
50
|
+
say_status :success, sample_name
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def runner
|
55
|
+
runner_opts = Util.symbolized_hash(options).merge(
|
56
|
+
cwd: Dir.pwd, cli: shell, parameters: options.parameters
|
57
|
+
)
|
58
|
+
@runner ||= Psychic::Runner.new(runner_opts)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: psychic-runner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Lincoln
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -191,6 +191,7 @@ files:
|
|
191
191
|
- lib/psychic/logger.rb
|
192
192
|
- lib/psychic/runner.rb
|
193
193
|
- lib/psychic/runner/base_runner.rb
|
194
|
+
- lib/psychic/runner/cli.rb
|
194
195
|
- lib/psychic/runner/cold/shell_script_runner.rb
|
195
196
|
- lib/psychic/runner/cold_runner_registry.rb
|
196
197
|
- lib/psychic/runner/hot_runner.rb
|