rindle 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.
- data/README.md +30 -7
- data/lib/rindle/collection.rb +1 -1
- data/lib/rindle/collections.rb +1 -1
- data/lib/rindle/document.rb +1 -1
- data/lib/rindle/index.rb +1 -1
- data/lib/rindle/mixins/regexp.rb +2 -2
- data/lib/rindle/version.rb +2 -2
- data/lib/rindle.rb +29 -27
- data/rindle.gemspec +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +8 -8
data/README.md
CHANGED
@@ -1,19 +1,42 @@
|
|
1
|
-
# Rindle
|
1
|
+
# Rindle - Kindle Collections Management in Ruby
|
2
2
|
|
3
3
|
Rindle is a package of useful classes to manage the kindles content.
|
4
4
|
In mature versions it should provide an object-oriented interface to
|
5
5
|
access the collections and documents on the kindle with all their
|
6
|
-
metadata.
|
7
|
-
various eBook formats.
|
6
|
+
metadata.
|
8
7
|
|
9
|
-
##
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
gem 'rindle'
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install rindle
|
21
|
+
|
22
|
+
## Usage
|
10
23
|
|
11
24
|
First load the kindle:
|
12
25
|
|
13
|
-
Rindle
|
26
|
+
Rindle.load '/path/to/root'
|
14
27
|
|
15
|
-
Then just use `
|
28
|
+
Then just use `Rindle::Collection` or `Rindle::Document` with an
|
16
29
|
ActiveRecord like interface:
|
17
30
|
|
18
31
|
Rindle::Collection.first named: 'Test Collection'
|
19
|
-
Rindle::Collection.all named: /(.*)[1|2]$/
|
32
|
+
collections = Rindle::Collection.all named: /(.*)[1|2]$/
|
33
|
+
Rindle::Document.find_by_name 'A book.pdf'
|
34
|
+
documents = Rindle::Document.all
|
35
|
+
|
36
|
+
## Contributing
|
37
|
+
|
38
|
+
1. Fork it
|
39
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
40
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
41
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
42
|
+
5. Create new Pull Request
|
data/lib/rindle/collection.rb
CHANGED
data/lib/rindle/collections.rb
CHANGED
data/lib/rindle/document.rb
CHANGED
data/lib/rindle/index.rb
CHANGED
data/lib/rindle/mixins/regexp.rb
CHANGED
data/lib/rindle/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
VERSION = "0.1.
|
1
|
+
class Rindle
|
2
|
+
VERSION = "0.1.1"
|
3
3
|
end
|
data/lib/rindle.rb
CHANGED
@@ -14,45 +14,47 @@ require 'rindle/mixins/regexp'
|
|
14
14
|
#
|
15
15
|
# Rindle.load(path)
|
16
16
|
#
|
17
|
-
# After that you may use the models Collection
|
18
|
-
|
17
|
+
# After that you may use the models `Collection` and `Document`.
|
18
|
+
class Rindle
|
19
19
|
@@root_path = nil
|
20
20
|
@@collections = nil
|
21
21
|
@@index = nil
|
22
22
|
|
23
23
|
class NotLoaded < Exception; end
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
@@root_path
|
28
|
-
|
29
|
-
|
25
|
+
class << self
|
26
|
+
def root_path
|
27
|
+
if @@root_path
|
28
|
+
@@root_path
|
29
|
+
else
|
30
|
+
raise NotLoaded
|
31
|
+
end
|
30
32
|
end
|
31
|
-
end
|
32
33
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
def index
|
35
|
+
if @@index
|
36
|
+
@@index
|
37
|
+
else
|
38
|
+
raise NotLoaded
|
39
|
+
end
|
38
40
|
end
|
39
|
-
end
|
40
41
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
def collections
|
43
|
+
if @@collections
|
44
|
+
@@collections
|
45
|
+
else
|
46
|
+
raise NotLoaded
|
47
|
+
end
|
46
48
|
end
|
47
|
-
end
|
48
49
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
50
|
+
def load root_path
|
51
|
+
@@root_path = root_path
|
52
|
+
@@index = Index.load(root_path)
|
53
|
+
@@collections = Collections.load(root_path)
|
54
|
+
end
|
54
55
|
|
55
|
-
|
56
|
-
|
56
|
+
def save
|
57
|
+
@@collections.save
|
58
|
+
end
|
57
59
|
end
|
58
60
|
end
|
data/rindle.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.email = ["leoc.git@gmail.com"]
|
7
7
|
gem.description = %q{The Rindle gem provides an object-oriented way to manage kindle collection data.}
|
8
8
|
gem.summary = %q{Access kindle collection data}
|
9
|
-
gem.homepage = "
|
9
|
+
gem.homepage = "http://leoc.github.com/rindle"
|
10
10
|
|
11
11
|
gem.files = `git ls-files`.split("\n")
|
12
12
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
data/spec/spec_helper.rb
CHANGED
@@ -3,7 +3,7 @@ require 'rindle'
|
|
3
3
|
def kindle_root; File.join(File.dirname(__FILE__), 'data', 'kindle'); end
|
4
4
|
|
5
5
|
# this is to reset the Singleton'ish nature of the Kindle module
|
6
|
-
|
6
|
+
class Rindle
|
7
7
|
def self.reset
|
8
8
|
self.class_variables.each do |var|
|
9
9
|
eval "#{var} = nil"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rindle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-05-17 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &25561500 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *25561500
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: guard-rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &25560820 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *25560820
|
36
36
|
description: The Rindle gem provides an object-oriented way to manage kindle collection
|
37
37
|
data.
|
38
38
|
email:
|
@@ -73,7 +73,7 @@ files:
|
|
73
73
|
- spec/rindle/mixins/regexp_spec.rb
|
74
74
|
- spec/rindle_spec.rb
|
75
75
|
- spec/spec_helper.rb
|
76
|
-
homepage:
|
76
|
+
homepage: http://leoc.github.com/rindle
|
77
77
|
licenses: []
|
78
78
|
post_install_message:
|
79
79
|
rdoc_options: []
|
@@ -87,7 +87,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
87
87
|
version: '0'
|
88
88
|
segments:
|
89
89
|
- 0
|
90
|
-
hash:
|
90
|
+
hash: -4501087522031064736
|
91
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
92
|
none: false
|
93
93
|
requirements:
|
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
96
|
version: '0'
|
97
97
|
segments:
|
98
98
|
- 0
|
99
|
-
hash:
|
99
|
+
hash: -4501087522031064736
|
100
100
|
requirements: []
|
101
101
|
rubyforge_project:
|
102
102
|
rubygems_version: 1.8.17
|