the_hulk 0.0.1 → 0.0.2
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/.gitignore +23 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +2 -0
- data/bin/hulk +6 -0
- data/hulk.gemspec +23 -0
- data/lib/hulk/version.rb +3 -0
- data/lib/hulk.rb +108 -0
- metadata +47 -9
- data/lib/the_hulk.rb +0 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d93f4a29d0895d5cce4231f8bfaa51fec74d51f4
|
|
4
|
+
data.tar.gz: 9cb25c565bd933c3d59ede11a27cc8c34ee26a40
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 606c542aa7ca9d8166d24233fd8c2ddbc40cab573eb8d81a79a6edd5e0649b4004c0de26d573f8690059474b8b208b826fde89b8b1c7336c936bc0a2b32de0d7
|
|
7
|
+
data.tar.gz: 0957c30e62defe4ad1e021fecef19a424628d28abcf0e4e1dec5731fd460b8604ccf000cc05121e08df494c7290bc3f67da599b3c58623cfd56639c061973e0b
|
data/.gitignore
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
*.gem
|
|
2
|
+
*.rbc
|
|
3
|
+
.bundle
|
|
4
|
+
.config
|
|
5
|
+
.yardoc
|
|
6
|
+
Gemfile.lock
|
|
7
|
+
InstalledFiles
|
|
8
|
+
_yardoc
|
|
9
|
+
coverage
|
|
10
|
+
doc/
|
|
11
|
+
lib/bundler/man
|
|
12
|
+
pkg
|
|
13
|
+
rdoc
|
|
14
|
+
spec/reports
|
|
15
|
+
test/tmp
|
|
16
|
+
test/version_tmp
|
|
17
|
+
tmp
|
|
18
|
+
*.bundle
|
|
19
|
+
*.so
|
|
20
|
+
*.o
|
|
21
|
+
*.a
|
|
22
|
+
mkmf.log
|
|
23
|
+
hulk.yml
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2014 Ethan Welborn
|
|
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,29 @@
|
|
|
1
|
+
hulk
|
|
2
|
+
====
|
|
3
|
+
|
|
4
|
+
Hulk is an ultra simple command line tool for running a list of bash commands synchronously. The only dependency is the colorize gem.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
After adding a `hulk.yml` file to your project root, simply reference the following example to add hulk builds.
|
|
10
|
+
|
|
11
|
+
```YML
|
|
12
|
+
push:
|
|
13
|
+
- git add .
|
|
14
|
+
- git commit -m 'Made some changes.'
|
|
15
|
+
- git push origin master
|
|
16
|
+
deploy:
|
|
17
|
+
- --push
|
|
18
|
+
- git push -f heroku dev:master
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The above example will give you the following:
|
|
22
|
+
1. Calling `hulk push` will run the 3 commands you see under `push:`, in the order they appear, in a synchronous manner.
|
|
23
|
+
2. Calling `hulk deploy` will run the `push` build, and then run the push to the heroku server.
|
|
24
|
+
|
|
25
|
+
### Nesting builds
|
|
26
|
+
|
|
27
|
+
As shown in the above example, you can call other builds within your current build. Simply prefix the build name with `--` and hulk will understand what you're asking. After running the other build, hulk will continue on with the initial build called.
|
|
28
|
+
|
|
29
|
+
You can mix and match builds with commands, and nest builds as frequent, or infrequent as you like. Hulk can handle it.
|
data/Rakefile
ADDED
data/bin/hulk
ADDED
data/hulk.gemspec
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'hulk/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "the_hulk"
|
|
8
|
+
spec.version = Hulk::VERSION
|
|
9
|
+
spec.authors = ["Ethan Welborn"]
|
|
10
|
+
spec.email = ["welborn.ethan@gmail.com"]
|
|
11
|
+
spec.summary = %q{Super simple, super strong command runner.}
|
|
12
|
+
spec.description = %q{Hulk takes a .yml file with sets of commands that it can run sequentially.}
|
|
13
|
+
spec.homepage = ""
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
|
17
|
+
spec.executables = ['hulk']
|
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
|
+
spec.require_paths = ["lib"]
|
|
20
|
+
|
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
|
22
|
+
spec.add_development_dependency "rake"
|
|
23
|
+
end
|
data/lib/hulk/version.rb
ADDED
data/lib/hulk.rb
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
require "hulk/version"
|
|
2
|
+
require 'colorize'
|
|
3
|
+
require 'yaml'
|
|
4
|
+
require 'optparse'
|
|
5
|
+
require 'ostruct'
|
|
6
|
+
|
|
7
|
+
module Hulk
|
|
8
|
+
class Runner
|
|
9
|
+
|
|
10
|
+
def parse_yaml
|
|
11
|
+
builds = nil
|
|
12
|
+
|
|
13
|
+
begin
|
|
14
|
+
builds = YAML::load( File.open( './hulk.yml' ) )
|
|
15
|
+
rescue Exception
|
|
16
|
+
STDERR.puts "#{$!}".colorize(:red)
|
|
17
|
+
exit 1
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
if not builds
|
|
21
|
+
puts "Hulk no find builds in hulk.yml".colorize(:green)
|
|
22
|
+
exit 1
|
|
23
|
+
else
|
|
24
|
+
builds
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def list_builds
|
|
30
|
+
builds = parse_yaml
|
|
31
|
+
puts "Hulk show you builds!".colorize(:green) if builds.length > 0
|
|
32
|
+
count = 1
|
|
33
|
+
builds.each do |key, value|
|
|
34
|
+
puts " [#{count}] >> #{key}"
|
|
35
|
+
count += 1
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def run_build build, commands
|
|
41
|
+
puts "Hulk run build: #{build}".colorize(:green)
|
|
42
|
+
commands.each do |command|
|
|
43
|
+
if command =~ /^--/
|
|
44
|
+
cmds = []
|
|
45
|
+
cmds << command[2..-1]
|
|
46
|
+
spawn_builds cmds
|
|
47
|
+
else
|
|
48
|
+
puts "Hulk run command: #{command}".colorize(:green)
|
|
49
|
+
system( command )
|
|
50
|
+
puts
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def spawn_builds args
|
|
57
|
+
builds = parse_yaml
|
|
58
|
+
args.each do |arg|
|
|
59
|
+
if builds.has_key? arg
|
|
60
|
+
run_build arg, builds[arg]
|
|
61
|
+
else
|
|
62
|
+
puts "Hulk no find build: #{arg}".colorize(:green)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def parse args
|
|
69
|
+
options = OpenStruct.new
|
|
70
|
+
|
|
71
|
+
options.list = false
|
|
72
|
+
|
|
73
|
+
opt_parser = OptionParser.new do |opts|
|
|
74
|
+
opts.banner = "Usage: hulk [options]"
|
|
75
|
+
|
|
76
|
+
opts.on('-l', '--list', 'List Builds') do |l|
|
|
77
|
+
options[:list] = l
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
begin
|
|
83
|
+
opt_parser.parse!(args)
|
|
84
|
+
rescue OptionParser::InvalidOption => e
|
|
85
|
+
STDERR.puts "Invalid Hulk option: #{e}".colorize(:red)
|
|
86
|
+
exit 1
|
|
87
|
+
end
|
|
88
|
+
options
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def bootstrap
|
|
93
|
+
if ARGV and ARGV.empty?
|
|
94
|
+
puts "Hulk no given arguments.".colorize(:green)
|
|
95
|
+
exit 1
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
options = parse ARGV
|
|
99
|
+
if ARGV.empty?
|
|
100
|
+
list_builds if options.list == true
|
|
101
|
+
else
|
|
102
|
+
spawn_builds ARGV
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: the_hulk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ethan Welborn
|
|
@@ -9,17 +9,55 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
date: 2014-05-23 00:00:00.000000000 Z
|
|
12
|
-
dependencies:
|
|
13
|
-
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ~>
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.6'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ~>
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.6'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - '>='
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - '>='
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
description: Hulk takes a .yml file with sets of commands that it can run sequentially.
|
|
14
42
|
email:
|
|
15
43
|
- welborn.ethan@gmail.com
|
|
16
|
-
executables:
|
|
44
|
+
executables:
|
|
45
|
+
- hulk
|
|
17
46
|
extensions: []
|
|
18
47
|
extra_rdoc_files: []
|
|
19
48
|
files:
|
|
20
|
-
-
|
|
21
|
-
|
|
22
|
-
|
|
49
|
+
- .gitignore
|
|
50
|
+
- Gemfile
|
|
51
|
+
- LICENSE.txt
|
|
52
|
+
- README.md
|
|
53
|
+
- Rakefile
|
|
54
|
+
- bin/hulk
|
|
55
|
+
- hulk.gemspec
|
|
56
|
+
- lib/hulk.rb
|
|
57
|
+
- lib/hulk/version.rb
|
|
58
|
+
homepage: ''
|
|
59
|
+
licenses:
|
|
60
|
+
- MIT
|
|
23
61
|
metadata: {}
|
|
24
62
|
post_install_message:
|
|
25
63
|
rdoc_options: []
|
|
@@ -37,8 +75,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
37
75
|
version: '0'
|
|
38
76
|
requirements: []
|
|
39
77
|
rubyforge_project:
|
|
40
|
-
rubygems_version: 2.
|
|
78
|
+
rubygems_version: 2.1.11
|
|
41
79
|
signing_key:
|
|
42
80
|
specification_version: 4
|
|
43
|
-
summary: Super simple, super strong command runner
|
|
81
|
+
summary: Super simple, super strong command runner.
|
|
44
82
|
test_files: []
|