droid-yaml 1.0.3
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 +7 -0
- data/bin/droid +4 -0
- data/lib/droid.rb +58 -0
- metadata +46 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: dea95b0340e31a7fed215750d26b3b353398eb74
|
|
4
|
+
data.tar.gz: 513d7cf9d042589ab6c2f72194314662e44a6f00
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: e6c1ac55d5e4b56437418e963aa3eb17c0180be644d0662f7f727f0de96afa47f9ea2c8270a5a2967451faf690b25bda9b935e8be1cada337a1f68ffb21181c8
|
|
7
|
+
data.tar.gz: 9e39a6df93e00709544ef2d23a9f4213cecbc810d188d8fc70b418b976f8ee120ae584589e03ea8e9d1dd411e7294f83a5c3fb37dbf9c576c8c6b21689cbe842
|
data/bin/droid
ADDED
data/lib/droid.rb
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require 'yaml'
|
|
3
|
+
require 'colorize'
|
|
4
|
+
|
|
5
|
+
class Droid
|
|
6
|
+
|
|
7
|
+
FILE = 'droid.yml'
|
|
8
|
+
COMMANDS = "commands"
|
|
9
|
+
SYNTAX = "syntax"
|
|
10
|
+
DESC = "desc"
|
|
11
|
+
RUN = "run"
|
|
12
|
+
|
|
13
|
+
def load
|
|
14
|
+
YAML.load_file(FILE)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def save(data)
|
|
18
|
+
File.open(FILE, 'w') { |f| YAML.dump(data, f) }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def list_commands
|
|
22
|
+
loaded_file = load
|
|
23
|
+
abort("No commands found in droid.yml") unless loaded_file
|
|
24
|
+
|
|
25
|
+
commands = loaded_file[COMMANDS]
|
|
26
|
+
puts "Usage: #{"droid".green} #{"<command>".yellow} #{"[args...] [options...]".blue}"
|
|
27
|
+
commands.each do |command|
|
|
28
|
+
puts "\n#{"droid".green} #{command[0].green} #{command[1][SYNTAX] ? command[1][SYNTAX] : ""}"
|
|
29
|
+
puts " #{command[1][DESC]}"
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def handle_command(command)
|
|
34
|
+
commands = load[COMMANDS]
|
|
35
|
+
command = commands[command]
|
|
36
|
+
if !command
|
|
37
|
+
list_commands
|
|
38
|
+
abort()
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
system("#{command[RUN]} #{ARGV[1..ARGV.count].join(' ')}")
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def run
|
|
45
|
+
File.file?('./droid.yml')
|
|
46
|
+
if !File.file?('./droid.yml')
|
|
47
|
+
abort('Could not find droid.yml')
|
|
48
|
+
end
|
|
49
|
+
# Main runner code
|
|
50
|
+
command = ARGV[0]
|
|
51
|
+
if !command
|
|
52
|
+
list_commands
|
|
53
|
+
else
|
|
54
|
+
handle_command(command)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: droid-yaml
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.3
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Joe Beveridge
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2017-05-18 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: YAML parser for running scripts
|
|
14
|
+
email: joe.beveridge@shopify.com
|
|
15
|
+
executables:
|
|
16
|
+
- droid
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- lib/droid.rb
|
|
21
|
+
- bin/droid
|
|
22
|
+
homepage: http://rubygems.org/gems/droid-yaml
|
|
23
|
+
licenses:
|
|
24
|
+
- MIT
|
|
25
|
+
metadata: {}
|
|
26
|
+
post_install_message:
|
|
27
|
+
rdoc_options: []
|
|
28
|
+
require_paths:
|
|
29
|
+
- lib
|
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
31
|
+
requirements:
|
|
32
|
+
- - '>='
|
|
33
|
+
- !ruby/object:Gem::Version
|
|
34
|
+
version: '0'
|
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - '>='
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0'
|
|
40
|
+
requirements: []
|
|
41
|
+
rubyforge_project:
|
|
42
|
+
rubygems_version: 2.0.14.1
|
|
43
|
+
signing_key:
|
|
44
|
+
specification_version: 4
|
|
45
|
+
summary: YAML parser for running scripts
|
|
46
|
+
test_files: []
|