gaga 0.0.1 → 0.0.2

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.
data/README.md CHANGED
@@ -1,43 +1,84 @@
1
1
  Gaga
2
2
  ==========
3
3
 
4
- Git as a key-value store! Build with [Grit](https://github.com/mojombo/grit), it supports SET, GET, KEYS, and DELETE operations. In addition, we can also get the change history key/values.
4
+ Gaga is a Git-backed key/value store written in Ruby. Built with
5
+ [Grit](https://github.com/mojombo/grit), it supports SET, GET, KEYS, and DELETE
6
+ operations. And since it's Git, we can easily enhance it to include other
7
+ awesome Git features such as branches, diffs, reverting, and more!
5
8
 
6
- It can easily be enhanced to include other git features such as branches, diffs, etc
7
9
 
8
- Example:
10
+ Usage
11
+ ----------
9
12
 
10
13
  ```ruby
11
14
 
12
- @gaga = Gaga.new(:path => File.expand_path('..', __FILE__))
13
- @gaga.clear
15
+ @gaga = Gaga.new(:repo => File.expand_path('..', __FILE__))
14
16
 
15
17
  # SET
16
-
17
18
  @gaga['lady'] = "gaga"
18
19
 
19
20
  # GET
20
-
21
21
  @gaga['lady'] #=> "gaga"
22
22
 
23
23
  # KEYS
24
-
25
24
  @gaga.keys #=> ['lady']
26
25
 
27
26
  # DELETE
28
-
29
27
  @gaga.delete('lady') #=> 'gaga'
30
28
 
31
- # LOG
29
+ # Remove all items from the store
30
+ @gaga.clear
31
+
32
+ ```
33
+
34
+ ### Branches
35
+
36
+ You can always store key/values in separate branches. Just specify the `branch`
37
+ option parameter:
38
+
39
+ ```ruby
40
+ @gaga = Gaga.new(:repo => path_to_repo, :branch => 'config')
41
+ ```
42
+
43
+ Though not recommended, Gaga can store the identical key in different branches.
32
44
 
45
+ ### Logs
46
+
47
+ Gaga keeps a history of key/value saves.
48
+
49
+ ```ruby
33
50
  @gaga.log('key')
51
+ ```
34
52
 
35
- # Produces:
53
+ Returns an array of commit messages along with meta data about each key/value save.
36
54
 
55
+ ```ruby
37
56
  [
38
57
  {"message"=>"all clear","committer"=>{"name"=>"Matt Sears", "email"=>"matt@mattsears.com"}, "committed_date"=>"2011-09-05..."},
39
58
  {"message"=>"set 'lady' ", "committer"=>{"name"=>"Matt Sears", "email"=>"matt@mattsears.com"}, "committed_date"=>"2011-09-05..."}
40
59
  {"message"=>"delete 'lady' ", "committer"=>{"name"=>"Matt Sears", "email"=>"matt@mattsears.com"}, "committed_date"=>"2011-09-05..."}
41
60
  ]
61
+ ```
62
+
63
+ Installing Gaga
64
+ ----------
42
65
 
43
66
  ```
67
+ $ gem install gaga
68
+ ```
69
+
70
+ Contributing
71
+ ----------
72
+
73
+ Once you've made your great commits:
74
+
75
+ 1. Fork Gaga
76
+ 2. Create a topic branch - git checkout -b my_branch
77
+ 3. Push to your branch - git push origin my_branch
78
+ 4. Create a Pull Request from your branch
79
+ 5. That's it!
80
+
81
+ Author
82
+ ----------
83
+ [Matt Sears](https://wwww.mattsears.com) :: @mattsears
84
+
@@ -7,9 +7,9 @@ Gem::Specification.new do |s|
7
7
  s.version = Gaga::VERSION
8
8
  s.authors = ["Matt Sears"]
9
9
  s.email = ["matt@mattsears.com"]
10
- s.homepage = "http://github.com/mattsears/gaga"
11
- s.summary = %q{Git as a key value store}
12
- s.description = %q{Git as a key value store}
10
+ s.homepage = "http://mtts.rs/gaga"
11
+ s.summary = %q{Gaga is a Git-backed key/value store}
12
+ s.description = %q{Gaga is a Git-backed key/value store}
13
13
  s.rubyforge_project = "gaga"
14
14
 
15
15
  s.files = `git ls-files`.split("\n")
@@ -121,7 +121,7 @@ class Gaga
121
121
 
122
122
  # The git branch to use for this store
123
123
  def branch
124
- @options[:branch] || 'master'
124
+ @options[:branch].to_s || 'master'
125
125
  end
126
126
 
127
127
  # Checks out the branch on the repo
@@ -1,3 +1,3 @@
1
1
  class Gaga
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -9,8 +9,12 @@ describe Gaga do
9
9
  }
10
10
 
11
11
  before do
12
- @store = Gaga.new(:repo => tmp_dir)
13
- @store.clear
12
+ @store = Gaga.new(:repo => tmp_dir, :branch => :lady)
13
+ @master = Gaga.new(:repo => tmp_dir)
14
+ end
15
+
16
+ after do
17
+ remove_tmpdir!
14
18
  end
15
19
 
16
20
  @types.each do |type, (key, key2)|
@@ -24,6 +28,12 @@ describe Gaga do
24
28
  @store[key].must_be_nil
25
29
  end
26
30
 
31
+ it 'guarantess the key is stored in the right branch' do
32
+ @store[key] = 'value'
33
+ @master[key].must_be_nil
34
+ @store[key].must_equal "value"
35
+ end
36
+
27
37
  it "returns a list of keys" do
28
38
  @store[key] = "value"
29
39
  @store.keys.must_include(key)
@@ -85,9 +95,11 @@ describe Gaga do
85
95
  @store[key].must_equal "value"
86
96
  end
87
97
 
88
- it "returns a list of commit history for the key" do
89
- @store.log(key).wont_be_empty
98
+ it 'stores a log message for the key' do
99
+ @store[key] = "value"
100
+ @store.log(key).first['message'].must_equal("set '#{key}'")
90
101
  end
102
+
91
103
  end
92
104
 
93
105
  end
metadata CHANGED
@@ -1,38 +1,34 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: gaga
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
4
5
  prerelease:
5
- version: 0.0.1
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Matt Sears
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-10-23 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2011-11-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
16
15
  name: grit
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70351841569680 !ruby/object:Gem::Requirement
19
17
  none: false
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
24
22
  type: :runtime
25
- version_requirements: *id001
26
- description: Git as a key value store
27
- email:
23
+ prerelease: false
24
+ version_requirements: *70351841569680
25
+ description: Gaga is a Git-backed key/value store
26
+ email:
28
27
  - matt@mattsears.com
29
28
  executables: []
30
-
31
29
  extensions: []
32
-
33
30
  extra_rdoc_files: []
34
-
35
- files:
31
+ files:
36
32
  - .gitignore
37
33
  - Gemfile
38
34
  - README.md
@@ -42,33 +38,30 @@ files:
42
38
  - lib/gaga/version.rb
43
39
  - test/gaga_test.rb
44
40
  - test/helper.rb
45
- homepage: http://github.com/mattsears/gaga
41
+ homepage: http://mtts.rs/gaga
46
42
  licenses: []
47
-
48
43
  post_install_message:
49
44
  rdoc_options: []
50
-
51
- require_paths:
45
+ require_paths:
52
46
  - lib
53
- required_ruby_version: !ruby/object:Gem::Requirement
47
+ required_ruby_version: !ruby/object:Gem::Requirement
54
48
  none: false
55
- requirements:
56
- - - ">="
57
- - !ruby/object:Gem::Version
58
- version: "0"
59
- required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ! '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
54
  none: false
61
- requirements:
62
- - - ">="
63
- - !ruby/object:Gem::Version
64
- version: "0"
55
+ requirements:
56
+ - - ! '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
65
59
  requirements: []
66
-
67
60
  rubyforge_project: gaga
68
61
  rubygems_version: 1.8.10
69
62
  signing_key:
70
63
  specification_version: 3
71
- summary: Git as a key value store
72
- test_files:
64
+ summary: Gaga is a Git-backed key/value store
65
+ test_files:
73
66
  - test/gaga_test.rb
74
67
  - test/helper.rb