ccs 0.2.0 → 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CODE_OF_CONDUCT.md +1 -1
- data/LICENSE.txt +1 -1
- data/README.md +3 -3
- data/exe/ccs +70 -0
- data/lib/ccs.rb +8 -3
- data/lib/ccs/application.rb +34 -0
- data/lib/ccs/configuration_file.rb +12 -16
- data/lib/ccs/decrypter.rb +3 -1
- data/lib/ccs/downloader.rb +17 -16
- data/lib/ccs/encrypter.rb +26 -0
- data/lib/ccs/uploader.rb +42 -0
- data/lib/ccs/version.rb +3 -1
- metadata +106 -19
- data/bin/ccs +0 -57
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0efddd17f5cf6cc4dda4edc407ec58993d82d34d508132228a4af0f3a2ff216a
|
4
|
+
data.tar.gz: 654cd5f1e367d4c6c7a251666015d2896051e6bc84734a483f90b2af04f713e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19d2e3f9349f122a9fa05a6fd41ee24cc37bc08f06448236313e6236e82020bdfc1b1eefaa4160f0d30b5287420509f337880794484d89a7dc59b6ab446a6923
|
7
|
+
data.tar.gz: 60e209b81064b9813907722cc81c53574ac9ac493a7c6c0dcdca162cc59c9fc5b0ddd277415cd931f7d735ba22084a65aa16c9d76705107fe05e9f14cae45e81
|
data/CODE_OF_CONDUCT.md
CHANGED
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
|
|
55
55
|
## Enforcement
|
56
56
|
|
57
57
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at
|
58
|
+
reported by contacting the project team at me@tkowalewski.pl. All
|
59
59
|
complaints will be reviewed and investigated and will result in a response that
|
60
60
|
is deemed necessary and appropriate to the circumstances. The project team is
|
61
61
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -23,13 +23,13 @@ Or install it yourself as:
|
|
23
23
|
|
24
24
|
## Development
|
25
25
|
|
26
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `
|
26
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
27
27
|
|
28
|
-
To install this gem onto your local machine, run `
|
28
|
+
To install this gem onto your local machine, run `bin/rake install`. To release a new version, update the version number in `version.rb`, and then run `bin/rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
29
29
|
|
30
30
|
## Contributing
|
31
31
|
|
32
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
32
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/tkowalewski/ccs. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
33
33
|
|
34
34
|
|
35
35
|
## License
|
data/exe/ccs
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'ccs'
|
6
|
+
require 'yaml'
|
7
|
+
require 'optparse'
|
8
|
+
require 'io/console'
|
9
|
+
|
10
|
+
options = {
|
11
|
+
'access_token' => ENV['CCS_ACCESS_TOKEN'],
|
12
|
+
'secret_token' => ENV['CCS_SECRET_TOKEN']
|
13
|
+
}
|
14
|
+
|
15
|
+
option_parser = OptionParser.new
|
16
|
+
option_parser.banner = 'Usage: ccs [OPTIONS] <(LocalPath|STDIN)|(CCSUri|Uri)> <(CCSUri|Uri)|(LocalPath|STDOUT)>'
|
17
|
+
option_parser.separator ''
|
18
|
+
option_parser.separator 'Configuration Control System (CCS)'
|
19
|
+
option_parser.separator ''
|
20
|
+
option_parser.separator 'Options:'
|
21
|
+
|
22
|
+
option_parser.on('-c CONFIGURATION', '--configuration CONFIGURATION', String, 'Path to configuration file') do |v|
|
23
|
+
options['configuration'] = v
|
24
|
+
end
|
25
|
+
|
26
|
+
option_parser.on('-a CCS_ACCESS_TOKEN', '--access-token CCS_ACCESS_TOKEN', String, 'CCS Access Token') do |v|
|
27
|
+
options['access_token'] = v
|
28
|
+
end
|
29
|
+
|
30
|
+
option_parser.on('-s CCS_SECRET_TOKEN', '--secret-token CCS_SECRET_TOKEN', String, 'CCS Secret Token') do |v|
|
31
|
+
options['secret_token'] = v
|
32
|
+
end
|
33
|
+
|
34
|
+
option_parser.separator ''
|
35
|
+
option_parser.separator 'Configure via environment variables'
|
36
|
+
option_parser.separator ' CCS_ACCESS_TOKEN'
|
37
|
+
option_parser.separator ' CCS_SECRET_TOKEN'
|
38
|
+
|
39
|
+
option_parser.separator ''
|
40
|
+
option_parser.separator 'Examples:'
|
41
|
+
option_parser.separator ' Download to STDOUT'
|
42
|
+
option_parser.separator ' ccs ccs://workspace-name/0.1.0/path/to/file.yml -'
|
43
|
+
option_parser.separator ' ccs http://host.tld:9292/workspace-name/0.1.0/path/to/file.yml -'
|
44
|
+
option_parser.separator ' ccs https://host.tld/workspace-name/0.1.0/path/to/file.yml -'
|
45
|
+
option_parser.separator ' Download to local file'
|
46
|
+
option_parser.separator ' ccs ccs://workspace-name/0.1.0/path/to/file.yml /local/path/to/file.yml'
|
47
|
+
option_parser.separator ' Upload local file'
|
48
|
+
option_parser.separator ' ccs /local/path/to/file.yml ccs://workspace-name/0.1.0/path/to/file.yml'
|
49
|
+
option_parser.separator ' Upload content from STDIN'
|
50
|
+
option_parser.separator ' echo "{ a: 1 }" | ccs - ccs://workspace-name/0.1.0/path/to/file.yml'
|
51
|
+
option_parser.separator ' cat /local/path/to/file.yml | ccs - ccs://workspace-name/0.1.0/path/to/file.yml'
|
52
|
+
option_parser.separator ''
|
53
|
+
|
54
|
+
option_parser.separator format('Version: %<version>s', version: Ccs::VERSION)
|
55
|
+
|
56
|
+
arguments = option_parser.parse!
|
57
|
+
|
58
|
+
unless options.values.any?
|
59
|
+
puts option_parser
|
60
|
+
exit(1)
|
61
|
+
end
|
62
|
+
|
63
|
+
options = YAML.safe_load File.read(options.delete('configuration')) if options.key?('configuration')
|
64
|
+
|
65
|
+
raise OptionParser::MissingArgument, 'access_token' unless options['access_token']
|
66
|
+
raise OptionParser::MissingArgument, 'secret_token' unless options['secret_token']
|
67
|
+
raise OptionParser::MissingArgument, 'source' unless arguments.fetch(0, nil)
|
68
|
+
raise OptionParser::MissingArgument, 'destination' unless arguments.fetch(1, nil)
|
69
|
+
|
70
|
+
exit(1) unless Ccs::Application.new(arguments[0], arguments[1], options['access_token'], options['secret_token']).run
|
data/lib/ccs.rb
CHANGED
@@ -1,12 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'net/http'
|
2
4
|
require 'json'
|
3
5
|
require 'openssl'
|
4
6
|
require 'base64'
|
7
|
+
require 'uri'
|
5
8
|
|
6
9
|
require 'ccs/version'
|
7
|
-
require 'ccs/
|
10
|
+
require 'ccs/encrypter'
|
8
11
|
require 'ccs/decrypter'
|
12
|
+
require 'ccs/uploader'
|
13
|
+
require 'ccs/downloader'
|
9
14
|
require 'ccs/configuration_file'
|
15
|
+
require 'ccs/application'
|
10
16
|
|
11
|
-
module Ccs
|
12
|
-
end
|
17
|
+
module Ccs; end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Ccs
|
4
|
+
class Application
|
5
|
+
def initialize(source, destination, access_token, secret_token)
|
6
|
+
@source = source
|
7
|
+
@destination = destination
|
8
|
+
@access_token = access_token
|
9
|
+
@secret_token = secret_token
|
10
|
+
end
|
11
|
+
|
12
|
+
def run
|
13
|
+
download? ? download : upload
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def download?
|
19
|
+
@source.match?(%r{\A(ccs|https?):\/\/})
|
20
|
+
end
|
21
|
+
|
22
|
+
def download
|
23
|
+
content = ConfigurationFile.new(@source, @access_token, @secret_token).download
|
24
|
+
return unless content
|
25
|
+
|
26
|
+
(@destination.eql?('-') ? STDOUT : File.new(@destination, 'w')).print content
|
27
|
+
end
|
28
|
+
|
29
|
+
def upload
|
30
|
+
content = @source.eql?('-') ? STDIN.read : File.read(@source)
|
31
|
+
ConfigurationFile.new(@destination, @access_token, @secret_token).upload(content)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -1,29 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Ccs
|
2
4
|
class ConfigurationFile
|
3
|
-
def initialize(uri)
|
4
|
-
@uri = uri
|
5
|
-
|
6
|
-
|
7
|
-
def version
|
8
|
-
parts[0]
|
9
|
-
end
|
10
|
-
|
11
|
-
def path
|
12
|
-
parts[1]
|
5
|
+
def initialize(uri, access_token, secret_token)
|
6
|
+
@uri = build_uri(uri)
|
7
|
+
@access_token = access_token
|
8
|
+
@secret_token = secret_token
|
13
9
|
end
|
14
10
|
|
15
|
-
def
|
16
|
-
|
11
|
+
def upload(content)
|
12
|
+
Uploader.new(@uri, content, @access_token, @secret_token).call
|
17
13
|
end
|
18
14
|
|
19
|
-
def
|
20
|
-
|
15
|
+
def download
|
16
|
+
Downloader.new(@uri, @access_token, @secret_token).call
|
21
17
|
end
|
22
18
|
|
23
19
|
private
|
24
20
|
|
25
|
-
def
|
26
|
-
|
21
|
+
def build_uri(uri)
|
22
|
+
URI uri.sub('ccs://', 'https://api.occson.com/')
|
27
23
|
end
|
28
24
|
end
|
29
25
|
end
|
data/lib/ccs/decrypter.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Ccs
|
2
4
|
class Decrypter
|
3
5
|
def initialize(passphrase, content)
|
@@ -5,7 +7,7 @@ module Ccs
|
|
5
7
|
@content = content
|
6
8
|
end
|
7
9
|
|
8
|
-
def
|
10
|
+
def call
|
9
11
|
decryptor.pkcs5_keyivgen(@passphrase, ciphertext_salt, 1)
|
10
12
|
result = decryptor.update(encrypted)
|
11
13
|
result << decryptor.final
|
data/lib/ccs/downloader.rb
CHANGED
@@ -1,36 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Ccs
|
2
4
|
class Downloader
|
3
|
-
def initialize(
|
4
|
-
@
|
5
|
-
@
|
5
|
+
def initialize(uri, access_token, secret_token)
|
6
|
+
@uri = uri
|
7
|
+
@access_token = access_token
|
8
|
+
@secret_token = secret_token
|
6
9
|
end
|
7
10
|
|
8
|
-
def
|
11
|
+
def call
|
9
12
|
response = http.request(request)
|
13
|
+
body = response.body
|
14
|
+
return unless response.code.eql? '200'
|
15
|
+
json = JSON.parse body
|
10
16
|
|
11
|
-
|
12
|
-
|
13
|
-
JSON.parse(response.body)
|
17
|
+
Decrypter.new(@secret_token, json['encrypted_content']).call
|
14
18
|
end
|
15
19
|
|
16
20
|
private
|
17
21
|
|
18
|
-
def uri
|
19
|
-
@uri ||= URI format('https://pipello.io/api/v1/ccs/%s/%s', @configuration_file.version, @configuration_file.path)
|
20
|
-
end
|
21
|
-
|
22
22
|
def http
|
23
|
-
Net::HTTP.new(uri.host, uri.port)
|
24
|
-
http.use_ssl = uri.scheme == 'https'
|
25
|
-
end
|
23
|
+
Net::HTTP.new(@uri.host, @uri.port)
|
26
24
|
end
|
27
25
|
|
28
26
|
def request
|
29
|
-
Net::HTTP::Get.new(uri.path, headers)
|
27
|
+
Net::HTTP::Get.new(@uri.path, headers)
|
30
28
|
end
|
31
29
|
|
32
30
|
def headers
|
33
|
-
{
|
31
|
+
{
|
32
|
+
'Authorization' => format('Token token=%<access_token>s', access_token: @access_token),
|
33
|
+
'Content-Type' => 'application/json'
|
34
|
+
}
|
34
35
|
end
|
35
36
|
end
|
36
37
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Ccs
|
4
|
+
class Encrypter
|
5
|
+
def initialize(passphrase, content, salt)
|
6
|
+
@passphrase = passphrase
|
7
|
+
@content = content
|
8
|
+
@salt = salt
|
9
|
+
end
|
10
|
+
|
11
|
+
def call
|
12
|
+
encryptor.pkcs5_keyivgen(@passphrase, @salt, 1)
|
13
|
+
encrypted = encryptor.update(@content)
|
14
|
+
encrypted << encryptor.final
|
15
|
+
|
16
|
+
openssl_salted_ciphertext = 'Salted__' + @salt + encrypted
|
17
|
+
Base64.strict_encode64(openssl_salted_ciphertext)
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def encryptor
|
23
|
+
@encryptor ||= OpenSSL::Cipher::AES.new(256, :CBC).encrypt
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/ccs/uploader.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Ccs
|
4
|
+
class Uploader
|
5
|
+
def initialize(uri, content, access_token, secret_token)
|
6
|
+
@uri = uri
|
7
|
+
@content = content
|
8
|
+
@access_token = access_token
|
9
|
+
@secret_token = secret_token
|
10
|
+
end
|
11
|
+
|
12
|
+
def call
|
13
|
+
request.body = { encrypted_content: encrypted_content }.to_json
|
14
|
+
http.request(request).code.eql? '201'
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def http
|
20
|
+
Net::HTTP.new(@uri.host, @uri.port)
|
21
|
+
end
|
22
|
+
|
23
|
+
def request
|
24
|
+
@request ||= Net::HTTP::Post.new(@uri.path, headers)
|
25
|
+
end
|
26
|
+
|
27
|
+
def headers
|
28
|
+
{
|
29
|
+
'Authorization' => format('Token token=%<access_token>s', access_token: @access_token),
|
30
|
+
'Content-Type' => 'application/json'
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
def encrypted_content
|
35
|
+
@encrypted_content ||= Encrypter.new(@secret_token, @content, salt).call
|
36
|
+
end
|
37
|
+
|
38
|
+
def salt
|
39
|
+
@access_token[0...8]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/ccs/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ccs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- tkowalewski
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,59 +16,143 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.16.1
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.16.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: inch
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.7.1
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.7.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.11.3
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.11.3
|
27
55
|
- !ruby/object:Gem::Dependency
|
28
56
|
name: rake
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
30
58
|
requirements:
|
31
59
|
- - "~>"
|
32
60
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
61
|
+
version: 12.3.0
|
34
62
|
type: :development
|
35
63
|
prerelease: false
|
36
64
|
version_requirements: !ruby/object:Gem::Requirement
|
37
65
|
requirements:
|
38
66
|
- - "~>"
|
39
67
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
68
|
+
version: 12.3.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: reek
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 4.7.3
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 4.7.3
|
41
83
|
- !ruby/object:Gem::Dependency
|
42
84
|
name: rspec
|
43
85
|
requirement: !ruby/object:Gem::Requirement
|
44
86
|
requirements:
|
45
87
|
- - "~>"
|
46
88
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
89
|
+
version: 3.7.0
|
48
90
|
type: :development
|
49
91
|
prerelease: false
|
50
92
|
version_requirements: !ruby/object:Gem::Requirement
|
51
93
|
requirements:
|
52
94
|
- - "~>"
|
53
95
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
96
|
+
version: 3.7.0
|
55
97
|
- !ruby/object:Gem::Dependency
|
56
98
|
name: rubocop
|
57
99
|
requirement: !ruby/object:Gem::Requirement
|
58
100
|
requirements:
|
59
101
|
- - "~>"
|
60
102
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
103
|
+
version: 0.52.1
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.52.1
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: simplecov
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.15.1
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.15.1
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: webmock
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 3.3.0
|
62
132
|
type: :development
|
63
133
|
prerelease: false
|
64
134
|
version_requirements: !ruby/object:Gem::Requirement
|
65
135
|
requirements:
|
66
136
|
- - "~>"
|
67
137
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
138
|
+
version: 3.3.0
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: yard
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 0.8.7.5
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 0.8.7.5
|
69
153
|
description: ''
|
70
154
|
email:
|
71
|
-
-
|
155
|
+
- me@tkowalewski.pl
|
72
156
|
executables:
|
73
157
|
- ccs
|
74
158
|
extensions: []
|
@@ -78,13 +162,16 @@ files:
|
|
78
162
|
- CODE_OF_CONDUCT.md
|
79
163
|
- LICENSE.txt
|
80
164
|
- README.md
|
81
|
-
-
|
165
|
+
- exe/ccs
|
82
166
|
- lib/ccs.rb
|
167
|
+
- lib/ccs/application.rb
|
83
168
|
- lib/ccs/configuration_file.rb
|
84
169
|
- lib/ccs/decrypter.rb
|
85
170
|
- lib/ccs/downloader.rb
|
171
|
+
- lib/ccs/encrypter.rb
|
172
|
+
- lib/ccs/uploader.rb
|
86
173
|
- lib/ccs/version.rb
|
87
|
-
homepage: https://github.com/
|
174
|
+
homepage: https://github.com/tkowalewski/ccs
|
88
175
|
licenses:
|
89
176
|
- MIT
|
90
177
|
metadata: {}
|
@@ -99,13 +186,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
99
186
|
version: '0'
|
100
187
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
188
|
requirements:
|
102
|
-
- - "
|
189
|
+
- - ">"
|
103
190
|
- !ruby/object:Gem::Version
|
104
|
-
version:
|
191
|
+
version: 1.3.1
|
105
192
|
requirements: []
|
106
193
|
rubyforge_project:
|
107
|
-
rubygems_version: 2.
|
194
|
+
rubygems_version: 2.7.3
|
108
195
|
signing_key:
|
109
196
|
specification_version: 4
|
110
|
-
summary:
|
197
|
+
summary: Configuration Control System (CCS)
|
111
198
|
test_files: []
|
data/bin/ccs
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'ccs'
|
4
|
-
require 'optparse'
|
5
|
-
require 'io/console'
|
6
|
-
|
7
|
-
options = {}
|
8
|
-
|
9
|
-
opt_parser = OptionParser.new do |opt|
|
10
|
-
opt.banner = 'Usage: ccs [OPTIONS] <CCSUri> <LocalPath|STDOUT>'
|
11
|
-
opt.separator ''
|
12
|
-
opt.separator 'Options:'
|
13
|
-
|
14
|
-
opt.on('-t TOKEN', '--token TOKEN', String, 'API Token') do |v|
|
15
|
-
options[:token] = v
|
16
|
-
end
|
17
|
-
|
18
|
-
opt.on('-d', '--decrypt', 'Ask for passphrase and decrypt') do |v|
|
19
|
-
options[:decrypt] = v
|
20
|
-
end
|
21
|
-
|
22
|
-
opt.on('-h','--help', 'help') do
|
23
|
-
puts opt_parser
|
24
|
-
end
|
25
|
-
|
26
|
-
opt.separator ''
|
27
|
-
opt.separator 'Examples:'
|
28
|
-
opt.separator ' ccs -t 8b5a196e-a116-4c64-8472-f7c6e1c2de3b ccs://0.1.0/path/to/file.yml'
|
29
|
-
opt.separator ' ccs -t 8b5a196e-a116-4c64-8472-f7c6e1c2de3b ccs://0.1.0/path/to/file.yml local/path/to/file.yml'
|
30
|
-
|
31
|
-
opt.separator ''
|
32
|
-
opt.separator format('Version: %s', Ccs::VERSION)
|
33
|
-
end
|
34
|
-
|
35
|
-
arguments = opt_parser.parse!
|
36
|
-
|
37
|
-
if ARGV.empty?
|
38
|
-
puts opt_parser
|
39
|
-
exit(-1)
|
40
|
-
end
|
41
|
-
|
42
|
-
raise OptionParser::MissingArgument if options[:token].nil?
|
43
|
-
raise OptionParser::MissingArgument if arguments[0].nil?
|
44
|
-
|
45
|
-
configuration_file = Ccs::ConfigurationFile.new(arguments[0])
|
46
|
-
destination = arguments[1] ? File.new(arguments[1], 'w') : STDOUT
|
47
|
-
|
48
|
-
json = Ccs::Downloader.new(options[:token], configuration_file).download
|
49
|
-
|
50
|
-
if options[:decrypt]
|
51
|
-
print 'Passphrase: '
|
52
|
-
passphrase = STDIN.noecho(&:gets)
|
53
|
-
|
54
|
-
destination.puts Ccs::Decrypter.new(passphrase.chomp, json['encrypted_content']).decrypt
|
55
|
-
else
|
56
|
-
destination.puts json['encrypted_content']
|
57
|
-
end
|