neruda 0.0.9 → 0.0.10
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/bin/pablo +12 -8
- data/lib/neruda.rb +11 -5
- 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: b580faa2e64bd6358c78619c309d9568c79a1b66
|
4
|
+
data.tar.gz: ac61ff055b4c36d9f5afa967929cf53440136065
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e76d4ecfa5b9f1eba99b8b2348cc387bc14909e7815d8871b97c84416027df5450ded9ef0f34605d772fa87928c846b12b30a4d21e3ee4d03425d6ddfc9c8b2e
|
7
|
+
data.tar.gz: 917fad9923f0d548450c6ae5c7cc42b4cfa5238c787c39077abe9f385f1626d808cb9b74f845cdf59c851cd1e863a4f41192ca04c1c6e0274c4119d56aa1a45e
|
data/bin/pablo
CHANGED
@@ -181,6 +181,17 @@ class Pablo
|
|
181
181
|
|
182
182
|
private
|
183
183
|
|
184
|
+
def handle_aliases
|
185
|
+
@arg = ARGV[0]
|
186
|
+
if @arg == 'new'
|
187
|
+
@arg = 'edit'
|
188
|
+
elsif @arg == 'run'
|
189
|
+
@arg = 'start'
|
190
|
+
elsif @arg == 'init'
|
191
|
+
@arg = 'setup'
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
184
195
|
def parse_options
|
185
196
|
optparse = OptionParser.new do |opts|
|
186
197
|
opts.banner = <<~HELP
|
@@ -201,14 +212,7 @@ class Pablo
|
|
201
212
|
|
202
213
|
optparse.parse!
|
203
214
|
|
204
|
-
|
205
|
-
if @arg == 'new'
|
206
|
-
@arg = 'edit'
|
207
|
-
elsif @arg == 'run'
|
208
|
-
@arg = 'start'
|
209
|
-
elsif @arg == 'init'
|
210
|
-
@arg = 'setup'
|
211
|
-
end
|
215
|
+
handle_aliases
|
212
216
|
|
213
217
|
if !File.exist?('config/config.yml') && @arg != 'setup'
|
214
218
|
STDERR.puts Rainbow('ERROR: please run pablo setup before all').red
|
data/lib/neruda.rb
CHANGED
@@ -19,8 +19,7 @@ class Neruda::App < Sinatra::Base
|
|
19
19
|
configure :production, :development do
|
20
20
|
# When used as a Gem, we lose the correct path.
|
21
21
|
set :root, Dir.pwd
|
22
|
-
|
23
|
-
disable :method_override, :sessions
|
22
|
+
disable :logging, :method_override, :sessions
|
24
23
|
mime_type :epub, 'application/epub+zip'
|
25
24
|
end
|
26
25
|
|
@@ -28,7 +27,13 @@ class Neruda::App < Sinatra::Base
|
|
28
27
|
include Neruda::Chapter
|
29
28
|
|
30
29
|
def chdir
|
31
|
-
|
30
|
+
loc_env = 'development'
|
31
|
+
if ENV.key? 'APP_ENV'
|
32
|
+
loc_env = ENV['APP_ENV']
|
33
|
+
elsif ENV.key? 'RACK_ENV'
|
34
|
+
loc_env = ENV['RACK_ENV']
|
35
|
+
end
|
36
|
+
Dir.chdir settings.root if loc_env == 'production'
|
32
37
|
end
|
33
38
|
|
34
39
|
def find_slug
|
@@ -81,8 +86,9 @@ class Neruda::App < Sinatra::Base
|
|
81
86
|
chdir
|
82
87
|
@slug = 'index'
|
83
88
|
text_content = ''
|
84
|
-
|
85
|
-
|
89
|
+
index_file = File.join('private', 'index.org')
|
90
|
+
if File.exist? index_file
|
91
|
+
@org_file = index_file
|
86
92
|
@content = Orgmode::Parser.load @org_file
|
87
93
|
title
|
88
94
|
text_content = @content.to_html
|