regiment 0.0.3 → 0.0.4
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 +8 -8
- data/README.md +24 -2
- data/bin/regiment +18 -0
- data/lib/regiment/api.rb +1 -1
- data/lib/regiment/client.rb +21 -0
- data/lib/regiment/service/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTQ3MmQ2MmNkZmJmNmNmMWIxMTdmN2JhNjE2MTE4ZDdlODU5ZWViOQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZGFiYTNkZjY5MDk0MmE5OGU3MDkzOTMzZGEzMjJkMTk1ZTU3MGRhMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
N2VkYzhmOTVhYjI0Y2E2MGJkOTQ4MGRjMjUxMTA0YzI2YmVhNjE4NDZjNjBh
|
10
|
+
YjE5NTkyNWE3YjVhNjY4YTM1ZTk0OWMxYjc0MTRiZmQ2M2Y1NTY3Y2IxZTk4
|
11
|
+
NmY0ZTM4ZDBhNmQ2MTNjNWRmZTVjZThmNDU5MmI0ZjVmMzdmYzU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YTlkMzVhNzg4ZjcxYzY3ZjNjMjNiOGNhMDk0ZDI1Y2FkNjgxZjliNmZjNDc2
|
14
|
+
Mzk1YjllZDcxZmVmMGI3OWFhOWRiMTI3ZWVkZDQ4NjFhNDhlM2I2YTZlNWMx
|
15
|
+
MWU1OGE1ZDA1MWI4MTIyNTA4MjQ4MGM0ZjA2Yjk2ZjQzMzYwNTY=
|
data/README.md
CHANGED
@@ -1,8 +1,30 @@
|
|
1
|
-
#
|
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
data/lib/regiment/client.rb
CHANGED
@@ -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
|