cooper 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/.rspec +2 -0
- data/.rubocop.yml +3 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +3 -0
- data/Guardfile +43 -0
- data/LICENSE.md +22 -0
- data/README.md +41 -0
- data/bin/cooper +38 -0
- data/cooper +0 -0
- data/cooper.gemspec +33 -0
- data/lib/cooper.rb +34 -0
- data/lib/cooper/datastore.rb +24 -0
- data/lib/cooper/version.rb +3 -0
- metadata +170 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6f7c34d26945268cf884726d8200544f080897d7
|
4
|
+
data.tar.gz: 37fef558369a36a11f4fb4f674a7365be1ef122d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 766d1e0fff39376430b2f8e291611716c486fb982e37bf8f8419e4103ea2882651692a8192538729b02347af43b88b5dd5610709e9acaeae6c18d73e1a52c987
|
7
|
+
data.tar.gz: 5e0ada5ea5aff3de9fd0da84ea7d41aa7ef71ddf8840ec1c3e8536433402af9c95948ac7ed6269ceefc9c21a196119d36ea07f5d4c8717c46e7ad1b72d6b7246
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
# Uncomment and set this to only include directories you want to watch
|
5
|
+
directories %w(spec spec/features lib bin)
|
6
|
+
|
7
|
+
# Uncomment to clear the screen before every task
|
8
|
+
clearing :on
|
9
|
+
|
10
|
+
## Guard internally checks for changes in the Guardfile and exits.
|
11
|
+
## If you want Guard to automatically start up again, run guard in a
|
12
|
+
## shell loop, e.g.:
|
13
|
+
##
|
14
|
+
## $ while bundle exec guard; do echo 'Restarting Guard...'; done
|
15
|
+
##
|
16
|
+
|
17
|
+
group :red_green_refactor do
|
18
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
19
|
+
require 'guard/rspec/dsl'
|
20
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
21
|
+
|
22
|
+
# RSpec files
|
23
|
+
rspec = dsl.rspec
|
24
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
25
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
26
|
+
watch(rspec.spec_files)
|
27
|
+
|
28
|
+
# Ruby files
|
29
|
+
ruby = dsl.ruby
|
30
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
31
|
+
|
32
|
+
## Turnip features and steps
|
33
|
+
# watch(%r{^spec/acceptance/(.+)\.feature$})
|
34
|
+
# watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
35
|
+
# Dir[File.join('**/#{m[1]}.feature')][0] || "spec/acceptance"
|
36
|
+
# end
|
37
|
+
end
|
38
|
+
|
39
|
+
guard :rubocop do
|
40
|
+
watch(/.+\.rb$/)
|
41
|
+
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
|
42
|
+
end
|
43
|
+
end
|
data/LICENSE.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
**Copyright (c) 2015 Efflam Castel**
|
2
|
+
|
3
|
+
# The MIT License (MIT)
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Cooper
|
2
|
+
|
3
|
+
A revisioning database project
|
4
|
+
|
5
|
+
As of now, Cooper only manages one item.
|
6
|
+
|
7
|
+
## Getting Started
|
8
|
+
|
9
|
+
Cooper currently tracks the life of a single item.
|
10
|
+
Cooper uses the `ENV['HOME']` environment variable to store data.
|
11
|
+
This will change before v1.0.0
|
12
|
+
|
13
|
+
Install cooper from the command prompt
|
14
|
+
|
15
|
+
`gem install cooper`
|
16
|
+
|
17
|
+
Start populating your Cooper Item with attributes from the command line
|
18
|
+
|
19
|
+
`cooper update name:cooper`
|
20
|
+
`cooper update version:0.0.1 date:2015-05-29'
|
21
|
+
|
22
|
+
Retrieve data from any update (starting from 0
|
23
|
+
|
24
|
+
`cooper read` for current status
|
25
|
+
`cooper read --at 1` for status after first update
|
26
|
+
|
27
|
+
See `cooper help` for more
|
28
|
+
|
29
|
+
## What's next
|
30
|
+
|
31
|
+
version 0.0.2 will provide the command `cooper start` to bind a cooper server to an IP port
|
32
|
+
|
33
|
+
version 0.0.3 will provide support for a collection of items
|
34
|
+
|
35
|
+
## Contributing
|
36
|
+
|
37
|
+
1. Fork it ( https://github.com/floum/cooper/fork )
|
38
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
39
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
40
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
41
|
+
5. Create a new Pull Request
|
data/bin/cooper
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'thor'
|
3
|
+
require 'json'
|
4
|
+
require 'cooper'
|
5
|
+
|
6
|
+
# the Thor class for the cooper command-line interface
|
7
|
+
class CooperCLI < Thor
|
8
|
+
map '-v' => 'version'
|
9
|
+
|
10
|
+
desc 'version', 'prints the version'
|
11
|
+
def version
|
12
|
+
puts "Cooper v#{Cooper::VERSION}"
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'reset', 'resets the cooper item'
|
16
|
+
def reset
|
17
|
+
Cooper.reset
|
18
|
+
end
|
19
|
+
|
20
|
+
desc 'update ATTRIBUTES', 'update the cooper item'
|
21
|
+
def update(*attributes)
|
22
|
+
changes = Hash[attributes.map { |attribute| attribute.split(':') }]
|
23
|
+
Cooper.update(changes)
|
24
|
+
end
|
25
|
+
|
26
|
+
desc 'read', 'read the cooper item'
|
27
|
+
method_option :at, type: :numeric, default: -1
|
28
|
+
def read
|
29
|
+
puts Cooper.read(options[:at]).to_json
|
30
|
+
end
|
31
|
+
|
32
|
+
desc 'rm ATTRIBUTE', 'removes the attribute from the cooper item'
|
33
|
+
def rm(attribute)
|
34
|
+
Cooper.delete(attribute)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
CooperCLI.start(ARGV)
|
data/cooper
ADDED
File without changes
|
data/cooper.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cooper/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'cooper'
|
8
|
+
spec.version = Cooper::VERSION
|
9
|
+
spec.date = '2015-05-21'
|
10
|
+
spec.summary = 'Cooper revisioning database project'
|
11
|
+
spec.description = 'A revisioning database'
|
12
|
+
spec.authors = ['Efflam Castel']
|
13
|
+
spec.email = 'efflamm.castel@gmail.com'
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
.reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
22
|
+
spec.license = 'MIT'
|
23
|
+
|
24
|
+
spec.add_runtime_dependency 'bundler', '~> 1.9'
|
25
|
+
spec.add_runtime_dependency 'thor', '~> 0.19'
|
26
|
+
|
27
|
+
spec.add_development_dependency 'rspec', '~> 3.2'
|
28
|
+
spec.add_development_dependency 'guard-rspec', '~> 4.5'
|
29
|
+
spec.add_development_dependency 'rubocop', '~> 0.31'
|
30
|
+
spec.add_development_dependency 'guard-rubocop', '~> 1.2'
|
31
|
+
spec.add_development_dependency 'aruba', '~> 0.6'
|
32
|
+
spec.add_development_dependency 'aruba-rspec', '~> 1.0'
|
33
|
+
end
|
data/lib/cooper.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'cooper/version'
|
2
|
+
require 'cooper/datastore'
|
3
|
+
|
4
|
+
# Cooper Database Engine Module
|
5
|
+
module Cooper
|
6
|
+
def self.reset
|
7
|
+
datastore(&:reset)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.read(revision)
|
11
|
+
datastore do |datastore|
|
12
|
+
datastore.read(revision)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.update(changes)
|
17
|
+
datastore do |datastore|
|
18
|
+
datastore << changes
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.delete(attribute)
|
23
|
+
update(attribute => nil)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def self.datastore
|
29
|
+
datastore = DataStore.open
|
30
|
+
yield(datastore)
|
31
|
+
ensure
|
32
|
+
datastore.close
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Cooper
|
2
|
+
# Interface class for the cooper data store
|
3
|
+
class DataStore < File
|
4
|
+
LOCATION = "#{ENV['HOME']}/.cooper_item"
|
5
|
+
|
6
|
+
def self.open
|
7
|
+
super(LOCATION, 'a+')
|
8
|
+
end
|
9
|
+
|
10
|
+
def reset
|
11
|
+
truncate(0)
|
12
|
+
end
|
13
|
+
|
14
|
+
def <<(attributes)
|
15
|
+
puts attributes.to_json
|
16
|
+
end
|
17
|
+
|
18
|
+
def read(revision)
|
19
|
+
readlines[0..revision]
|
20
|
+
.each_with_object({}) { |line, item| item.merge!(JSON.parse(line)) }
|
21
|
+
.reject { |_, v| v.nil? }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,170 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cooper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Efflam Castel
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-05-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.9'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: thor
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.19'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.19'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.2'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: guard-rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '4.5'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '4.5'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.31'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.31'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: guard-rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.2'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.2'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: aruba
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.6'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.6'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: aruba-rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '1.0'
|
125
|
+
description: A revisioning database
|
126
|
+
email: efflamm.castel@gmail.com
|
127
|
+
executables:
|
128
|
+
- cooper
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- ".gitignore"
|
133
|
+
- ".rspec"
|
134
|
+
- ".rubocop.yml"
|
135
|
+
- CODE_OF_CONDUCT.md
|
136
|
+
- Gemfile
|
137
|
+
- Guardfile
|
138
|
+
- LICENSE.md
|
139
|
+
- README.md
|
140
|
+
- bin/cooper
|
141
|
+
- cooper
|
142
|
+
- cooper.gemspec
|
143
|
+
- lib/cooper.rb
|
144
|
+
- lib/cooper/datastore.rb
|
145
|
+
- lib/cooper/version.rb
|
146
|
+
homepage:
|
147
|
+
licenses:
|
148
|
+
- MIT
|
149
|
+
metadata: {}
|
150
|
+
post_install_message:
|
151
|
+
rdoc_options: []
|
152
|
+
require_paths:
|
153
|
+
- lib
|
154
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
159
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
|
+
requirements:
|
161
|
+
- - ">="
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '0'
|
164
|
+
requirements: []
|
165
|
+
rubyforge_project:
|
166
|
+
rubygems_version: 2.4.6
|
167
|
+
signing_key:
|
168
|
+
specification_version: 4
|
169
|
+
summary: Cooper revisioning database project
|
170
|
+
test_files: []
|