fanforce-app-factory 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/fanforce-app-factory.gemspec +2 -1
- data/lib/fanforce/app_factory.rb +2 -2
- data/lib/fanforce/app_factory/_init_sinatra.rb +2 -0
- data/lib/fanforce/app_factory/config/_error_handling.rb +1 -0
- data/lib/fanforce/app_factory/config/{sinatra_config.rb → core_config.rb} +22 -1
- data/lib/fanforce/app_factory/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OGQ3MjBlOTFmNjQ0MTVjNmQ1MWI2ZTNiNzgyZWRlMzBlOGJlMWVhNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODI1NWQ4YmQ0YjI4NjE1NTc5NGRlOTZiZWVmMGY2M2E4Y2NjYTQ2OQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZWUxODYxMjQ4ZGYxZTZiYjAwNmRkMzBiYzk5NzFjYmI5OTgyOGM2YWJkYjUw
|
10
|
+
YmZkY2U1ZTc0NzZiY2VhYTI1MTNkYmNiZDRiN2VmZjA2YjViNjFmYzY2ZDVj
|
11
|
+
NmVlOTE0YjY1YTI1ZTIwMmZjMjg5YWMxYmUxNGNhMWI2MDc2MDQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZWY5YWUxZDI5MjBjMjc3MTc0YTg1Y2I4YWY0OWVkMjhmOTM0OTdmYmEwMDVj
|
14
|
+
MmRlYTRlNWNhNDMwZWMxOTI1NDRiOTg4NDBlNTliNWI1ZGM2MTcwN2RkN2I2
|
15
|
+
NmIwZDFkZWM3ZWEzY2E3ZDVhYWNkNTI1NTM5OWUyMzdlMWU0OWM=
|
@@ -33,8 +33,9 @@ Gem::Specification.new do |gem|
|
|
33
33
|
gem.add_runtime_dependency 'sprockets-sass', '~> 0.9'
|
34
34
|
gem.add_runtime_dependency 'yui-compressor', '~> 0.9'
|
35
35
|
gem.add_runtime_dependency 'uglifier', '~> 1.3'
|
36
|
-
|
36
|
+
gem.add_runtime_dependency 'bugsnag', '~> 1.3'
|
37
37
|
gem.add_runtime_dependency 'rack-jsonr', '~> 0.2'
|
38
|
+
|
38
39
|
gem.add_runtime_dependency 'fanforce-api', '~> 0.9'
|
39
40
|
gem.add_runtime_dependency 'fanforce-errors', '~> 0.2'
|
40
41
|
gem.add_runtime_dependency 'fanforce-workers', '~> 0.6'
|
data/lib/fanforce/app_factory.rb
CHANGED
@@ -21,7 +21,7 @@ module FanforceApp
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def self.config(&block)
|
24
|
-
config = @@config ||= FanforceApp::
|
24
|
+
config = @@config ||= FanforceApp::CoreConfig.new(ROOT_DIR)
|
25
25
|
if block.present?
|
26
26
|
block.call(config)
|
27
27
|
config.root_dir = File.dirname($1) if !config.root_dir and caller[0].split(':')[0] =~ /^(.+(config\.ru|Rakefile))$/
|
@@ -55,7 +55,7 @@ module FanforceApp
|
|
55
55
|
FanforceApp::Sinatra.new.call(env)
|
56
56
|
end
|
57
57
|
|
58
|
-
require_relative 'app_factory/config/
|
58
|
+
require_relative 'app_factory/config/core_config'
|
59
59
|
require_relative 'app_factory/initializers/ff_globals'
|
60
60
|
end
|
61
61
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'sinatra/content_for'
|
2
2
|
require 'coffee-filter'
|
3
3
|
require 'rack/jsonr'
|
4
|
+
require 'bugsnag'
|
4
5
|
####################################################################################
|
5
6
|
|
6
7
|
class FanforceApp::Sinatra < Sinatra::Base
|
@@ -10,6 +11,7 @@ class FanforceApp::Sinatra < Sinatra::Base
|
|
10
11
|
require_relative 'config/helpers/fanforce'
|
11
12
|
|
12
13
|
use Rack::JSONR, :method_override => :all
|
14
|
+
use Bugsnag::Rack
|
13
15
|
|
14
16
|
helpers Sinatra::AssetHelpers
|
15
17
|
helpers Sinatra::JSONHelpers
|
@@ -16,6 +16,7 @@ class FanforceApp::Sinatra
|
|
16
16
|
end
|
17
17
|
|
18
18
|
admin_details = Fanforce::Errors.format_admin_details(e, errors)
|
19
|
+
Bugsnag.notify(e, admin_details.merge(app_id: FanforceApp._id)) if FanforceApp.config.bugsnag_enabled?
|
19
20
|
|
20
21
|
body = {errors: e.message}
|
21
22
|
body.merge!(admin_details.merge(backtrace: e.backtrace)).delete(:public_response) if params[:show_error_details] == '1' or FanforceApp.config.show_error_details
|
@@ -1,6 +1,7 @@
|
|
1
|
-
class FanforceApp::
|
1
|
+
class FanforceApp::CoreConfig
|
2
2
|
attr_accessor :layout_for_index, :layout_for_dashboard
|
3
3
|
attr_accessor :_id, :redis_url, :factory_root_dir, :root_dir, :dir_name, :show_error_details
|
4
|
+
attr_accessor :bugsnag, :bugsnag_enabled
|
4
5
|
attr_reader :type
|
5
6
|
|
6
7
|
def initialize(root_dir)
|
@@ -12,6 +13,8 @@ class FanforceApp::SinatraConfig
|
|
12
13
|
@factory_root_dir = File.expand_path '../../', __FILE__
|
13
14
|
@redis_url = ENV['REDIS_URL'] || 'redis://localhost:6379'
|
14
15
|
@show_error_details = false
|
16
|
+
|
17
|
+
@bugsnag = (ENV['BUGSNAG_API_KEY'].present?) ? {api_key: ENV['BUGSNAG_API_KEY']} : nil
|
15
18
|
end
|
16
19
|
|
17
20
|
def show_error_details=(bool)
|
@@ -26,10 +29,28 @@ class FanforceApp::SinatraConfig
|
|
26
29
|
FanforceApp::Sinatra.set :public_folder, [@root_dir+'/public', @factory_root_dir+'/public'].inject(''){|dir, d| File.directory?(d) ? (break d) : d }
|
27
30
|
FanforceApp::Sinatra.set :views, [@root_dir+'/views', @factory_root_dir+'/views'].inject(''){|dir, d| File.directory?(d) ? (break d) : d }
|
28
31
|
|
32
|
+
FanforceApp.config.load_bugsnag
|
29
33
|
FanforceApp.config.load_routes
|
30
34
|
FanforceApp.config.load_redis
|
31
35
|
end
|
32
36
|
|
37
|
+
def bugsnag_enabled?
|
38
|
+
@bugsnag_enabled
|
39
|
+
end
|
40
|
+
|
41
|
+
def load_bugsnag
|
42
|
+
return if !@bugsnag.is_a?(Hash) or ENV['RACK_ENV'] == 'test'
|
43
|
+
require 'bugsnag'
|
44
|
+
Bugsnag.configure do |config|
|
45
|
+
config.api_key = ENV['BUGSNAG_API_KEY'] || @bugsnag[:api_key]
|
46
|
+
config.notify_release_stages = @bugsnag[:notify_release_stages] || ['development','qa','production']
|
47
|
+
config.release_stage = @bugsnag[:release_stage] || ENV['RACK_ENV']
|
48
|
+
config.app_version = @bugsnag[:app_version] || "fanforce-app-factory-#{Fanforce::AppFactory::VERSION}"
|
49
|
+
config.project_root = @root_dir
|
50
|
+
end
|
51
|
+
@bugsnag_enabled = true
|
52
|
+
end
|
53
|
+
|
33
54
|
def load_routes
|
34
55
|
@dir_name = /\/([^\/]+)\/?$/.match(@root_dir)[1]
|
35
56
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fanforce-app-factory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Caleb Clark
|
@@ -234,6 +234,20 @@ dependencies:
|
|
234
234
|
- - ~>
|
235
235
|
- !ruby/object:Gem::Version
|
236
236
|
version: '1.3'
|
237
|
+
- !ruby/object:Gem::Dependency
|
238
|
+
name: bugsnag
|
239
|
+
requirement: !ruby/object:Gem::Requirement
|
240
|
+
requirements:
|
241
|
+
- - ~>
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
version: '1.3'
|
244
|
+
type: :runtime
|
245
|
+
prerelease: false
|
246
|
+
version_requirements: !ruby/object:Gem::Requirement
|
247
|
+
requirements:
|
248
|
+
- - ~>
|
249
|
+
- !ruby/object:Gem::Version
|
250
|
+
version: '1.3'
|
237
251
|
- !ruby/object:Gem::Dependency
|
238
252
|
name: rack-jsonr
|
239
253
|
requirement: !ruby/object:Gem::Requirement
|
@@ -348,10 +362,10 @@ files:
|
|
348
362
|
- lib/fanforce/app_factory/assets/lib/vendors/knockout/knockout.debug.js
|
349
363
|
- lib/fanforce/app_factory/assets/lib/vendors/underscore/underscore.debug.js
|
350
364
|
- lib/fanforce/app_factory/config/_error_handling.rb
|
365
|
+
- lib/fanforce/app_factory/config/core_config.rb
|
351
366
|
- lib/fanforce/app_factory/config/helpers/assets.rb
|
352
367
|
- lib/fanforce/app_factory/config/helpers/fanforce.rb
|
353
368
|
- lib/fanforce/app_factory/config/helpers/json.rb
|
354
|
-
- lib/fanforce/app_factory/config/sinatra_config.rb
|
355
369
|
- lib/fanforce/app_factory/initializers/ff_globals.rb
|
356
370
|
- lib/fanforce/app_factory/layouts/dashboard.haml
|
357
371
|
- lib/fanforce/app_factory/layouts/promotional.haml
|