waxseal 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,8 @@
1
+ Copyright 2013 Barry Allard <barry.allard@gmail.com>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8
+
data/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # waxseal
2
+
3
+ ## Install
4
+
5
+ [sudo] gem install waxseal
6
+
7
+ ## Usage
8
+
9
+ Usage: waxseal [options]
10
+ -c, --commit Make a new git commit automatically. can also set WAXSEAL_AUTO_COMMIT=1
11
+ -e, --email EMAIL Email address to use for signing, overrides optional variable WAXSEAL_GEM_SIGNING_EMAIL
12
+ -f, --force No prompts. Can also be set by WAXSEAL_NO_CONFIRM=1
13
+ -h, --help
14
+
15
+ ## License
16
+
17
+ MIT
data/bin/waxseal ADDED
@@ -0,0 +1,133 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fileutils'
3
+ require 'optparse'
4
+ require 'rubygems'
5
+ require 'shellwords'
6
+
7
+ PERSONAL_KEY_PATH = '~/.keys'
8
+
9
+ PRIVATE_KEY_FILENAME = 'gem-private_key.pem'
10
+ PUBLIC_CERT_FILENAME = 'gem-public_cert.pem'
11
+
12
+ def die(message)
13
+ $stderr.puts("\n ! #{message}\n\n")
14
+ exit 1
15
+ end
16
+
17
+ trap('INT') {
18
+ $stderr.puts
19
+ die 'User interrupted'
20
+ }
21
+
22
+ def gemspec_file
23
+ result = Dir['*.gemspec']
24
+ fail '.gemspec missing' unless result.size > 0
25
+ fail 'multiple *.gemspec files, cant decide' unless result.size == 1
26
+ return result[0]
27
+ end
28
+
29
+ def gemspec
30
+ return @@gemspec ||= Gem::Specification.load(gemspec_file)
31
+ end
32
+
33
+ def signable?
34
+ return !!gemspec.cert_chain && !!gemspec.signing_key
35
+ end
36
+
37
+ def ask(prompt)
38
+ print prompt
39
+ return gets.chop
40
+ end
41
+
42
+ def email
43
+ result = ENV['WAXSEAL_GEM_SIGNING_EMAIL'] || ask('Enter the email address (yours, perhaps) to be used for signing ruby gems > ')
44
+ fail 'Email address cannot be blank' unless result.is_a?(String) && result.length > 0
45
+ return result
46
+ end
47
+
48
+
49
+ def check_key(confirm = true)
50
+ keys_path = File.expand_path(PERSONAL_KEY_PATH)
51
+ FileUtils.mkdir_p(keys_path)
52
+ public_cert = ''
53
+ FileUtils.cd(keys_path) do
54
+ unless File.exist?(PRIVATE_KEY_FILENAME) && File.exist?(PUBLIC_CERT_FILENAME)
55
+ if confirm
56
+ unless ask("Generate #{PRIVATE_KEY_FILENAME} and #{PUBLIC_CERT_FILENAME}? [Yn]: ").downcase == 'y'
57
+ fail 'User aborted'
58
+ end
59
+ end
60
+ unless system "gem cert --build #{Shellwords.escape(email)} | sed \"s%gem.*\.pem$%`pwd`/&%g\""
61
+ fail 'Could not create certificates for gem signing'
62
+ end
63
+ end
64
+ FileUtils.chmod(0600, PRIVATE_KEY_FILENAME)
65
+ FileUtils.chmod(0644, PUBLIC_CERT_FILENAME)
66
+ unless system "gem cert --add #{PUBLIC_CERT_FILENAME}"
67
+ fail 'Could not add certificate to trusted gem cert list'
68
+ end
69
+ public_cert = File.join(FileUtils.pwd, PUBLIC_CERT_FILENAME)
70
+ end
71
+ unless File.exist?(PUBLIC_CERT_FILENAME)
72
+ FileUtils.cp(public_cert, PUBLIC_CERT_FILENAME)
73
+ end
74
+ end
75
+
76
+ def make_signable(confirm = true)
77
+ return if signable?
78
+ if confirm
79
+ unless ask("Setup #{gemspec_file} for signing? [Yn]: ") == 'y'
80
+ fail 'User aborted'
81
+ end
82
+ end
83
+ File.open(gemspec_file, 'a') do |f|
84
+ f.puts(".tap {|gem| gem.signing_key = File.expand_path(File.join('#{PERSONAL_KEY_PATH}', '#{PRIVATE_KEY_FILENAME}')) ; gem.cert_chain = ['#{PUBLIC_CERT_FILENAME}']} # pressed firmly by waxseal")
85
+ end
86
+
87
+ puts "updated #{gemspec_file} for signing"
88
+ end
89
+
90
+
91
+
92
+ def run(confirm, commit)
93
+ check_key(confirm)
94
+ make_signable(confirm)
95
+ if commit
96
+ unless system "git add *.gemspec #{PUBLIC_CERT_FILENAME} && git commit -m 'enable gem signing: stamped with waxseal'"
97
+ fail "Could not commit changes made by waxseal, please save changed *.gemspec and #{PUBLIC_CERT_FILENAME}"
98
+ end
99
+ end
100
+ end
101
+
102
+ def set_email(email_address)
103
+ ENV['WAXSEAL_GEM_SIGNING_EMAIL'] = email_address
104
+ unless ENV['WAXSEAL_GEM_SIGNING_EMAIL'] && ENV['WAXSEAL_GEM_SIGNING_EMAIL'].length
105
+ fail 'missing email address'
106
+ end
107
+ end
108
+
109
+ if ENV['WAXSEAL_NO_CONFIRM'] == '1'
110
+ $confirm = false
111
+ else
112
+ $confirm = true
113
+ end
114
+
115
+ if ENV['WAXSEAL_AUTO_COMMIT'] == '1'
116
+ $commit = true
117
+ else
118
+ $commit = false
119
+ end
120
+
121
+ OptionParser.new do |o|
122
+ o.on('-c', '--commit', "Make a new git commit automatically. can also set WAXSEAL_AUTO_COMMIT=1") { $commit = true }
123
+ o.on('-e', '--email EMAIL', "Email address to use for signing, overrides optional variable WAXSEAL_GEM_SIGNING_EMAIL") { |email| set_email(email) }
124
+ o.on('-f', '--force', "No prompts. Can also be set by WAXSEAL_NO_CONFIRM=1") { $confirm = false }
125
+ o.on('-h', '--help') { $stderr.puts o ; exit 1 }
126
+ o.parse!
127
+ end
128
+
129
+ begin
130
+ run($confirm, $commit)
131
+ rescue RuntimeError => e
132
+ die e.message
133
+ end
@@ -0,0 +1,3 @@
1
+ module Waxseal
2
+ VERSION = '0.0.0'
3
+ end
data.tar.gz.sig ADDED
@@ -0,0 +1,5 @@
1
+ ~{��H>��U
2
+ ��
3
+ �ged����� C�eg��ʮ�e=���Y�ta��}�AJ
4
+ P.2l�gA� �{���@��R��yhB��:���ta�Ϝ��
5
+ ��
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: waxseal
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Barry Allard
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain:
12
+ - !binary |-
13
+ LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURPakNDQWlLZ0F3SUJB
14
+ Z0lCQURBTkJna3Foa2lHOXcwQkFRVUZBREJETVJVd0V3WURWUVFEREF4aVlY
15
+ SnkKZVM1aGJHeGhjbVF4RlRBVEJnb0praWFKay9Jc1pBRVpGZ1ZuYldGcGJE
16
+ RVRNQkVHQ2dtU0pvbVQ4aXhrQVJrVwpBMk52YlRBZUZ3MHhNekEwTURnd01U
17
+ STBOVGhhRncweE5EQTBNRGd3TVRJME5UaGFNRU14RlRBVEJnTlZCQU1NCkRH
18
+ Smhjbko1TG1Gc2JHRnlaREVWTUJNR0NnbVNKb21UOGl4a0FSa1dCV2R0WVds
19
+ c01STXdFUVlLQ1pJbWlaUHkKTEdRQkdSWURZMjl0TUlJQklqQU5CZ2txaGtp
20
+ Rzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ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VnF3d2ZZK01zM2dj
37
+ Q0hTRVJHMVg0QUZXMXplc1grVVdjVEN3Vkx0QXN1UldRaEM4b2REU1ZEV3pV
38
+ ZmtabU9RdApWaUl4VTFacGhJbnFsN0w1ZzM0PQotLS0tLUVORCBDRVJUSUZJ
39
+ Q0FURS0tLS0tCg==
40
+ date: 2013-04-08 00:00:00.000000000 Z
41
+ dependencies:
42
+ - !ruby/object:Gem::Dependency
43
+ name: rspec
44
+ requirement: !ruby/object:Gem::Requirement
45
+ none: false
46
+ requirements:
47
+ - - ! '>='
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ type: :development
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ - !ruby/object:Gem::Dependency
59
+ name: shoulda
60
+ requirement: !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ! '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ description: ! ' Adds certificate stuff to your gems.
75
+
76
+ '
77
+ email:
78
+ - barry.allard@gmail.com
79
+ executables:
80
+ - waxseal
81
+ extensions: []
82
+ extra_rdoc_files: []
83
+ files:
84
+ - lib/waxseal/version.rb
85
+ - LICENSE
86
+ - README.md
87
+ - bin/waxseal
88
+ homepage: https://github.com/steakknife/waxseal
89
+ licenses:
90
+ - MIT
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ! '>='
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ none: false
103
+ requirements:
104
+ - - ! '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 1.8.23
110
+ signing_key:
111
+ specification_version: 3
112
+ summary: Sign thee gems with a fancy, vintage wax seal
113
+ test_files: []
114
+ has_rdoc:
metadata.gz.sig ADDED
@@ -0,0 +1 @@
1
+ p�Y���F(���\Q�o����t����\�x��]{r��.�g��rϐ�1NXjZ�+��R��qS�ȴ�{��]q�3��Pq}����PӍ؏��գ�((���^�+�~� 1�8lp�K�N�8NަXX`� �Ed�ܟ�3�����b/ �j܏�~���<���