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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/pablo +12 -8
  3. data/lib/neruda.rb +11 -5
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e3101ba04a16de9562d4834ebde5c9034103d14d
4
- data.tar.gz: f50ebe738e0771b75ed532319e84cfe1027bea25
3
+ metadata.gz: b580faa2e64bd6358c78619c309d9568c79a1b66
4
+ data.tar.gz: ac61ff055b4c36d9f5afa967929cf53440136065
5
5
  SHA512:
6
- metadata.gz: c3ca902065a455800fdd16b9b9ee0d81921b7971d4a25b9aa8e5bf0327ab05f97ddd39b7d710ab7937cee1b11a1b61e33b51ee04a140d31ad0418584de15c95d
7
- data.tar.gz: 011f3df145a513b3b780fbf543db6eb5a76cd6c89acb8342428799bd32b3bfef21a38efc5019de9b686f4517bc642649fadbbd99864eb015b14e4bb957549a10
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
- @arg = ARGV[0]
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
@@ -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
- enable :logging
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
- Dir.chdir settings.root if ENV['APP_ENV'] == 'production'
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
- if File.exist? File.join('private', 'index.org')
85
- @org_file = find_file
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neruda
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Étienne Deparis