neruda 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/pablo +7 -4
- data/lib/tasks/book.rake +7 -6
- data/lib/tasks/chapters.rake +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d27ec419fef855a84bea4e91b9330fbbe659e97c
|
4
|
+
data.tar.gz: 7a996318f08fdb881e941c321b67a958ddeaa845
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98b930b09fcb112273e61df48f5d39795b914c93ac1a1f69de41aa1097ac7cdb523944d4d31d21c77ec8caed9fb6086d8cfc7464ff73b20cb7a925cf3cc3abd5
|
7
|
+
data.tar.gz: 209f225bc0ccd7f5dfb949d49ddbbfbbd496136a0bbbc481e307564a6543eb7ffbe8462774037016bddaf480671c9ceb4aa1ef73257423a2a4bea6a9dd6bd8b9
|
data/bin/pablo
CHANGED
@@ -17,10 +17,11 @@ module BundlerHelper
|
|
17
17
|
false
|
18
18
|
end
|
19
19
|
|
20
|
-
def rake_or_bundle_run(cmd)
|
20
|
+
def rake_or_bundle_run(cmd, use_system = false)
|
21
21
|
cmd.insert(1, '-s') unless @options[:verbose]
|
22
22
|
cmd = ['bundle', 'exec'] + cmd if bundler_is_present?
|
23
23
|
puts Rainbow(cmd.join(' ')).blue if @options[:verbose]
|
24
|
+
return cmd.join(' ') if use_system
|
24
25
|
exec(*cmd)
|
25
26
|
end
|
26
27
|
end
|
@@ -148,8 +149,8 @@ class Pablo
|
|
148
149
|
rake_or_bundle_run ['rake', 'sinatra:stop']
|
149
150
|
|
150
151
|
elsif ARGV[0] == 'compile'
|
151
|
-
rake_or_bundle_run ['rake', 'chapters:build_epubs']
|
152
|
-
|
152
|
+
rake_or_bundle_run ['rake', 'chapters:build_epubs'], true
|
153
|
+
rake_or_bundle_run ['rake', 'book:make']
|
153
154
|
|
154
155
|
elsif ARGV[0] == 'new'
|
155
156
|
new_chapter
|
@@ -188,7 +189,8 @@ class Pablo
|
|
188
189
|
start : Start the rack web server (default is thin)
|
189
190
|
stop : Stop the web server
|
190
191
|
compile: Generate the epubs files
|
191
|
-
list : List various book elements
|
192
|
+
list : List various book elements (chapters, characters, notes, sceneries)
|
193
|
+
board : Open your TiddlyWiki file located at ./private/notes/tiddly.html
|
192
194
|
|
193
195
|
Chapters related commands:
|
194
196
|
new [title] : Create a new chapter
|
@@ -268,6 +270,7 @@ class Pablo
|
|
268
270
|
def list
|
269
271
|
if ARGV[1].nil?
|
270
272
|
STDERR.puts Rainbow('ERROR: No list type given.').red
|
273
|
+
STDERR.puts 'Enter one of [chapters, characters, notes, sceneries].'
|
271
274
|
exit 1
|
272
275
|
end
|
273
276
|
rake_or_bundle_run ['rake', "book:list[#{ARGV[1]}]"]
|
data/lib/tasks/book.rake
CHANGED
@@ -5,9 +5,10 @@ require 'rainbow'
|
|
5
5
|
|
6
6
|
namespace :book do
|
7
7
|
desc 'List various book elements'
|
8
|
-
task :list, :list_type do |
|
8
|
+
task :list, :list_type do |_, args|
|
9
9
|
list_type = args[:list_type]
|
10
|
-
next unless ['chapters', 'characters',
|
10
|
+
next unless ['chapters', 'characters',
|
11
|
+
'notes', 'sceneries'].include?(list_type)
|
11
12
|
Dir.glob("private/#{list_type}/*.org") do |filename|
|
12
13
|
file_radix = File.basename(filename, '.org')
|
13
14
|
title = file_radix.split('_').map(&:capitalize).join(' ')
|
@@ -39,10 +40,10 @@ namespace :book do
|
|
39
40
|
filename = "private/chapters/#{file_radix}.org"
|
40
41
|
next unless File.exist? filename
|
41
42
|
file_content = IO.read(filename)
|
42
|
-
file_content.gsub!(/^#\+date:.*$/
|
43
|
-
file_content.gsub!(/^#\+author:.*$/
|
44
|
-
file_content.gsub!(/^(\*+)\s+(.*)$/
|
45
|
-
file_content.gsub!(/^#\+title:\s?(.*)$/
|
43
|
+
file_content.gsub!(/^#\+date:.*$/i, '')
|
44
|
+
file_content.gsub!(/^#\+author:.*$/i, '')
|
45
|
+
file_content.gsub!(/^(\*+)\s+(.*)$/i, '*\1 \2')
|
46
|
+
file_content.gsub!(/^#\+title:\s?(.*)$/i, '* \1')
|
46
47
|
|
47
48
|
org_file.write(file_content + "\n")
|
48
49
|
end
|
data/lib/tasks/chapters.rake
CHANGED
@@ -45,7 +45,7 @@ namespace :chapters do
|
|
45
45
|
file_radix = File.basename(filename, '.org')
|
46
46
|
epub_file = "private/epubs/#{file_radix}.epub"
|
47
47
|
epub_to_upload << epub_file
|
48
|
-
sh 'pandoc', '-S', "
|
48
|
+
sh 'pandoc', '-S', "--output=#{epub_file}", filename
|
49
49
|
end
|
50
50
|
next if epub_to_upload.empty?
|
51
51
|
IO.write('tmp/epub_to_upload.yml', epub_to_upload.to_yaml)
|