slipcover 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ad54f411cbdcf51d91104e6a64a0ab1e3b5e8c47
4
- data.tar.gz: 5a438e303c5409b40a23ff201fa9559b50d73bc9
3
+ metadata.gz: a8235e0960e7f322d83876b91dc94d0d34883831
4
+ data.tar.gz: f16b709e7881cfc0458a74f1c0968bd9d2cd8ab2
5
5
  SHA512:
6
- metadata.gz: 0115fb08c97b683454d17a889c2506aabc017627007e60b57bb937c2aae9ebc4b6d216be24e28a6cb7cdc383b180bb1b8f23fb73a5e559f6eb51210d5b862dcb
7
- data.tar.gz: 5327028a2b60a08526415b984d037ad0d04abfbf3ba6cc6cceae41df754415b4f460f40ae8977ee872ee3047ac34f4c49dc3883e2aaf950c7ba7470faa665c07
6
+ metadata.gz: 6fba538515310312341f92cff1438f8d54dfb18d8df22ff71e05942ee377bf06e6f7c32c45ec4a91dda88f7bc4fd6f176a78865ac72395d62802531b558b0ff5
7
+ data.tar.gz: 0b431d90fd29e1db6ddb9a094e7d9024efda0cee6558643474718727dfa8b85ecf1972aa57e6d14034eca413095100c87d60fe22911de3766e41820efd0251d6
data/README.md CHANGED
@@ -29,8 +29,10 @@ Put a `slipcover.yml` in your config directory. Here is a sample:
29
29
 
30
30
  production:
31
31
  host: socialcoders.couchservice.com
32
- username: username
33
- password: password
32
+ username: COUCH_USERNAME
33
+ password: COUCH_PASSWORD
34
+
35
+ COUCH_USERNAME/PASSWORD are the keys for the username and password in your env.
34
36
 
35
37
  #### Create a database:
36
38
 
@@ -1,3 +1,4 @@
1
+ require 'yaml'
1
2
  module Slipcover
2
3
  class Server < Struct.new(:path, :key)
3
4
  def server_configs
@@ -13,8 +14,8 @@ module Slipcover
13
14
  end
14
15
 
15
16
  def user_info
16
- info = config['username'] || ""
17
- info << ":#{config['password']}" if config['password']
17
+ info = "" + username
18
+ info << ":#{password}" unless info.empty?
18
19
  info << "@" unless info.empty?
19
20
  info
20
21
  end
@@ -26,5 +27,14 @@ module Slipcover
26
27
  def port
27
28
  config['port'] ? ":#{config['port']}" : ''
28
29
  end
30
+
31
+ # We're interpolating this because Ruby freezes double hash reference strings
32
+ def username
33
+ config['couch_username_key'] ? "#{ENV[config['couch_username_key']]}" : ""
34
+ end
35
+
36
+ def password
37
+ config['couch_password_key'] ? "#{ENV[config['couch_password_key']]}" : ""
38
+ end
29
39
  end
30
40
  end
@@ -1,3 +1,3 @@
1
1
  module Slipcover
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -4,6 +4,13 @@ describe Slipcover::Server do
4
4
  let(:server) { Slipcover::Server.new(config_path, env) }
5
5
  let(:config_path) { File.dirname(__FILE__) + "/support/slipcover.yml" }
6
6
  let(:env) { 'development' }
7
+ let(:username) { 'username' }
8
+ let(:password) { 'password' }
9
+
10
+ before do
11
+ ENV['COUCH_USERNAME'] = username
12
+ ENV['COUCH_PASSWORD'] = password
13
+ end
7
14
 
8
15
  context "when the host is a local address" do
9
16
  describe "#url" do
@@ -21,4 +28,27 @@ describe Slipcover::Server do
21
28
  end
22
29
  end
23
30
  end
31
+
32
+ context "configured credientials" do
33
+ let(:env) { 'production' }
34
+ let(:username) { 'Astronaut' }
35
+ let(:password) { 'paddle-boarding' }
36
+
37
+ before do
38
+ ENV['COUCH_USERNAME'] = username
39
+ ENV['COUCH_PASSWORD'] = password
40
+ end
41
+
42
+ describe "username" do
43
+ it "gets it from the env" do
44
+ server.username.should == username
45
+ end
46
+ end
47
+
48
+ describe "password" do
49
+ it "gets it from the env" do
50
+ server.password.should == password
51
+ end
52
+ end
53
+ end
24
54
  end
@@ -4,5 +4,5 @@ development:
4
4
 
5
5
  production:
6
6
  host: socialcoders.couchserver.com
7
- username: username
8
- password: password
7
+ couch_username_key: COUCH_USERNAME
8
+ couch_password_key: COUCH_PASSWORD
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slipcover
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kane Baccigalupi
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-05-14 00:00:00.000000000 Z
14
+ date: 2014-05-27 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rest-client
@@ -138,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  version: '0'
139
139
  requirements: []
140
140
  rubyforge_project:
141
- rubygems_version: 2.0.3
141
+ rubygems_version: 2.2.2
142
142
  signing_key:
143
143
  specification_version: 4
144
144
  summary: Lite wrapper for CouchDB