rgc 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 +4 -4
- data/README.rdoc +2 -2
- data/lib/rgc.rb +2 -0
- data/lib/rgc/arg_parser.rb +0 -1
- data/lib/rgc/clean.rb +2 -11
- data/lib/rgc/init.rb +21 -4
- data/lib/rgc/smudge.rb +5 -9
- data/lib/rgc/version.rb +1 -1
- metadata +28 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 023b16d76f8557b13b914965412bb57e8a8c9ed0
|
4
|
+
data.tar.gz: 0190b97aa7991de15a1b0c5324e61240d718457f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 686c3d673845c20f984aa92f0f247ef8978906ed75c0a8547c559972aabd12cc7cd81109dc5abfcf9b4afd0e9089b80a2bf226b9220e4281e3da7b558d5754f9
|
7
|
+
data.tar.gz: c677191c468b9494a29ac622b4092d219683acdde41049b51ac0ced1ddee943d9c91dda7036493c6ad3195bb4e3fac1a2c16ea5f3144c738733bb5ae56122cb4
|
data/README.rdoc
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
= rgc
|
2
2
|
|
3
|
+
*rgc is still in development and it is not working yet. Please don't use it in your repositories!*
|
4
|
+
|
3
5
|
+rgc+ enables you to transparently encrypt certain files in a git repository. You can even encrypt certain values in a +yaml+ file. Files which you choose to protect are encrypted when committed, and decrypted when checked out. This way you can freely share your git repo containing mix of public and private content. Developers without the secret key can still clone and commit to repository.
|
4
6
|
|
5
7
|
+rgc+ was written by Jiri Chara <jirik dot chara at gmail dot com>.
|
@@ -13,5 +15,3 @@
|
|
13
15
|
Get a help:
|
14
16
|
|
15
17
|
rgc help
|
16
|
-
|
17
|
-
:include:rgc.rdoc
|
data/lib/rgc.rb
CHANGED
@@ -14,6 +14,8 @@ module Rgc
|
|
14
14
|
autoload :Init, 'rgc/init'
|
15
15
|
autoload :Encrypt, 'rgc/encrypt'
|
16
16
|
autoload :ArgParser, 'rgc/arg_parser'
|
17
|
+
autoload :Processor, 'rgc/processor'
|
17
18
|
autoload :Clean, 'rgc/clean'
|
18
19
|
autoload :Smudge, 'rgc/smudge'
|
20
|
+
autoload :Diff, 'rgc/diff'
|
19
21
|
end
|
data/lib/rgc/arg_parser.rb
CHANGED
data/lib/rgc/clean.rb
CHANGED
@@ -1,20 +1,11 @@
|
|
1
1
|
module Rgc
|
2
2
|
class Clean
|
3
|
-
include Rgc::KeyFile
|
4
|
-
|
5
3
|
def initialize(global_options, options, args)
|
6
|
-
|
7
|
-
|
8
|
-
print(encrypt(ARGF.read))
|
4
|
+
STDOUT.write(encrypt(ARGF.read))
|
9
5
|
end
|
10
6
|
|
11
7
|
def encrypt(content)
|
12
|
-
|
13
|
-
@aes.encrypt
|
14
|
-
@aes.key = @key
|
15
|
-
# TODO: consinder to set @aes.iv
|
16
|
-
|
17
|
-
Base64.encode64(@aes.update(content) + @aes.final)
|
8
|
+
Rgc::Processor.encrypt(content)
|
18
9
|
end
|
19
10
|
end
|
20
11
|
end
|
data/lib/rgc/init.rb
CHANGED
@@ -20,10 +20,15 @@ module Rgc
|
|
20
20
|
end
|
21
21
|
|
22
22
|
unless stdout.length == 0
|
23
|
-
|
23
|
+
STDERR.puts "Working directory not clean"
|
24
24
|
abort "Please commit your changes or 'git stash' them."
|
25
25
|
end
|
26
26
|
|
27
|
+
stdout, stderr, status = Open3.capture3("git rev-parse --show-prefix")
|
28
|
+
if stdout.strip != ""
|
29
|
+
abort "Not in top-level of repository"
|
30
|
+
end
|
31
|
+
|
27
32
|
init_rgc_config_file
|
28
33
|
|
29
34
|
unless File.exist?('.gitattributes')
|
@@ -35,6 +40,15 @@ module Rgc
|
|
35
40
|
end
|
36
41
|
|
37
42
|
add_git_config_options
|
43
|
+
|
44
|
+
# Do a force checkout so any files that were previously checked out
|
45
|
+
# encrypted will now be checked out decrypted.
|
46
|
+
# If HEAD doesn't exist (perhaps because this repo doesn't have any files
|
47
|
+
# yet) just skip checkout
|
48
|
+
out, err, status = Open3.capture3("git rev-parse HEAD >/dev/null 2>/dev/null")
|
49
|
+
if status == 0
|
50
|
+
out, err, status = Open3.capture3("git checkout -f HEAD -- .")
|
51
|
+
end
|
38
52
|
end
|
39
53
|
|
40
54
|
def init_rgc_config_file
|
@@ -56,13 +70,16 @@ module Rgc
|
|
56
70
|
end
|
57
71
|
|
58
72
|
def add_git_config_options
|
59
|
-
smudge = "git config filter.smudge \"rgc smudge\""
|
73
|
+
smudge = "git config filter.rgc.smudge \"rgc smudge\""
|
60
74
|
stdout, stderr, status_smudge = Open3.capture3(smudge)
|
61
75
|
|
62
|
-
clean = "git config filter.clean \"rgc clean\""
|
76
|
+
clean = "git config filter.rgc.clean \"rgc clean\""
|
63
77
|
stdout, stderr, status_clean = Open3.capture3(clean)
|
64
78
|
|
65
|
-
|
79
|
+
diff = "git config diff.rgc.textconv \"rgc diff\""
|
80
|
+
stdout, stderr, status_diff = Open3.capture3(diff)
|
81
|
+
|
82
|
+
if [0, 0, 0] != [status_smudge, status_clean, status_diff]
|
66
83
|
abort "Cannot configure git."
|
67
84
|
end
|
68
85
|
rescue Errno::ENOENT
|
data/lib/rgc/smudge.rb
CHANGED
@@ -1,19 +1,15 @@
|
|
1
1
|
module Rgc
|
2
2
|
class Smudge
|
3
|
-
include Rgc::KeyFile
|
4
|
-
|
5
3
|
def initialize(global_options, options, args)
|
6
|
-
|
7
|
-
|
8
|
-
print(decrypt(ARGF.read))
|
4
|
+
STDOUT.write(decrypt(ARGF.read))
|
9
5
|
end
|
10
6
|
|
11
7
|
def decrypt(content)
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
if content.gsub!(/^\*@rgc@\*-/, '') == nil
|
9
|
+
abort 'File not encrypted.'
|
10
|
+
end
|
15
11
|
|
16
|
-
|
12
|
+
Rgc::Processor.decrypt(content)
|
17
13
|
end
|
18
14
|
end
|
19
15
|
end
|
data/lib/rgc/version.rb
CHANGED
metadata
CHANGED
@@ -1,97 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rgc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jiri Chara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '10.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
26
|
version: '10.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rdoc
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '4.1'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '4.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: aruba
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0.5'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0.5'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '2.14'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '2.14'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: faker
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ~>
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '1.2'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ~>
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1.2'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: gli
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ~>
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '2.8'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ~>
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '2.8'
|
97
97
|
description: rgc is a tool for encrypting certain files in a git repository.
|
@@ -104,18 +104,18 @@ extra_rdoc_files:
|
|
104
104
|
- LICENCE.txt
|
105
105
|
- rgc.rdoc
|
106
106
|
files:
|
107
|
-
- LICENCE.txt
|
108
|
-
- README.rdoc
|
109
107
|
- bin/rgc
|
110
108
|
- lib/rgc.rb
|
111
|
-
- lib/rgc/
|
112
|
-
- lib/rgc/clean.rb
|
113
|
-
- lib/rgc/encrypt.rb
|
114
|
-
- lib/rgc/init.rb
|
109
|
+
- lib/rgc/version.rb
|
115
110
|
- lib/rgc/key_file.rb
|
116
111
|
- lib/rgc/keygen.rb
|
112
|
+
- lib/rgc/init.rb
|
113
|
+
- lib/rgc/encrypt.rb
|
114
|
+
- lib/rgc/arg_parser.rb
|
115
|
+
- lib/rgc/clean.rb
|
117
116
|
- lib/rgc/smudge.rb
|
118
|
-
-
|
117
|
+
- README.rdoc
|
118
|
+
- LICENCE.txt
|
119
119
|
- rgc.rdoc
|
120
120
|
homepage: https://github.com/JiriChara/rgc
|
121
121
|
licenses:
|
@@ -123,27 +123,28 @@ licenses:
|
|
123
123
|
metadata: {}
|
124
124
|
post_install_message:
|
125
125
|
rdoc_options:
|
126
|
-
-
|
126
|
+
- --title
|
127
127
|
- rgc
|
128
|
-
-
|
128
|
+
- --main
|
129
129
|
- README.rdoc
|
130
|
-
-
|
130
|
+
- -ri
|
131
131
|
require_paths:
|
132
132
|
- lib
|
133
133
|
required_ruby_version: !ruby/object:Gem::Requirement
|
134
134
|
requirements:
|
135
|
-
- -
|
135
|
+
- - '>='
|
136
136
|
- !ruby/object:Gem::Version
|
137
137
|
version: '0'
|
138
138
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
139
|
requirements:
|
140
|
-
- -
|
140
|
+
- - '>='
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '0'
|
143
143
|
requirements: []
|
144
144
|
rubyforge_project:
|
145
|
-
rubygems_version: 2.
|
145
|
+
rubygems_version: 2.0.3
|
146
146
|
signing_key:
|
147
147
|
specification_version: 4
|
148
148
|
summary: Tool for encrypting files in a git repository.
|
149
149
|
test_files: []
|
150
|
+
has_rdoc: true
|