keycutter 0.2.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +29 -0
- data/Gemfile +1 -1
- data/README.md +27 -24
- data/features/add.feature +3 -3
- data/features/default.feature +2 -2
- data/features/list.feature +3 -3
- data/features/remove.feature +2 -2
- data/features/step_definitions/keycutter_steps.rb +5 -6
- data/keycutter.gemspec +1 -0
- data/lib/keycutter/configuration.rb +4 -4
- data/lib/keycutter/version.rb +1 -1
- data/spec/configuration_spec.rb +5 -5
- data/spec/spec_helper.rb +4 -0
- metadata +26 -42
- data/.rvmrc +0 -1
- data/CHANGELOG +0 -7
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2e7d571fe04c0cb4876f243c393e46adb6dc1d77
|
4
|
+
data.tar.gz: 1ca75d895460d33d14bb9d84b4efb98ecb32825a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 650f97d0bf40797017af5cb62ea91a7f8d523653334b893c3022a6b32e84476096b789f72a01c934d577fa25e465fdd4a93b5e8f8837234a78aaca70ef0ca5d6
|
7
|
+
data.tar.gz: f3d4e02875759d791c1403342c38f628b092a84895f7b9396446f5c0a2c82f14768ce67c046387677e008377d406feaea36ccb4ec8e7cfee1f7d113de09f1a5f
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
keycutter
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.3.3
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
## Change Log
|
2
|
+
|
3
|
+
### 1.0.0
|
4
|
+
|
5
|
+
#### Fixed
|
6
|
+
|
7
|
+
* the default key will now correctly be reported in all scenarios.
|
8
|
+
|
9
|
+
* adding a new key when there is no ~/.gem/credentials file will now no
|
10
|
+
longer erroneously put the contents of the ~/.gemrc in the newly created
|
11
|
+
credentials file.
|
12
|
+
|
13
|
+
* adding a new key when there is no ~/.gem/credentials file will now create
|
14
|
+
the credentials file with 0600 permissions.
|
15
|
+
|
16
|
+
#### Changed
|
17
|
+
|
18
|
+
* api keys will no longer default to being pulled from the ~/.gemrc when the
|
19
|
+
~/.gem/credentials file does not exist. This behavior was previously not
|
20
|
+
explicitly dealt with in this library, but removing support could potentially
|
21
|
+
be a breaking change for some people so the major version is being bumped.
|
22
|
+
|
23
|
+
### 0.1.1
|
24
|
+
|
25
|
+
* Lazy load Keycutter after the command has been invoked
|
26
|
+
|
27
|
+
### 0.1.0
|
28
|
+
|
29
|
+
* Initial release
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -13,35 +13,45 @@ Installation
|
|
13
13
|
Usage
|
14
14
|
-----
|
15
15
|
|
16
|
-
|
16
|
+
Use the `gem keys` command to manage multiple API keys. Upon installation,
|
17
|
+
keycutter will only know about your existing rubygems key:
|
17
18
|
|
18
|
-
$ gem keys --
|
19
|
+
$ gem keys --list
|
20
|
+
|
21
|
+
*** CURRENT KEYS ***
|
22
|
+
|
23
|
+
* rubygems
|
24
|
+
|
25
|
+
If you manage gems for your company or an open-source organization, you can add
|
26
|
+
additional keys:
|
27
|
+
|
28
|
+
$ gem keys --add work
|
19
29
|
Email:
|
20
30
|
Password:
|
21
31
|
|
22
|
-
You'll be prompted for your Rubygems.org email and password.
|
23
|
-
for your company or an open-source organization, add those too:
|
32
|
+
You'll be prompted for your Rubygems.org email and password.
|
24
33
|
|
25
|
-
|
26
|
-
|
34
|
+
If you're using RubyGems 1.4.1 or higher, you can pass the `--host` option to
|
35
|
+
use a gemcutter-compatible host when adding a key:
|
27
36
|
|
28
|
-
|
37
|
+
$ gem keys --add internal --host http://gems.mycompany.com
|
29
38
|
|
30
|
-
|
31
|
-
|
32
|
-
*** CURRENT KEYS ***
|
39
|
+
By default, your existing rubygems.org key is used whenever communicating with
|
40
|
+
gemcutter. To switch the default key used to manage remote gems:
|
33
41
|
|
34
|
-
|
35
|
-
* personal
|
36
|
-
project
|
42
|
+
$ gem keys --default work
|
37
43
|
|
38
|
-
Your
|
44
|
+
Your default key is always marked with a *:
|
39
45
|
|
40
|
-
|
46
|
+
$ gem keys --list
|
41
47
|
|
42
|
-
|
48
|
+
*** CURRENT KEYS ***
|
43
49
|
|
44
|
-
|
50
|
+
internal
|
51
|
+
rubygems
|
52
|
+
* work
|
53
|
+
|
54
|
+
You can also remove keys:
|
45
55
|
|
46
56
|
$ gem keys --remove project
|
47
57
|
|
@@ -49,10 +59,3 @@ Help is available from the command line:
|
|
49
59
|
|
50
60
|
$ gem keys --help
|
51
61
|
|
52
|
-
TODO
|
53
|
-
----
|
54
|
-
|
55
|
-
* Add auto-detection of existing API key and create a default key name
|
56
|
-
* Rubygems 1.3.7 doesn't support gemcutter-compatible hosts, although this has
|
57
|
-
been added to edge. Update `keys --add` to take a `--host` option when the next
|
58
|
-
version of rubygems is released.
|
data/features/add.feature
CHANGED
@@ -5,7 +5,7 @@ Feature: Adding keys
|
|
5
5
|
|
6
6
|
Scenario Outline: Adding a new key
|
7
7
|
Given a valid gemcutter account
|
8
|
-
When I run
|
8
|
+
When I run `gem keys <command> <key>` interactively
|
9
9
|
And I type "josh@vitamin-j.com"
|
10
10
|
And I type "12345"
|
11
11
|
Then the output should contain "Added <key> API key"
|
@@ -19,7 +19,7 @@ Feature: Adding keys
|
|
19
19
|
|
20
20
|
Scenario: Adding a key with bad credentials
|
21
21
|
Given an invalid gemcutter account
|
22
|
-
When I run
|
22
|
+
When I run `gem keys -a bogus` interactively
|
23
23
|
And I type "josh@vitamin-j.com"
|
24
24
|
And I type "12345"
|
25
25
|
Then the output should contain "Access denied"
|
@@ -29,7 +29,7 @@ Feature: Adding keys
|
|
29
29
|
Scenario: Adding a key from a compatible host
|
30
30
|
Given a gemcutter host at "https://nubygems.org"
|
31
31
|
And a valid gemcutter account
|
32
|
-
When I run
|
32
|
+
When I run `gem keys --add personal --host https://nubygems.org` interactively
|
33
33
|
And I type "josh@vitamin-j.com"
|
34
34
|
And I type "12345"
|
35
35
|
Then the output should contain "Enter your nubygems.org credentials"
|
data/features/default.feature
CHANGED
@@ -11,7 +11,7 @@ Feature: Using gem keys
|
|
11
11
|
|
12
12
|
Scenario Outline: Using a different key
|
13
13
|
Given my current rubygems key is "work"
|
14
|
-
When I run
|
14
|
+
When I run `gem keys <command> <key>`
|
15
15
|
Then the output should contain "Now using <key> API key"
|
16
16
|
And my current rubygems key should be "<key>"
|
17
17
|
|
@@ -23,7 +23,7 @@ Feature: Using gem keys
|
|
23
23
|
|
24
24
|
Scenario: Using a bogus key
|
25
25
|
Given my current rubygems key is "personal"
|
26
|
-
When I run
|
26
|
+
When I run `gem keys -d bogus`
|
27
27
|
Then the output should contain "No such API key. You can add it with: gem keys -a bogus"
|
28
28
|
And the exit status should be 1
|
29
29
|
And my current rubygems key should be "personal"
|
data/features/list.feature
CHANGED
@@ -4,7 +4,7 @@ Feature: Default commands
|
|
4
4
|
So I can put keycutter to best use
|
5
5
|
|
6
6
|
Scenario: Installing the gem
|
7
|
-
When I run
|
7
|
+
When I run `gem q`
|
8
8
|
Then the output should contain "keycutter"
|
9
9
|
|
10
10
|
Scenario: Calling the plugin with no options
|
@@ -15,7 +15,7 @@ Feature: Default commands
|
|
15
15
|
|oss_1 |33333333333333333333333333333333|
|
16
16
|
|oss_2 |44444444444444444444444444444444|
|
17
17
|
And my current rubygems key is "rubygems"
|
18
|
-
When I run
|
18
|
+
When I run `gem keys`
|
19
19
|
Then the output should contain:
|
20
20
|
"""
|
21
21
|
*** CURRENT KEYS ***
|
@@ -32,7 +32,7 @@ Feature: Default commands
|
|
32
32
|
|rubygems|11111111111111111111111111111111|
|
33
33
|
|work |22222222222222222222222222222222|
|
34
34
|
And my current rubygems key is "work"
|
35
|
-
When I run
|
35
|
+
When I run `gem keys <option>`
|
36
36
|
Then the output should contain:
|
37
37
|
"""
|
38
38
|
*** CURRENT KEYS ***
|
data/features/remove.feature
CHANGED
@@ -10,7 +10,7 @@ Feature: Remove API keys
|
|
10
10
|
|work |22222222222222222222222222222222|
|
11
11
|
|
12
12
|
Scenario Outline:
|
13
|
-
When I run
|
13
|
+
When I run `gem keys <command> <key>`
|
14
14
|
Then the output should contain "Removed <key> API key"
|
15
15
|
And I should not have a "<key>" api key
|
16
16
|
|
@@ -20,5 +20,5 @@ Feature: Remove API keys
|
|
20
20
|
|--remove|work |
|
21
21
|
|
22
22
|
Scenario: Removing a bogus key
|
23
|
-
When I run
|
23
|
+
When I run `gem keys -r bogus`
|
24
24
|
Then the output should contain "No such API key"
|
@@ -26,23 +26,22 @@ Given /^a gemcutter host at "([^"]*)"$/ do |host|
|
|
26
26
|
set_env 'FAKEWEB_HOST', host
|
27
27
|
end
|
28
28
|
|
29
|
-
|
30
29
|
Then /^my current rubygems key should be "([^"]*)"$/ do |key|
|
31
|
-
Gem.configuration.
|
32
|
-
Gem.configuration.rubygems_api_key.
|
30
|
+
Gem.configuration.load_api_keys
|
31
|
+
expect(Gem.configuration.rubygems_api_key).to eq(Gem.configuration.api_keys[key.to_sym])
|
33
32
|
end
|
34
33
|
|
35
34
|
Then /^I should have a "([^"]*)" api key$/ do |key|
|
36
35
|
Gem.configuration.load_api_keys
|
37
|
-
Gem.configuration.api_keys.
|
36
|
+
expect(Gem.configuration.api_keys).to have_key(key.to_sym)
|
38
37
|
end
|
39
38
|
|
40
39
|
Then /^I should not have a "([^"]*)" api key$/ do |key|
|
41
40
|
Gem.configuration.load_api_keys
|
42
|
-
Gem.configuration.api_keys.
|
41
|
+
expect(Gem.configuration.api_keys).not_to have_key(key.to_sym)
|
43
42
|
end
|
44
43
|
|
45
44
|
Then /^the "([^"]*)" api key should be the response body$/ do |key|
|
46
45
|
Gem.configuration.load_api_keys
|
47
|
-
Gem.configuration.api_keys[key.to_sym].
|
46
|
+
expect(Gem.configuration.api_keys[key.to_sym]).to eq(ENV['FAKEWEB_BODY'])
|
48
47
|
end
|
data/keycutter.gemspec
CHANGED
@@ -13,7 +13,7 @@ class Gem::ConfigFile
|
|
13
13
|
|
14
14
|
require 'yaml'
|
15
15
|
|
16
|
-
File.open(credentials_path, 'w') do |f|
|
16
|
+
File.open(credentials_path, 'w', 0600) do |f|
|
17
17
|
f.write keys.to_yaml
|
18
18
|
end
|
19
19
|
|
@@ -21,10 +21,10 @@ class Gem::ConfigFile
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def load_api_keys
|
24
|
-
@api_keys = File.exists?(credentials_path) ? load_file(credentials_path) :
|
24
|
+
@api_keys = File.exists?(credentials_path) ? load_file(credentials_path) : {}
|
25
25
|
if @api_keys.key?(:rubygems_api_key)
|
26
|
-
rubygems_api_key = @api_keys.delete(:rubygems_api_key)
|
27
|
-
@api_keys[:rubygems] = rubygems_api_key unless @api_keys.key?(:rubygems)
|
26
|
+
@rubygems_api_key = @api_keys.delete(:rubygems_api_key)
|
27
|
+
@api_keys[:rubygems] = @rubygems_api_key unless @api_keys.key?(:rubygems)
|
28
28
|
end
|
29
29
|
@api_keys
|
30
30
|
end
|
data/lib/keycutter/version.rb
CHANGED
data/spec/configuration_spec.rb
CHANGED
@@ -4,20 +4,20 @@ describe Gem::ConfigFile do
|
|
4
4
|
before do
|
5
5
|
@credentials = File.dirname(__FILE__) + '/../test_credentials'
|
6
6
|
@config = Gem::ConfigFile.new([])
|
7
|
-
@config.
|
7
|
+
allow(@config).to receive(:credentials_path) { @credentials }
|
8
8
|
end
|
9
9
|
|
10
10
|
describe "#api_keys" do
|
11
11
|
it "should load from credentials file" do
|
12
12
|
credentials = {:personal => '1'*32, :work => '2'*32}
|
13
13
|
File.open(@credentials, 'w') { |f| f.write credentials.to_yaml }
|
14
|
-
@config.api_keys.
|
14
|
+
expect(@config.api_keys).to eq(credentials)
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should add existing rubygems key to the hash" do
|
18
18
|
credentials = {:rubygems_api_key => '0'*32}
|
19
19
|
File.open(@credentials, 'w') { |f| f.write credentials.to_yaml }
|
20
|
-
@config.api_keys.
|
20
|
+
expect(@config.api_keys).to eq({:rubygems => '0'*32})
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -27,7 +27,7 @@ describe Gem::ConfigFile do
|
|
27
27
|
accounts = {:personal => '1'*32, :work => '2'*32}
|
28
28
|
@config.api_keys = accounts
|
29
29
|
|
30
|
-
File.read(@credentials).
|
30
|
+
expect(File.read(@credentials)).to eq(accounts.to_yaml)
|
31
31
|
end
|
32
32
|
|
33
33
|
it "should preserve existing credentials" do
|
@@ -35,7 +35,7 @@ describe Gem::ConfigFile do
|
|
35
35
|
@config.api_keys = {:personal => '1'*32, :work => '2'*32}
|
36
36
|
|
37
37
|
credentials = YAML.load_file(@credentials)
|
38
|
-
credentials[:rubygems_api_key].
|
38
|
+
expect(credentials[:rubygems_api_key]).to eq('0'*32)
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,36 +1,26 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: keycutter
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 0
|
7
|
-
- 2
|
8
|
-
- 0
|
9
|
-
version: 0.2.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
10
5
|
platform: ruby
|
11
|
-
authors:
|
6
|
+
authors:
|
12
7
|
- Josh French
|
13
8
|
autorequire:
|
14
9
|
bindir: bin
|
15
10
|
cert_chain: []
|
16
|
-
|
17
|
-
date: 2011-01-04 00:00:00 -05:00
|
18
|
-
default_executable:
|
11
|
+
date: 2016-12-05 00:00:00.000000000 Z
|
19
12
|
dependencies: []
|
20
|
-
|
21
13
|
description: Multiple gemcutter accounts? Manage your keys with ease.
|
22
|
-
email:
|
14
|
+
email:
|
23
15
|
- josh@vitamin-j.com
|
24
16
|
executables: []
|
25
|
-
|
26
17
|
extensions: []
|
27
|
-
|
28
18
|
extra_rdoc_files: []
|
29
|
-
|
30
|
-
|
31
|
-
- .
|
32
|
-
- .
|
33
|
-
- CHANGELOG
|
19
|
+
files:
|
20
|
+
- ".gitignore"
|
21
|
+
- ".ruby-gemset"
|
22
|
+
- ".ruby-version"
|
23
|
+
- CHANGELOG.md
|
34
24
|
- Gemfile
|
35
25
|
- MIT-LICENSE
|
36
26
|
- README.md
|
@@ -51,37 +41,31 @@ files:
|
|
51
41
|
- lib/rubygems_plugin.rb
|
52
42
|
- spec/configuration_spec.rb
|
53
43
|
- spec/spec_helper.rb
|
54
|
-
has_rdoc: true
|
55
44
|
homepage: http://github.com/joshfrench/keycutter
|
56
|
-
licenses:
|
57
|
-
|
45
|
+
licenses:
|
46
|
+
- MIT
|
47
|
+
metadata: {}
|
58
48
|
post_install_message:
|
59
49
|
rdoc_options: []
|
60
|
-
|
61
|
-
require_paths:
|
50
|
+
require_paths:
|
62
51
|
- lib
|
63
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
-
requirements:
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
65
54
|
- - ">="
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
-
requirements:
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
72
59
|
- - ">="
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
|
75
|
-
- 0
|
76
|
-
version: "0"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
77
62
|
requirements: []
|
78
|
-
|
79
63
|
rubyforge_project: keycutter
|
80
|
-
rubygems_version:
|
64
|
+
rubygems_version: 2.5.2
|
81
65
|
signing_key:
|
82
|
-
specification_version:
|
66
|
+
specification_version: 4
|
83
67
|
summary: Gemcutter key management
|
84
|
-
test_files:
|
68
|
+
test_files:
|
85
69
|
- features/add.feature
|
86
70
|
- features/default.feature
|
87
71
|
- features/list.feature
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm gemset use keycutter
|