herbert 0.0.5 → 0.0.6

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.
data/.gitignore CHANGED
@@ -3,3 +3,6 @@
3
3
  Gemfile.lock
4
4
  pkg/*
5
5
  nbproject
6
+ .project
7
+ .yardoc
8
+ doc
@@ -2,8 +2,9 @@ require 'sinatra/base'
2
2
  require 'active_support'
3
3
 
4
4
  #
5
- # By default, if there was an error in Herbert, Sinatra would crash without
6
- # catching the error and Rack would repond with empty 200 response afterwards.
5
+ # FIXME this is ugly
6
+ # By default, if there were an error in Herbert, Sinatra would crash without
7
+ # catching the error and Rack would respond with empty 200 response afterwards.
7
8
  # This emulates somewhat consistent behaviour and encapsulation.
8
9
  #
9
10
  class Sinatra::Base
@@ -7,7 +7,7 @@ module Herbert
7
7
  #
8
8
  def self.registered(app)
9
9
  # Enable envs such as development;debug, where debug is herberts debug flag
10
- if ENV['RACK_ENV'] === nil then
10
+ if (ENV['RACK_ENV'] === nil) || (ENV['RACK_ENV'] === 'test') then
11
11
  app.set :environment, :test
12
12
  ENV['HERBERT_DEBUG'] = '1'
13
13
  end
@@ -26,7 +26,7 @@ module Herbert
26
26
  }
27
27
  # Add backtrace, Kwalify validation report and other info if
28
28
  # running in development mode
29
- if settings.development? then
29
+ if (settings.development? || settings.test?) then
30
30
  log.h_debug("Adding stacktrace and report to the error")
31
31
  body[:error][:stacktrace] = err.backtrace.join("\n")
32
32
  body[:error][:info] = (err.errors || [])
@@ -34,9 +34,9 @@ module Herbert
34
34
  response.body = body
35
35
  else
36
36
  # If the exception is not manageable, bust it
37
- log.h_error("A non-managed error occured! Backtrace: #{err.backtrace.join("\n")}")
37
+ log.h_error("A non-managed error occured! Backtrace: #{err.to_s + err.backtrace.join("\n")}")
38
38
  response.status = 500
39
- response.body = settings.development? ? err.to_s : nil
39
+ response.body = (settings.development? || settings.test?) ? err.to_s : nil
40
40
  end
41
41
  end
42
42
 
@@ -11,8 +11,12 @@ module Herbert
11
11
  # Assert v<major>.<minor>.<etc> tags
12
12
  def self.version
13
13
  version = `git describe --long`.strip
14
- version[0] = '' if version[0] == 'v'
15
- version
14
+ if $?.success?
15
+ version[0] = '' if version[0] == 'v'
16
+ return version
17
+ else
18
+ return IO.read("#{Dir.getwd}/VERSION")
19
+ end
16
20
  end
17
21
 
18
22
  module Helpers
@@ -1,3 +1,3 @@
1
1
  module Herbert
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 5
9
- version: 0.0.5
8
+ - 6
9
+ version: 0.0.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Pavel Kalvoda
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-07-01 00:00:00 +02:00
17
+ date: 2011-08-03 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency