keyp 0.0.4 → 0.0.5
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 +4 -4
- data/lib/keyp/bag.rb +22 -3
- data/lib/keyp/version.rb +1 -1
- data/lib/keyp.rb +1 -0
- data/spec/{keyper_spec.rb → bag_spec.rb} +0 -0
- data/spec/keyp_spec.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6d6251ce2d9255c0f752a0e7981934c8bb3c5e4
|
4
|
+
data.tar.gz: 494b0741cf77583966b6a3317830ac8b53c1a778
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfb27e7d76e1813682f996029cc55026dfca82ed34fa70113dce8785fcbe3b992cd624c58e183bcc41527eee751d0fca832c33cc78810b27d91e14d4ab2b57b9
|
7
|
+
data.tar.gz: 3a3fb3beb457d303817333042c657b13d91c6ebc2d8104ade092d94e2e77d022909573621f6ec5665e18d7d68bc0bad393e762acfa7113402baa08152faebd0b
|
data/lib/keyp/bag.rb
CHANGED
@@ -15,13 +15,21 @@ module Keyp
|
|
15
15
|
attr_reader :keypdir, :dirty
|
16
16
|
attr_accessor :name, :data, :file_hash
|
17
17
|
|
18
|
+
##
|
19
|
+
# Returns the full path of this Bag's file
|
18
20
|
def keypfile
|
19
21
|
File.join(@keypdir, @name+@ext)
|
20
22
|
end
|
21
23
|
|
22
|
-
|
23
|
-
#
|
24
|
+
##
|
25
|
+
# Object initializer
|
26
|
+
#
|
27
|
+
# === options
|
28
|
+
# +keypdir+
|
29
|
+
# +read_only+
|
30
|
+
# +ext+
|
24
31
|
def initialize(name, options = {})
|
32
|
+
# I'm not happy with how creating instance variables works. There must be a cleaner way
|
25
33
|
@name = name
|
26
34
|
options.each do |k,v|
|
27
35
|
puts "processing options #{k} = #{v}"
|
@@ -50,14 +58,21 @@ module Keyp
|
|
50
58
|
@dirty = false
|
51
59
|
end
|
52
60
|
|
61
|
+
##
|
62
|
+
#
|
53
63
|
def [](key)
|
54
64
|
@data[key]
|
55
65
|
end
|
56
66
|
|
67
|
+
##
|
68
|
+
#
|
57
69
|
def []=(key, value)
|
58
70
|
set_prop(key, value)
|
59
71
|
end
|
60
72
|
|
73
|
+
##
|
74
|
+
# Sets a key:value pair
|
75
|
+
# NOTE: This may be made protected
|
61
76
|
def set_prop(key, value)
|
62
77
|
unless @read_only
|
63
78
|
# TODO: check if data has been modified
|
@@ -70,6 +85,8 @@ module Keyp
|
|
70
85
|
end
|
71
86
|
end
|
72
87
|
|
88
|
+
##
|
89
|
+
# Deletes the key:value pair from this bag for the given key
|
73
90
|
def delete(key)
|
74
91
|
unless @read_only
|
75
92
|
if @data.key? key
|
@@ -82,6 +99,8 @@ module Keyp
|
|
82
99
|
val
|
83
100
|
end
|
84
101
|
|
102
|
+
##
|
103
|
+
# Returns true if there are no key:value pairs, false if there are any
|
85
104
|
def empty?
|
86
105
|
@data.empty?
|
87
106
|
end
|
@@ -98,7 +117,7 @@ module Keyp
|
|
98
117
|
# +:selection+ Provide a list of keys to match
|
99
118
|
# +:overwrite+
|
100
119
|
# +:no_overwrite+ - This is enabled by default
|
101
|
-
# +:to_upper
|
120
|
+
# +:to_upper+
|
102
121
|
|
103
122
|
# Returns a hash of the key/value pairs which have been set
|
104
123
|
# ==== Examples
|
data/lib/keyp/version.rb
CHANGED
data/lib/keyp.rb
CHANGED
File without changes
|
data/spec/keyp_spec.rb
CHANGED
@@ -5,7 +5,7 @@ describe Keyp do
|
|
5
5
|
context "CONSTANTS" do
|
6
6
|
it 'should return correct version string' do
|
7
7
|
#Keyp.version_string.should == "Keyp version #{Keyp::VERSION}"
|
8
|
-
Keyp::VERSION.should == '0.0.
|
8
|
+
Keyp::VERSION.should == '0.0.5'
|
9
9
|
end
|
10
10
|
|
11
11
|
it 'should specify default store' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: keyp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Baldwin
|
@@ -86,8 +86,8 @@ files:
|
|
86
86
|
- lib/keyp/bag.rb
|
87
87
|
- lib/keyp/cli.rb
|
88
88
|
- lib/keyp/version.rb
|
89
|
+
- spec/bag_spec.rb
|
89
90
|
- spec/keyp_spec.rb
|
90
|
-
- spec/keyper_spec.rb
|
91
91
|
- spec/spec_helper.rb
|
92
92
|
homepage: https://github.com/johnbaldwin/keyp-ruby
|
93
93
|
licenses:
|
@@ -114,6 +114,6 @@ signing_key:
|
|
114
114
|
specification_version: 4
|
115
115
|
summary: Manage environment/machine specific key:value pairs for your Ruby application.
|
116
116
|
test_files:
|
117
|
+
- spec/bag_spec.rb
|
117
118
|
- spec/keyp_spec.rb
|
118
|
-
- spec/keyper_spec.rb
|
119
119
|
- spec/spec_helper.rb
|