honyomi 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.md +5 -0
- data/README.md +16 -0
- data/lib/honyomi/cli.rb +8 -0
- data/lib/honyomi/core.rb +4 -0
- data/lib/honyomi/database.rb +11 -0
- data/lib/honyomi/version.rb +1 -1
- data/lib/honyomi/web/app.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 685d64724a342464a595155d65a219387bfb707e
|
4
|
+
data.tar.gz: baa05b5545b476237f482499d90f8f2fc7334d52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c469791cfe13da613deafd5eeadc10f4b7855d92c1b95823e58cdd626ba69cab932e27c81bf0a63d3ef819b4328021267cdd928f61e1d307f8029ee95cf7882d
|
7
|
+
data.tar.gz: 4a7440312e418348b4a36e335252369d63fd4d8fe70c6e39182086a6efd0a9156c8c7daded9aa9588461b9f2029a94f12060261934a90bf540d44358c3b36631
|
data/HISTORY.md
CHANGED
data/README.md
CHANGED
@@ -110,4 +110,20 @@ $ honyomi web
|
|
110
110
|
|
111
111
|
![honyomi-03.gif](images/honyomi-03.gif)
|
112
112
|
|
113
|
+
### Basic authorization
|
114
|
+
|
115
|
+
1. Get the SHA-2 Hash
|
116
|
+
|
117
|
+
```
|
118
|
+
$ ruby -r 'digest/sha2' -e 'puts Digest::SHA256.hexdigest("this_is_password")'
|
119
|
+
a6a27374ec8f49426e8ee6249125369e8c529f361ffa20ace73de0b92514bb0f
|
120
|
+
```
|
121
|
+
|
122
|
+
2. It pass to the environment variable
|
123
|
+
|
124
|
+
```
|
125
|
+
$ HONYOMI_AUTH_USERNAME=ongaeshi HONYOMI_AUTH_PASSWORD=a6a27374ec8f49426e8ee6249125369e8c529f361ffa20ace73de0b92514bb0f honyomi web
|
126
|
+
```
|
127
|
+
|
128
|
+
|
113
129
|
|
data/lib/honyomi/cli.rb
CHANGED
@@ -140,6 +140,14 @@ module Honyomi
|
|
140
140
|
end
|
141
141
|
end
|
142
142
|
|
143
|
+
desc "move old_path new_path", "Move the book path"
|
144
|
+
def move(old_path, new_path)
|
145
|
+
core = Core.new
|
146
|
+
core.load_database
|
147
|
+
|
148
|
+
core.move(old_path, new_path)
|
149
|
+
end
|
150
|
+
|
143
151
|
no_tasks do
|
144
152
|
# Override method for support -h
|
145
153
|
# defined in /lib/thor/invocation.rb
|
data/lib/honyomi/core.rb
CHANGED
data/lib/honyomi/database.rb
CHANGED
@@ -187,5 +187,16 @@ module Honyomi
|
|
187
187
|
def books_bookmark(book)
|
188
188
|
@bookmarks.select { |record| record.page.book == book }
|
189
189
|
end
|
190
|
+
|
191
|
+
def move(old_path, new_path)
|
192
|
+
@books.each do |book|
|
193
|
+
new_book_path = book.path.gsub(old_path.sub(/\/\Z/, ""), new_path.sub(/\/+\Z/, ""))
|
194
|
+
|
195
|
+
if book.path != new_book_path
|
196
|
+
book.path = new_book_path
|
197
|
+
puts "#{book.path} -> #{new_book_path}"
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
190
201
|
end
|
191
202
|
end
|
data/lib/honyomi/version.rb
CHANGED
data/lib/honyomi/web/app.rb
CHANGED
@@ -4,6 +4,7 @@ require 'honyomi/core'
|
|
4
4
|
require 'honyomi/database'
|
5
5
|
require 'honyomi/util'
|
6
6
|
require 'sinatra'
|
7
|
+
require 'digest/sha2'
|
7
8
|
if ENV['SINATRA_RELOADER']
|
8
9
|
require 'sinatra/reloader'
|
9
10
|
also_reload '../../**/*.rb'
|
@@ -19,6 +20,12 @@ include Honyomi
|
|
19
20
|
set :haml, :format => :html5
|
20
21
|
|
21
22
|
configure do
|
23
|
+
if ENV['HONYOMI_AUTH_USERNAME'] && ENV['HONYOMI_AUTH_PASSWORD']
|
24
|
+
use Rack::Auth::Basic do |username, password|
|
25
|
+
username == ENV['HONYOMI_AUTH_USERNAME'] && Digest::SHA256.hexdigest(password) == ENV['HONYOMI_AUTH_PASSWORD']
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
22
29
|
$database = Database.new
|
23
30
|
end
|
24
31
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: honyomi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ongaeshi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grn_mini
|