mind_meld 0.1.0 → 0.1.1
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/mind_meld +52 -9
- data/lib/mind_meld.rb +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9a58f290eec9c50837d4178728b9b2f4c4e3423
|
4
|
+
data.tar.gz: af0060bb12091a28e5d08b4aa42f058a19d81836
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93837946b3e466d5ba5e2d5c006ee726321cf61c8eed0efe2d4669e5a3722a12494109e0558ee9902f49afe10859af1b256fb15629dc6cbbe06e697e20b0ec66
|
7
|
+
data.tar.gz: 02e8d4185a62c86ac13f3678a60cec7815dc47c1581046e4628df1b294ab8f0099c46c3722f75e70b1fe17e3fcba133b9319423b548d20831c00fe0a1d7095e6
|
data/bin/mind_meld
CHANGED
@@ -6,23 +6,66 @@ ENV['BUNDLE_GEMFILE'] ||= File.expand_path(
|
|
6
6
|
Pathname.new(__FILE__).realpath
|
7
7
|
)
|
8
8
|
|
9
|
+
require 'optparse'
|
10
|
+
require 'ostruct'
|
11
|
+
|
9
12
|
$LOAD_PATH << File.expand_path('../../lib', __FILE__)
|
10
13
|
require 'mind_meld'
|
14
|
+
require 'mind_meld/device'
|
11
15
|
|
12
16
|
url = ENV['HIVEMIND_URL'] || 'http://localhost:3000'
|
13
17
|
pem = ENV['HIVEMIND_PEM'] || nil
|
14
18
|
ca_file = ENV['HIVEMIND_CAFILE'] || nil
|
15
19
|
verify_mode = ENV['HIVEMIND_VERIFY_MODE'] || nil
|
16
20
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
21
|
+
cmd = ARGV.shift
|
22
|
+
|
23
|
+
class Parser
|
24
|
+
def self.parse(type, opts = {})
|
25
|
+
connection = nil
|
26
|
+
options = OpenStruct.new
|
27
|
+
|
28
|
+
opt_parser = OptionParser.new do |opts|
|
29
|
+
opts.banner = "Usage: mind_meld action"
|
30
|
+
opts.on("-i ID") do |i|
|
31
|
+
connection = MindMeld::Device.new(
|
32
|
+
url: ENV['HIVEMIND_URL'] || 'http://localhost:3000',
|
33
|
+
pem: ENV['HIVEMIND_PEM'] || nil,
|
34
|
+
ca_file: ENV['HIVEMIND_CAFILE'] || nil,
|
35
|
+
verify_mode: ENV['HIVEMIND_VERIFY_MODE'] || nil,
|
36
|
+
device: { id: i }
|
37
|
+
)
|
38
|
+
end
|
39
|
+
opts.on("-t TYPE") { |t| options.action_type = t }
|
40
|
+
opts.on("-b BODY") { |b| options.body = b }
|
41
|
+
end
|
42
|
+
|
43
|
+
opt_parser.parse(opts)
|
44
|
+
return { connection: connection, options: options }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
case cmd
|
49
|
+
when 'list'
|
50
|
+
mm = MindMeld.new(
|
51
|
+
url: url,
|
52
|
+
pem: pem,
|
53
|
+
ca_file: ca_file,
|
54
|
+
verify_mode: verify_mode
|
55
|
+
)
|
56
|
+
|
57
|
+
devs = mm.devices
|
23
58
|
|
24
|
-
devs
|
59
|
+
devs.each do |dev|
|
60
|
+
puts "#{dev['id']}) #{dev['name']}"
|
61
|
+
end
|
62
|
+
when 'action'
|
63
|
+
opts = Parser.parse 'action', ARGV
|
25
64
|
|
26
|
-
|
27
|
-
|
65
|
+
opts[:connection].create_action( opts[:options].to_h )
|
66
|
+
when nil, /^-+/
|
67
|
+
puts "Missing command"
|
68
|
+
puts "(and missing help file)"
|
69
|
+
else
|
70
|
+
puts "Unknown command '#{cmd}'"
|
28
71
|
end
|
data/lib/mind_meld.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mind_meld
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Haig
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
86
|
version: '0'
|
87
87
|
requirements: []
|
88
88
|
rubyforge_project:
|
89
|
-
rubygems_version: 2.5.
|
89
|
+
rubygems_version: 2.5.1
|
90
90
|
signing_key:
|
91
91
|
specification_version: 4
|
92
92
|
summary: API for Hive Mind
|