hmx_client 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,4 +22,6 @@ Gem::Specification.new do |s|
22
22
  # s.add_development_dependency "rspec"
23
23
  s.add_runtime_dependency "rest-client"
24
24
  s.add_runtime_dependency "json"
25
+ s.add_runtime_dependency "cli-colorize"
26
+ s.add_runtime_dependency "term-ansicolor"
25
27
  end
@@ -0,0 +1,38 @@
1
+ require "hmx/command/base"
2
+ require 'date'
3
+
4
+ module HmxClient::Command
5
+
6
+ # Create new partitions in HMX based on the current partition
7
+ #
8
+ class Partition < Base
9
+
10
+ # partition
11
+ #
12
+ # List the partitions on this system (requires administrative privileges)
13
+ def index
14
+ partitions = hmx.getPartitions();
15
+ partitions.each do | p |
16
+ puts p['name'];
17
+ end
18
+ end
19
+
20
+ # partition:create
21
+ #
22
+ # Create a new partition based on this partition
23
+ def create
24
+ target = args.shift;
25
+ style = args.shift;
26
+ partition = hmx.clonePartition(target, style);
27
+ end
28
+
29
+ # partition:switch
30
+ #
31
+ # Switch the context of this hmx configuration to a new partition
32
+ # This is basically a synonym of config:add partition=[partition]
33
+ def switch
34
+ storeConfig("partition".to_sym, args.shift);
35
+ puts "Done"
36
+ end
37
+ end
38
+ end
@@ -44,6 +44,8 @@ class Hmx
44
44
  end
45
45
  def initialize
46
46
  @distMap = {
47
+ :getPartitions => [ 'admin', 'GETPARTITIONS', 'partitions', []],
48
+ :clonePartition => [ 'admin', 'CLONEPARTITION', 'partition', [ { :pos => 0, :name => 'destination' }, { :pos => 1, :name => 'copyStyle' } ] ],
47
49
  :info => [ 'user', 'INFO', 'response', []],
48
50
  :getData => [ 'user', 'GETDATA', 'data', [ { :pos => 0, :name => 'displayName' } ]],
49
51
  :getContent => [ 'user', 'GETCONTENT', 'content', [ { :pos => 0, :name => 'displayName' }]],
@@ -110,6 +112,7 @@ class Hmx
110
112
  end
111
113
  def performRequest(prefix, function, command)
112
114
  puts "Send data #{ JSON.generate(command) }" if HmxClient::Command.debug?
115
+ puts "URL is #{ @urlapi+'/'+prefix } " if HmxClient::Command.debug?
113
116
  response = RestClient.post @urlapi+'/'+prefix, :function=>function, :params=>JSON.generate(command), :multipart=>true
114
117
  puts "Raw response is #{ response.to_str }" if HmxClient::Command.debug?
115
118
  return JSON.parse(response.to_str)
@@ -202,5 +205,11 @@ class Hmx
202
205
  def bootstrap
203
206
  performDistRequest(:bootstrap, [])
204
207
  end
208
+ def getPartitions
209
+ performDistRequest(:getPartitions, [])
210
+ end
211
+ def clonePartition(*args)
212
+ performDistRequest(:clonePartition, args)
213
+ end
205
214
  end
206
215
  end
@@ -1,3 +1,3 @@
1
1
  module HmxClient
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hmx_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-07 00:00:00.000000000Z
12
+ date: 2011-11-10 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
16
- requirement: &70187035831060 !ruby/object:Gem::Requirement
16
+ requirement: &70268564434020 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70187035831060
24
+ version_requirements: *70268564434020
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: json
27
- requirement: &70187035830640 !ruby/object:Gem::Requirement
27
+ requirement: &70268564433600 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,29 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70187035830640
35
+ version_requirements: *70268564433600
36
+ - !ruby/object:Gem::Dependency
37
+ name: cli-colorize
38
+ requirement: &70268564433180 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *70268564433180
47
+ - !ruby/object:Gem::Dependency
48
+ name: term-ansicolor
49
+ requirement: &70268564432760 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *70268564432760
36
58
  description: Gives a client the ability to interact fully with the API for HMX
37
59
  email:
38
60
  - ukmoore@gmail.com
@@ -58,6 +80,7 @@ files:
58
80
  - lib/hmx/command/get.rb
59
81
  - lib/hmx/command/getContent.rb
60
82
  - lib/hmx/command/help.rb
83
+ - lib/hmx/command/partition.rb
61
84
  - lib/hmx/command/query.rb
62
85
  - lib/hmx/command/session.rb
63
86
  - lib/hmx/command/task.rb