franklin 0.3.0 → 0.4.0
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/.rubocop.yml +36 -0
- data/CHANGELOG.md +3 -0
- data/README.md +6 -6
- data/exe/franklin +6 -6
- data/franklin.gemspec +1 -0
- data/lib/franklin/availability_description.rb +2 -2
- data/lib/franklin/config.rb +3 -3
- data/lib/franklin/type_filter.rb +1 -1
- data/lib/franklin/version.rb +1 -1
- data/lib/franklin.rb +4 -4
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b28166199fc01ed59e8ef8f918d6e5b404ac943
|
4
|
+
data.tar.gz: 0043b45827969a4a40cf03bd5e4a1a32643e6d62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65f0a1ff825f1a9f6fd1504cad211f6a4645076de76076b3cc952bd070e540167a9b88fea154d7f8c22738c797db2ab0f799af671a89bffd5765bebdb094e82c
|
7
|
+
data.tar.gz: 588d7eb305be7e05e7bb8356172a0174f1d900eb79316dc30c8ff1a24a1ff4f0ea2cce43bdcfa029357b17ab250b407851d4adfef4cebc1eedc78b376f4e08c6
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
AllCops:
|
2
|
+
DisplayCopNames: true
|
3
|
+
TargetRubyVersion: 2.3
|
4
|
+
|
5
|
+
Documentation:
|
6
|
+
Enabled: false
|
7
|
+
|
8
|
+
Metrics/LineLength:
|
9
|
+
Max: 120
|
10
|
+
|
11
|
+
Style/BlockDelimiters:
|
12
|
+
EnforcedStyle: semantic
|
13
|
+
FunctionalMethods:
|
14
|
+
- before
|
15
|
+
- after
|
16
|
+
- subject
|
17
|
+
- subject!
|
18
|
+
- let
|
19
|
+
- let!
|
20
|
+
|
21
|
+
AutoCorrect: false
|
22
|
+
|
23
|
+
Style/SingleLineBlockParams:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
Style/StringLiterals:
|
27
|
+
EnforcedStyle: double_quotes
|
28
|
+
|
29
|
+
Style/AndOr:
|
30
|
+
AutoCorrect: false
|
31
|
+
|
32
|
+
Style/SignalException:
|
33
|
+
EnforcedStyle: semantic
|
34
|
+
|
35
|
+
Style/FrozenStringLiteralComment:
|
36
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -14,12 +14,12 @@ Franklin needs to be configured with information about the Overdrive libraries i
|
|
14
14
|
|
15
15
|
``` yml
|
16
16
|
---
|
17
|
-
|
18
|
-
-
|
19
|
-
|
20
|
-
-
|
21
|
-
|
22
|
-
|
17
|
+
libraries:
|
18
|
+
- name: San Francisco Public Library
|
19
|
+
url: http://sfpl.lib.overdrive.com
|
20
|
+
- name: San Diego Public Library
|
21
|
+
url: http://sdpl.lib.overdrive.com
|
22
|
+
default_type: eBook # Optional, will show all types if not set.
|
23
23
|
```
|
24
24
|
|
25
25
|
There needs to be a minimum of one library, but there is no maximum. The `name` can be anything and will be included when the search results are presented. The `url` should point to the domain of the public library. It can be obtained by visiting Overdrive's site for each library, copying the url and stripping everything after the domain name.
|
data/exe/franklin
CHANGED
@@ -35,11 +35,11 @@ rescue Errno::ENOENT
|
|
35
35
|
Oops! It looks like you have not configured franklin
|
36
36
|
Please add a configuration file in $HOME/.franklin that looks like this:
|
37
37
|
---
|
38
|
-
|
39
|
-
-
|
40
|
-
|
41
|
-
-
|
42
|
-
|
43
|
-
|
38
|
+
libraries:
|
39
|
+
- name: San Francisco Public Library
|
40
|
+
url: http://sfpl.lib.overdrive.com
|
41
|
+
- name: San Diego Public Library
|
42
|
+
url: http://sdpl.lib.overdrive.com
|
43
|
+
default_type: eBook # Optional, leave empty to search for all types
|
44
44
|
ERROR
|
45
45
|
end
|
data/franklin.gemspec
CHANGED
@@ -11,7 +11,7 @@ module Franklin
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def available?
|
14
|
-
available_copies
|
14
|
+
available_copies.positive?
|
15
15
|
end
|
16
16
|
|
17
17
|
def copies_per_person
|
@@ -19,7 +19,7 @@ module Franklin
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def wait_list_size?
|
22
|
-
wait_list_size
|
22
|
+
wait_list_size.positive?
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
data/lib/franklin/config.rb
CHANGED
@@ -7,10 +7,10 @@ module Franklin
|
|
7
7
|
attr_reader :libraries, :default_type
|
8
8
|
|
9
9
|
def initialize(data)
|
10
|
-
@libraries = data.fetch(
|
11
|
-
Library.new(library.fetch(
|
10
|
+
@libraries = data.fetch("libraries").map { |library|
|
11
|
+
Library.new(library.fetch("name"), library.fetch("url"))
|
12
12
|
}
|
13
|
-
@default_type = data[
|
13
|
+
@default_type = data["default_type"]
|
14
14
|
end
|
15
15
|
|
16
16
|
class << self
|
data/lib/franklin/type_filter.rb
CHANGED
data/lib/franklin/version.rb
CHANGED
data/lib/franklin.rb
CHANGED
@@ -5,11 +5,11 @@ require "franklin/type_filter"
|
|
5
5
|
require "franklin/console_report"
|
6
6
|
|
7
7
|
module Franklin
|
8
|
-
def run(search_terms,
|
9
|
-
config = Config.load_from_file(
|
8
|
+
def run(search_terms, config_path: nil, type: nil, out:)
|
9
|
+
config = Config.load_from_file(config_path)
|
10
10
|
results = ThreadedSearch.new(config.libraries).perform(search_terms)
|
11
|
-
filtered_results = TypeFilter.new(
|
12
|
-
ConsoleReport.new(search_terms, filtered_results).print_to_out(
|
11
|
+
filtered_results = TypeFilter.new(type || config.default_type).perform(results)
|
12
|
+
ConsoleReport.new(search_terms, filtered_results).print_to_out(out)
|
13
13
|
end
|
14
14
|
|
15
15
|
module_function :run
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: franklin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ylan Segal
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mechanize
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '1.22'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.46'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.46'
|
111
125
|
description:
|
112
126
|
email:
|
113
127
|
- ylan@segal-family.com
|
@@ -117,6 +131,7 @@ extensions: []
|
|
117
131
|
extra_rdoc_files: []
|
118
132
|
files:
|
119
133
|
- ".gitignore"
|
134
|
+
- ".rubocop.yml"
|
120
135
|
- ".travis.yml"
|
121
136
|
- CHANGELOG.md
|
122
137
|
- Gemfile
|