ccs 2.0.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -7
- data/exe/ccs +6 -6
- data/lib/ccs/commands/copy.rb +4 -4
- data/lib/ccs/document.rb +4 -4
- data/lib/ccs/downloader.rb +3 -3
- data/lib/ccs/uploader.rb +3 -3
- data/lib/ccs/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddc7a13cb4e185260a511ead10fd9f75387fecdd42a4138d19e0a0de35cd9caf
|
4
|
+
data.tar.gz: 8c99aa2c31cbd7a66bb1023f8b32872478691268b475b80f9bf6c203ebb978a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c8f8bff758c7917bee0a1f779f5a97594c863d19ae96a673b8ca630cfe0189649d326130c44b622799ce489b9486492c1bf9fb74ee38c6e998167f29a7cb8a5
|
7
|
+
data.tar.gz: 0ac4cd8805f4addd47e7b224a7eff2a7fab360856294aed60444846946d9563c294d415bdbba9f72da3d7fe2f966b1cec18d5f51b97fc615e6a0da49d6da8d94
|
data/README.md
CHANGED
@@ -25,8 +25,8 @@ Or install it yourself as:
|
|
25
25
|
Options:
|
26
26
|
-a CCS_ACCESS_TOKEN, CCS Access Token
|
27
27
|
--access-token
|
28
|
-
-
|
29
|
-
--
|
28
|
+
-p CCS_PASSPHRASE, CCS Passphrase
|
29
|
+
--passphrase
|
30
30
|
|
31
31
|
|
32
32
|
## Example
|
@@ -58,10 +58,10 @@ Upload
|
|
58
58
|
|
59
59
|
destination = 'ccs://workspace-name/0.1.0/path/to/file.yml'
|
60
60
|
access_token = ENV.fetch('CCS_ACCESS_TOKEN')
|
61
|
-
|
61
|
+
passphrase = 'MyPassphrase'
|
62
62
|
content = 'RAILS_ENV=production'
|
63
63
|
|
64
|
-
Ccs::Document.new(destination, access_token,
|
64
|
+
Ccs::Document.new(destination, access_token, passphrase).upload(content)
|
65
65
|
|
66
66
|
Download
|
67
67
|
|
@@ -69,9 +69,9 @@ Download
|
|
69
69
|
|
70
70
|
source = 'ccs://workspace-name/0.1.0/path/to/file.yml'
|
71
71
|
access_token = ENV.fetch('CCS_ACCESS_TOKEN')
|
72
|
-
|
72
|
+
passphrase = 'MyPassphrase'
|
73
73
|
|
74
|
-
Ccs::Document.new(source, access_token,
|
74
|
+
Ccs::Document.new(source, access_token, passphrase).download
|
75
75
|
|
76
76
|
## Development
|
77
77
|
|
@@ -81,7 +81,7 @@ To install this gem onto your local machine, run `bin/rake install`. To release
|
|
81
81
|
|
82
82
|
## Contributing
|
83
83
|
|
84
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
84
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/occson/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.
|
85
85
|
|
86
86
|
|
87
87
|
## License
|
data/exe/ccs
CHANGED
@@ -9,7 +9,7 @@ require 'io/console'
|
|
9
9
|
|
10
10
|
options = {
|
11
11
|
'access_token' => ENV['CCS_ACCESS_TOKEN'],
|
12
|
-
'
|
12
|
+
'passphrase' => ENV['CCS_PASSPHRASE']
|
13
13
|
}
|
14
14
|
|
15
15
|
option_parser = OptionParser.new do |option_parser|
|
@@ -38,14 +38,14 @@ when 'cp'
|
|
38
38
|
options['access_token'] = v
|
39
39
|
end
|
40
40
|
|
41
|
-
option_parser.on('-
|
42
|
-
options['
|
41
|
+
option_parser.on('-p CCS_PASSPHRASE', '--passphrase CCS_PASSPHRASE', String, 'CCS Passphrase') do |v|
|
42
|
+
options['passphrase'] = v
|
43
43
|
end
|
44
44
|
|
45
45
|
option_parser.separator ''
|
46
46
|
option_parser.separator 'Configure via environment variables:'
|
47
47
|
option_parser.separator ' CCS_ACCESS_TOKEN'
|
48
|
-
option_parser.separator '
|
48
|
+
option_parser.separator ' CCS_PASSPHRASE'
|
49
49
|
|
50
50
|
option_parser.separator ''
|
51
51
|
option_parser.separator 'Examples:'
|
@@ -73,11 +73,11 @@ when 'cp'
|
|
73
73
|
end
|
74
74
|
|
75
75
|
raise OptionParser::MissingArgument, 'access_token' unless options['access_token']
|
76
|
-
raise OptionParser::MissingArgument, '
|
76
|
+
raise OptionParser::MissingArgument, 'passphrase' unless options['passphrase']
|
77
77
|
raise OptionParser::MissingArgument, 'source' unless arguments.fetch(0, nil)
|
78
78
|
raise OptionParser::MissingArgument, 'destination' unless arguments.fetch(1, nil)
|
79
79
|
|
80
|
-
exit(1) unless Ccs::Commands::Copy.new(arguments[0], arguments[1], options['access_token'], options['
|
80
|
+
exit(1) unless Ccs::Commands::Copy.new(arguments[0], arguments[1], options['access_token'], options['passphrase']).call
|
81
81
|
else
|
82
82
|
puts option_parser
|
83
83
|
exit(1)
|
data/lib/ccs/commands/copy.rb
CHANGED
@@ -3,11 +3,11 @@
|
|
3
3
|
module Ccs
|
4
4
|
module Commands
|
5
5
|
class Copy
|
6
|
-
def initialize(source, destination, access_token,
|
6
|
+
def initialize(source, destination, access_token, passphrase)
|
7
7
|
@source = source
|
8
8
|
@destination = destination
|
9
9
|
@access_token = access_token
|
10
|
-
@
|
10
|
+
@passphrase = passphrase
|
11
11
|
end
|
12
12
|
|
13
13
|
def call
|
@@ -21,7 +21,7 @@ module Ccs
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def download
|
24
|
-
content = Document.new(@source, @access_token, @
|
24
|
+
content = Document.new(@source, @access_token, @passphrase).download
|
25
25
|
return unless content
|
26
26
|
|
27
27
|
(@destination.eql?('-') ? STDOUT : File.new(@destination, 'w')).print content
|
@@ -29,7 +29,7 @@ module Ccs
|
|
29
29
|
|
30
30
|
def upload
|
31
31
|
content = @source.eql?('-') ? STDIN.read : File.read(@source)
|
32
|
-
Document.new(@destination, @access_token, @
|
32
|
+
Document.new(@destination, @access_token, @passphrase).upload(content)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
data/lib/ccs/document.rb
CHANGED
@@ -2,18 +2,18 @@
|
|
2
2
|
|
3
3
|
module Ccs
|
4
4
|
class Document
|
5
|
-
def initialize(uri, access_token,
|
5
|
+
def initialize(uri, access_token, passphrase)
|
6
6
|
@uri = build_uri(uri)
|
7
7
|
@access_token = access_token
|
8
|
-
@
|
8
|
+
@passphrase = passphrase
|
9
9
|
end
|
10
10
|
|
11
11
|
def upload(content)
|
12
|
-
Uploader.new(@uri, content, @access_token, @
|
12
|
+
Uploader.new(@uri, content, @access_token, @passphrase).call
|
13
13
|
end
|
14
14
|
|
15
15
|
def download
|
16
|
-
Downloader.new(@uri, @access_token, @
|
16
|
+
Downloader.new(@uri, @access_token, @passphrase).call
|
17
17
|
end
|
18
18
|
|
19
19
|
private
|
data/lib/ccs/downloader.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
module Ccs
|
4
4
|
class Downloader
|
5
|
-
def initialize(uri, access_token,
|
5
|
+
def initialize(uri, access_token, passphrase)
|
6
6
|
@uri = uri
|
7
7
|
@access_token = access_token
|
8
|
-
@
|
8
|
+
@passphrase = passphrase
|
9
9
|
end
|
10
10
|
|
11
11
|
def call
|
@@ -14,7 +14,7 @@ module Ccs
|
|
14
14
|
return unless response.code.eql? '200'
|
15
15
|
json = JSON.parse body
|
16
16
|
|
17
|
-
Decrypter.new(@
|
17
|
+
Decrypter.new(@passphrase, json['encrypted_content']).call
|
18
18
|
end
|
19
19
|
|
20
20
|
private
|
data/lib/ccs/uploader.rb
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
module Ccs
|
4
4
|
class Uploader
|
5
|
-
def initialize(uri, content, access_token,
|
5
|
+
def initialize(uri, content, access_token, passphrase)
|
6
6
|
@uri = uri
|
7
7
|
@content = content
|
8
8
|
@access_token = access_token
|
9
|
-
@
|
9
|
+
@passphrase = passphrase
|
10
10
|
end
|
11
11
|
|
12
12
|
def call
|
@@ -36,7 +36,7 @@ module Ccs
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def encrypted_content
|
39
|
-
@encrypted_content ||= Encrypter.new(@
|
39
|
+
@encrypted_content ||= Encrypter.new(@passphrase, @content, salt).call
|
40
40
|
end
|
41
41
|
|
42
42
|
def salt
|
data/lib/ccs/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ccs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tkowalewski
|
8
|
+
- paweljw
|
8
9
|
autorequire:
|
9
10
|
bindir: exe
|
10
11
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
12
|
+
date: 2020-10-23 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: inch
|
@@ -139,6 +140,7 @@ dependencies:
|
|
139
140
|
description: ''
|
140
141
|
email:
|
141
142
|
- me@tkowalewski.pl
|
143
|
+
- p@steamshard.net
|
142
144
|
executables:
|
143
145
|
- ccs
|
144
146
|
extensions: []
|
@@ -157,7 +159,7 @@ files:
|
|
157
159
|
- lib/ccs/encrypter.rb
|
158
160
|
- lib/ccs/uploader.rb
|
159
161
|
- lib/ccs/version.rb
|
160
|
-
homepage: https://github.com/
|
162
|
+
homepage: https://github.com/occson/ccs
|
161
163
|
licenses:
|
162
164
|
- MIT
|
163
165
|
metadata: {}
|