regiment 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MGNhZmJkZjI0YmUwY2ZjNTI3MDQ5NTBmYjc2NGRjNzZlNWJjMWY1NA==
4
+ MTQ3MmQ2MmNkZmJmNmNmMWIxMTdmN2JhNjE2MTE4ZDdlODU5ZWViOQ==
5
5
  data.tar.gz: !binary |-
6
- NThmMTIwZDlhZWVlMzlmZmU3NzM1MmQ5OWJlYWNiZTMyNzBjZjliYw==
6
+ ZGFiYTNkZjY5MDk0MmE5OGU3MDkzOTMzZGEzMjJkMTk1ZTU3MGRhMg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YzM5OTU1ODljZTUyMWExZmFlZDVlNTg3ZjA2NGMyNjVjYWVkY2Q2YzQ0YmZi
10
- NjEzY2I2Nzc1ODc4YTMxOTY0ZWZiYTgwZWI1NmEwNTllZGU2MWY4YjczZGNh
11
- ZWY2MTU1ODgyYzM3ZTdkZWI2ZmE2MjcyMjU5ZTY5MGVjMTAzYWY=
9
+ N2VkYzhmOTVhYjI0Y2E2MGJkOTQ4MGRjMjUxMTA0YzI2YmVhNjE4NDZjNjBh
10
+ YjE5NTkyNWE3YjVhNjY4YTM1ZTk0OWMxYjc0MTRiZmQ2M2Y1NTY3Y2IxZTk4
11
+ NmY0ZTM4ZDBhNmQ2MTNjNWRmZTVjZThmNDU5MmI0ZjVmMzdmYzU=
12
12
  data.tar.gz: !binary |-
13
- MzIxYTZjZmM4NTFiMGQwMTZhZmE2OTJjMGY5OGEzMTg5YThmNWU2MzJkMDNk
14
- ZTE1ZjIwNThkNzM1ODVhZDA3ZTg1NjU4ZTE1ZDk1MTVhYzFiNDgxMjIzOTVh
15
- MWZkZmVkNTQxMDU4ZWEzNjA2NDg0MTJlMWM3ZTRmNWViMzU5MjY=
13
+ YTlkMzVhNzg4ZjcxYzY3ZjNjMjNiOGNhMDk0ZDI1Y2FkNjgxZjliNmZjNDc2
14
+ Mzk1YjllZDcxZmVmMGI3OWFhOWRiMTI3ZWVkZDQ4NjFhNDhlM2I2YTZlNWMx
15
+ MWU1OGE1ZDA1MWI4MTIyNTA4MjQ4MGM0ZjA2Yjk2ZjQzMzYwNTY=
data/README.md CHANGED
@@ -1,8 +1,30 @@
1
- # regiment
2
- A simple RESTful script/job management framework in Ruby.
1
+ # Regiment
2
+ A simple, self-contained, RESTful script/job management framework in Ruby.
3
3
 
4
4
  ## API ##
5
5
 
6
6
  Regiment implements an API through which you can trigger scripts(orders), view which orders are in progress and various other useful actions. The API can be started with the command `regiment-api`.
7
7
 
8
+ ### Endpoints ###
9
+
8
10
  `/version` - This returns the version of Regiment you have running.
11
+
12
+ ## CLI ##
13
+
14
+ Regiment comes with a tool `regiment` that implements the interface of the API on your command line to squeeze yet more efficiency out of your workflow.
15
+
16
+ ### Sub Commands ###
17
+
18
+ `version` - Returns the version of Regiment used by the client and the version used by the endpoint.
19
+
20
+ ### Options ###
21
+
22
+ `--regiment` - String - The hostname(including port) of your Regiment endpoint e.g. `localhost:1234`
23
+
24
+ ## Contributing ##
25
+
26
+ ### Rake ###
27
+
28
+ To build and install the gem locally during development ensure you are in the root of the repository and run:
29
+
30
+ `rake buildinstall`
data/bin/regiment CHANGED
@@ -1,2 +1,20 @@
1
1
  #! /usr/bin/env ruby
2
2
  require 'regiment/client'
3
+ require 'regiment/service/version'
4
+ require 'thor'
5
+
6
+ class RegimentCLI < Thor
7
+ desc 'version', 'Get version of regiment client and endpoint'
8
+ option :regiment
9
+
10
+ def version
11
+ client_verison = Regiment::Service::VERSION
12
+
13
+ client = Regiment::Client.new(options[:regiment])
14
+ endpoint_verison = client.version
15
+
16
+ puts "Client: #{client_verison}, Endpoint: #{endpoint_verison}"
17
+ end
18
+ end
19
+
20
+ RegimentCLI.start(ARGV)
data/lib/regiment/api.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'regiment/service/version'
2
2
 
3
3
  module Regiment
4
- class API
4
+ class API
5
5
  def initialize
6
6
 
7
7
  end
@@ -0,0 +1,21 @@
1
+ require 'regiment/service/version'
2
+ require 'rest-client'
3
+ require 'uri'
4
+
5
+ module Regiment
6
+ class Client
7
+ def initialize(endpoint)
8
+ combined = endpoint.split(":")
9
+ @host = combined[0]
10
+ @port = combined[1].to_i
11
+ end
12
+
13
+ def build_uri(path)
14
+ return URI::HTTP.build({:host => @host, :port => @port, :path => path}).to_s
15
+ end
16
+
17
+ def version
18
+ return RestClient.get(build_uri("/version"))
19
+ end
20
+ end
21
+ end
@@ -1,5 +1,5 @@
1
1
  module Regiment
2
2
  class Service
3
- VERSION = '0.0.3'
3
+ VERSION = '0.0.4'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: regiment
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh McGhee