rindle 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,19 +1,42 @@
1
- # Rindle: A Gem packaging multiple kindle tools
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. And it should provide a convenient way for converting
7
- various eBook formats.
6
+ metadata.
8
7
 
9
- ## Libraries for kindle access
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::Kindle.load '/path/to/root'
26
+ Rindle.load '/path/to/root'
14
27
 
15
- Then just use `Kindle::Collection` or `Kindle::File` with an
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
@@ -1,4 +1,4 @@
1
- module Rindle
1
+ class Rindle
2
2
  class Collection
3
3
  class << self
4
4
  def all options = {}
@@ -3,7 +3,7 @@ require 'json'
3
3
 
4
4
  require 'rindle/collection'
5
5
 
6
- module Rindle
6
+ class Rindle
7
7
  class Collections < Hash
8
8
 
9
9
  class NoSuchFile < Exception; end
@@ -1,6 +1,6 @@
1
1
  require "digest/sha1"
2
2
 
3
- module Rindle
3
+ class Rindle
4
4
  class Document
5
5
  class NotFound < Exception; end
6
6
 
data/lib/rindle/index.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  require "rubygems"
3
3
  require "json"
4
4
 
5
- module Rindle
5
+ class Rindle
6
6
  class Index < Hash
7
7
  def initialize
8
8
  @index = {}
@@ -1,4 +1,4 @@
1
- module Rindle
1
+ class Rindle
2
2
  module Mixins
3
3
  module Regexp
4
4
 
@@ -8,7 +8,7 @@ module Rindle
8
8
  def strip
9
9
  self.source.gsub(/^\^/,'').gsub(/\$$/,'')
10
10
  end
11
-
11
+
12
12
  end
13
13
  end
14
14
  end
@@ -1,3 +1,3 @@
1
- module Rindle
2
- VERSION = "0.1.0"
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, Document, Album
18
- module Rindle
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
- def self.root_path
26
- if @@root_path
27
- @@root_path
28
- else
29
- raise NotLoaded
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
- def self.index
34
- if @@index
35
- @@index
36
- else
37
- raise NotLoaded
34
+ def index
35
+ if @@index
36
+ @@index
37
+ else
38
+ raise NotLoaded
39
+ end
38
40
  end
39
- end
40
41
 
41
- def self.collections
42
- if @@collections
43
- @@collections
44
- else
45
- raise NotLoaded
42
+ def collections
43
+ if @@collections
44
+ @@collections
45
+ else
46
+ raise NotLoaded
47
+ end
46
48
  end
47
- end
48
49
 
49
- def self.load root_path
50
- @@root_path = root_path
51
- @@index = Index.load(root_path)
52
- @@collections = Collections.load(root_path)
53
- end
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
- def self.save
56
- @@collections.save
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 = "https://github.com/leoc/rindle"
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
- module Rindle
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.0
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: &21636720 !ruby/object:Gem::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: *21636720
24
+ version_requirements: *25561500
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: guard-rspec
27
- requirement: &21636100 !ruby/object:Gem::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: *21636100
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: https://github.com/leoc/rindle
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: 391700311857255160
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: 391700311857255160
99
+ hash: -4501087522031064736
100
100
  requirements: []
101
101
  rubyforge_project:
102
102
  rubygems_version: 1.8.17