command_butler 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +55 -7
- data/images/command_butler_replace_val.gif +0 -0
- data/images/command_butler_set_val.gif +0 -0
- data/images/command_butler_simple.gif +0 -0
- data/lib/command_butler/mediator.rb +3 -1
- data/lib/command_butler/version.rb +1 -1
- data/sample/{replace.yml → set_val.yml} +1 -1
- data/sample/simple_commands.yml +3 -0
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b859e972ac2e9e5adafcfadf449d89f2d9aba39e
|
4
|
+
data.tar.gz: 6f516e589dcaeadab126bac65a055dafb52badc6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9701166cf9f326ae13f87db5806a097bfce65e9afa713d6947099e9e153410d63a07dfe3baa69f018b5139792964264cce9c025def276cee03d7d228a426a2ef
|
7
|
+
data.tar.gz: 85f57574c83c9b7951d23a60f03834e445711741bd844f0676de82343f690eee3cb47e1b923482ebb0a4522af7785610286cefb89c7bab6261e557a81a911fa1
|
data/README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
#
|
1
|
+
# CommandButler
|
2
2
|
|
3
|
-
|
3
|
+
It is a gem that will continue to run the command that was written to a file interactively
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
|
-
gem '
|
9
|
+
gem 'command_butler'
|
10
10
|
|
11
11
|
And then execute:
|
12
12
|
|
@@ -14,16 +14,64 @@ And then execute:
|
|
14
14
|
|
15
15
|
Or install it yourself as:
|
16
16
|
|
17
|
-
$ gem install
|
17
|
+
$ gem install command_butler
|
18
18
|
|
19
|
-
## Usage
|
19
|
+
## Usage
|
20
|
+
Create a file wrote the run command. format is yml
|
21
|
+
### command execution only
|
22
|
+
$ command_butler execute sample/simple_commands.yml
|
23
|
+
|
24
|
+
![Alt Text](https://raw.githubusercontent.com/motsat/command_butler/master/images/command_butler_simple.gif)
|
25
|
+
|
26
|
+
### replace value in the command result
|
27
|
+
$ command_butler execute sample/set_val.yml
|
28
|
+
|
29
|
+
![Alt Text](https://raw.githubusercontent.com/motsat/command_butler/master/images/command_butler_set_val.gif)
|
30
|
+
|
31
|
+
### replace value in the configuration file
|
32
|
+
|
33
|
+
$ command_butler execute sample/replace_with_valfile.yml
|
34
|
+
$ --val_file=sample/val_file/station.yml
|
35
|
+
$
|
36
|
+
|
37
|
+
![Alt Text](https://raw.githubusercontent.com/motsat/command_butler/master/images/command_butler_replace_val.gif)
|
38
|
+
|
39
|
+
## Configuration File
|
40
|
+
format : yaml
|
41
|
+
|
42
|
+
define a single command in an array of YAML
|
43
|
+
|
44
|
+
[yml]
|
45
|
+
- pwd
|
46
|
+
- echo 'Hellow World'
|
47
|
+
- ls -al
|
48
|
+
|
49
|
+
Change of directory is not a cd command to define the Chdir
|
50
|
+
|
51
|
+
[yml]
|
52
|
+
- pwd
|
53
|
+
-
|
54
|
+
chdir: /Users
|
55
|
+
- pwd
|
56
|
+
|
57
|
+
can use the results to standard output as a parameter
|
58
|
+
That you use the "set" command
|
59
|
+
set the parameter name is optional . And parameter names , to match a character string in the command to be replaced
|
60
|
+
|
61
|
+
[yml]
|
62
|
+
|
63
|
+
-
|
64
|
+
command: date
|
65
|
+
set_val: $DATE_VALUE
|
66
|
+
- echo $DATE_VALUE
|
20
67
|
|
21
|
-
TODO: Write usage instructions here
|
22
68
|
|
23
69
|
## Contributing
|
24
70
|
|
25
|
-
1. Fork it ( https://github.com/
|
71
|
+
1. Fork it ( https://github.com/motsat/command_butler/fork )
|
26
72
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
73
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
74
|
4. Push to the branch (`git push origin my-new-feature`)
|
29
75
|
5. Create a new Pull Request
|
76
|
+
|
77
|
+
|
Binary file
|
Binary file
|
Binary file
|
@@ -41,6 +41,9 @@ module CommandButler
|
|
41
41
|
exit 1 if input.abort?
|
42
42
|
jump_index = (input.input_value - 1) if input.jump?
|
43
43
|
histories[index] = {input: input}
|
44
|
+
|
45
|
+
Dir.chdir(command.chdir) if command.chdir
|
46
|
+
|
44
47
|
if input.execute? && command.command
|
45
48
|
stdout, stderr, status = execute_command(command:command, index:index)
|
46
49
|
histories[index][:result] = {stdout:stdout, stderr: stderr, status: status}
|
@@ -50,7 +53,6 @@ module CommandButler
|
|
50
53
|
end
|
51
54
|
|
52
55
|
def execute_command(command:command, index:index)
|
53
|
-
Dir.chdir(command.chdir) if command.chdir
|
54
56
|
return unless command.command
|
55
57
|
|
56
58
|
# set_valコマンドの時は標準出力を取りたいのでopen3で実行
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: command_butler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- motsat
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -95,6 +95,9 @@ files:
|
|
95
95
|
- Rakefile
|
96
96
|
- bin/command_butler
|
97
97
|
- command_butler.gemspec
|
98
|
+
- images/command_butler_replace_val.gif
|
99
|
+
- images/command_butler_set_val.gif
|
100
|
+
- images/command_butler_simple.gif
|
98
101
|
- lib/command_butler.rb
|
99
102
|
- lib/command_butler/command.rb
|
100
103
|
- lib/command_butler/command_object.rb
|
@@ -110,8 +113,9 @@ files:
|
|
110
113
|
- lib/command_butler/val_parser.rb
|
111
114
|
- lib/command_butler/version.rb
|
112
115
|
- sample/com.yml
|
113
|
-
- sample/replace.yml
|
114
116
|
- sample/replace_with_valfile.yml
|
117
|
+
- sample/set_val.yml
|
118
|
+
- sample/simple_commands.yml
|
115
119
|
- sample/val_file/station.yml
|
116
120
|
- spec/command_butler_spec.rb
|
117
121
|
- spec/command_object_spec.rb
|