carrasco 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.carrasco.yml +6 -2
- data/README.md +4 -3
- data/lib/carrasco/command.rb +2 -1
- data/lib/carrasco/command_builder.rb +1 -3
- data/lib/carrasco/command_executer.rb +17 -0
- data/lib/carrasco/thor.rb +19 -0
- data/lib/carrasco/version.rb +1 -1
- data/lib/carrasco.rb +2 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbf7a3497241483dd63b3040a8e31a26f4a808a7
|
4
|
+
data.tar.gz: 2b648b49eb838a6eb907fee38160dc1ff155115b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 022fdb6cdbaf7356029be6eb064b973be7971214cd7c7a4ba8e635051338e80784cc7a82d214208c21e4162e9afa006d56878aa40712d2d90b5e9c3e7b8f3980
|
7
|
+
data.tar.gz: c9dff8824189cc55ded4b491e2658151efe6c447d981e935391eb0550b900cec9c27e46b3d7db91985b6ffce94c7c8ed58dea0e3db7a779296564fbe623ed8ad
|
data/.carrasco.yml
CHANGED
@@ -11,8 +11,12 @@ commands:
|
|
11
11
|
command: ./bin/vendor/phpunit --configuration=tests/phpunit.xml
|
12
12
|
|
13
13
|
ls:
|
14
|
-
description: List tmp
|
15
|
-
command: ls /tmp
|
14
|
+
description: List /tmp folder
|
15
|
+
command: ls /tmp
|
16
|
+
|
17
|
+
ls_with_error:
|
18
|
+
description: list folder that does not exist
|
19
|
+
command: ls /tmp/file_that_does_not_exist
|
16
20
|
|
17
21
|
# to be implemented
|
18
22
|
groups:
|
data/README.md
CHANGED
@@ -56,9 +56,10 @@ groups:
|
|
56
56
|
You can execute:
|
57
57
|
|
58
58
|
```bash
|
59
|
-
carrasco
|
60
|
-
carrasco
|
61
|
-
carrasco
|
59
|
+
bundle exec carrasco # list commands
|
60
|
+
bundle exec carrasco all # all your tasks
|
61
|
+
bundle exec carrasco phpunit # phpunit only
|
62
|
+
bundle exec carrasco qa # all qa scripts
|
62
63
|
```
|
63
64
|
|
64
65
|
## Development
|
data/lib/carrasco/command.rb
CHANGED
@@ -3,11 +3,12 @@ require "thor/core_ext/hash_with_indifferent_access"
|
|
3
3
|
module Carrasco
|
4
4
|
class Command
|
5
5
|
attr_reader :command_name, :command, :description, :help
|
6
|
+
alias_method :to_s, :command
|
6
7
|
|
7
8
|
def initialize(command_name, options = {})
|
8
9
|
options = Thor::CoreExt::HashWithIndifferentAccess.new(options)
|
9
10
|
@command_name = command_name
|
10
|
-
@command = options[:command]
|
11
|
+
@command = options[:command] || command_name
|
11
12
|
@help = options[:help] || command_name
|
12
13
|
@description = options[:description] || "description not given"
|
13
14
|
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require "thor"
|
2
|
-
|
3
1
|
module Carrasco
|
4
2
|
class CommandBuilder
|
5
3
|
def from_config(config)
|
@@ -17,7 +15,7 @@ module Carrasco
|
|
17
15
|
klass.desc(command.help, command.description)
|
18
16
|
klass.class_eval do
|
19
17
|
define_method(command.command_name) do
|
20
|
-
|
18
|
+
execute_command(command)
|
21
19
|
end
|
22
20
|
end
|
23
21
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Carrasco
|
2
|
+
class CommandExecuter
|
3
|
+
CommandError = Class.new(StandardError)
|
4
|
+
def execute(command)
|
5
|
+
system(command.to_s)
|
6
|
+
$?.exitstatus
|
7
|
+
end
|
8
|
+
|
9
|
+
def execute!(command)
|
10
|
+
code = execute(command)
|
11
|
+
|
12
|
+
unless code == 0
|
13
|
+
raise CommandError.new("Command '#{command}' exited with code #{code}")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require "thor"
|
2
|
+
|
3
|
+
module Carrasco
|
4
|
+
class Thor < ::Thor
|
5
|
+
no_commands do
|
6
|
+
def execute_command(command)
|
7
|
+
command_executer.execute!(command)
|
8
|
+
end
|
9
|
+
|
10
|
+
def command_executer=(command_executer)
|
11
|
+
@@command_executer = command_executer
|
12
|
+
end
|
13
|
+
|
14
|
+
def command_executer
|
15
|
+
@@command_executer ||= CommandExecuter.new
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/carrasco/version.rb
CHANGED
data/lib/carrasco.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carrasco
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcelo Jacobus
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -160,6 +160,8 @@ files:
|
|
160
160
|
- lib/carrasco.rb
|
161
161
|
- lib/carrasco/command.rb
|
162
162
|
- lib/carrasco/command_builder.rb
|
163
|
+
- lib/carrasco/command_executer.rb
|
164
|
+
- lib/carrasco/thor.rb
|
163
165
|
- lib/carrasco/version.rb
|
164
166
|
homepage: https://github.com/mjacobus/carrasco
|
165
167
|
licenses:
|