fanforce-plugin-factory 0.11.0 → 0.12.0

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MmVmM2U1OTg2ZGUyMDA1MDQ3N2FhMDRkMjRlODljM2ZmOTRmNDg3MA==
4
+ YWYyMWI2NmFmNDZmMzhlOTRlYzRjNTY1MjNjNThlN2Y1M2VhODZmMA==
5
5
  data.tar.gz: !binary |-
6
- MTU0ZTUzYTNhMDdlMGJiYjk0YzZhNTEyOTNjODc2YmQzNWFmNGMwMA==
6
+ YWExY2FkMzU1NzM2NzViZTBiYzI4MTI0MDk1ZGNmYzUxYTY5YWUwMA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NzZhNGJkYWEyNGY4MmZhZDllMzg0MmVjMTllNGE5OTJlODE1NTU1MzhjNmEw
10
- YjFmODIwZmJkMDFhN2VlZDA3M2ExMGNlZjg0NjM2YmU3MGU3YjA1MjU5Yjk4
11
- YzYwYzE2NDdjOWNjZWJmZDIxNTBlYWYxYTI4OWFkNTVlMTdmZmI=
9
+ YTgyZWUxNjFlODM5ODhkOWI4NmY0N2UzZjk4MGE3YTBhYmZiZGExZjUxODhh
10
+ YTg2NGUxMGZiYWQ5ZDIyYjg3MmVjMzYwNjhjNDgyM2JmZTJmMjQwNzIzNzg5
11
+ MGM5MjYxMzA1NDVkYTVjZDIwZmJhMGQzNDlhMmMwZmYwN2Q3OTU=
12
12
  data.tar.gz: !binary |-
13
- MDUxNzVlOGJhMzhiMDU4NGM1Mjk0ZmNkZDlhNjVkN2QwMjg5OTYwNjNhNDhi
14
- ODNjZTEwZTAxNjVkNjU4NjkxMjhmODQ5MzBhMjU3NmViOTlmNjAwMzM5OTRl
15
- MTJkNWM3ODhhNzZjMzcwMTY1Zjk4ZGFkMjVhNjNjZTRjMzBjNzQ=
13
+ YTdlMmMxZDU2YTA5ZWJlYzdkNjU5NTNiNzE3YWI4Nzg5ZDdmNWFiZWRkMDQy
14
+ YTQ4YThhYmZkODJhNjU1YzQzODc4NmYwOWRiMDg1MjgxNWEzMGZmZTZhOGQw
15
+ MGM1NzU0YTRlMWUxODA5MTViNmE4ZDNkY2YxZWIyOGY1MDAzYjY=
@@ -35,8 +35,9 @@ Gem::Specification.new do |gem|
35
35
 
36
36
  gem.add_runtime_dependency 'yui-compressor', '~> 0.9'
37
37
  gem.add_runtime_dependency 'uglifier', '~> 1.3'
38
-
38
+ gem.add_runtime_dependency 'bugsnag', '~> 1.3'
39
39
  gem.add_runtime_dependency 'rack-jsonr', '~> 0.2'
40
+
40
41
  gem.add_runtime_dependency 'fanforce-api', '~> 0.9'
41
42
  gem.add_runtime_dependency 'fanforce-errors', '~> 0.2'
42
43
  gem.add_runtime_dependency 'fanforce-workers', '~> 0.6'
@@ -21,7 +21,7 @@ module FanforcePlugin
21
21
  end
22
22
 
23
23
  def self.config(&block)
24
- config = @@config ||= FanforcePlugin::SinatraConfig.new(ROOT_DIR)
24
+ config = @@config ||= FanforcePlugin::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))$/
@@ -59,7 +59,7 @@ module FanforcePlugin
59
59
  FanforcePlugin::Sinatra.new.call(env)
60
60
  end
61
61
 
62
- require_relative 'plugin_factory/config/sinatra_config'
62
+ require_relative 'plugin_factory/config/core_config'
63
63
  require_relative 'plugin_factory/initializers/ff_globals'
64
64
  end
65
65
 
@@ -1,5 +1,6 @@
1
1
  require 'sinatra/content_for'
2
2
  require 'rack/jsonr'
3
+ require 'bugsnag'
3
4
  ####################################################################################
4
5
 
5
6
  class FanforcePlugin::Sinatra < Sinatra::Base
@@ -9,6 +10,7 @@ class FanforcePlugin::Sinatra < Sinatra::Base
9
10
  require_relative 'config/helpers/fanforce'
10
11
 
11
12
  use Rack::JSONR, :method_override => :all
13
+ use Bugsnag::Rack
12
14
 
13
15
  helpers Sinatra::AssetHelpers
14
16
  helpers Sinatra::JSONHelpers
@@ -16,6 +16,7 @@ class FanforcePlugin::Sinatra
16
16
  end
17
17
 
18
18
  admin_details = Fanforce::Errors.format_admin_details(e, errors)
19
+ Bugsnag.notify(e, admin_details.merge(plugin_id: FanforcePlugin._id)) if FanforcePlugin.config.bugsnag_enabled?
19
20
 
20
21
  body = {errors: errors}
21
22
  body.merge!(admin_details.merge(backtrace: e.backtrace)).delete(:public_response) if params[:show_error_details] == '1' or FanforcePlugin.config.show_error_details
@@ -1,6 +1,7 @@
1
- class FanforcePlugin::SinatraConfig
1
+ class FanforcePlugin::CoreConfig
2
2
  attr_accessor :layout_for_add_initiative, :layout_for_add_source, :layout_for_close_popup, :layout_for_edit_initiative, :layout_for_engage, :layout_for_index, :layout_for_new_message, :layout_for_source_details
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)
@@ -19,6 +20,8 @@ class FanforcePlugin::SinatraConfig
19
20
  @factory_root_dir = File.expand_path '../../', __FILE__
20
21
  @redis_url = ENV['REDIS_URL'] || 'redis://localhost:6379'
21
22
  @show_error_details = false
23
+
24
+ @bugsnag = (ENV['BUGSNAG_API_KEY'].present?) ? {api_key: ENV['BUGSNAG_API_KEY']} : nil
22
25
  end
23
26
 
24
27
  def show_error_details=(bool)
@@ -39,10 +42,28 @@ class FanforcePlugin::SinatraConfig
39
42
  FanforcePlugin::Sinatra.set :public_folder, [@root_dir+'/public', @factory_root_dir+'/public'].inject(''){|dir, d| File.directory?(d) ? (break d) : d }
40
43
  FanforcePlugin::Sinatra.set :views, [@root_dir+'/views', @factory_root_dir+'/views'].inject(''){|dir, d| File.directory?(d) ? (break d) : d }
41
44
 
45
+ FanforcePlugin.config.load_bugsnag
42
46
  FanforcePlugin.config.load_routes
43
47
  FanforcePlugin.config.load_redis
44
48
  end
45
49
 
50
+ def bugsnag_enabled?
51
+ @bugsnag_enabled
52
+ end
53
+
54
+ def load_bugsnag
55
+ return if !@bugsnag.is_a?(Hash) or ENV['RACK_ENV'] == 'test'
56
+ require 'bugsnag'
57
+ Bugsnag.configure do |config|
58
+ config.api_key = ENV['BUGSNAG_API_KEY'] || @bugsnag[:api_key]
59
+ config.notify_release_stages = @bugsnag[:notify_release_stages] || ['development','qa','production']
60
+ config.release_stage = @bugsnag[:release_stage] || ENV['RACK_ENV']
61
+ config.app_version = @bugsnag[:app_version] || "fanforce-plugin-factory-#{Fanforce::PluginFactory::VERSION}"
62
+ config.project_root = @root_dir
63
+ end
64
+ @bugsnag_enabled = true
65
+ end
66
+
46
67
  def load_routes
47
68
  @dir_name = /\/([^\/]+)\/?$/.match(@root_dir)[1]
48
69
 
@@ -1,5 +1,5 @@
1
1
  class Fanforce
2
2
  module PluginFactory
3
- VERSION = '0.11.0'
3
+ VERSION = '0.12.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fanforce-plugin-factory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Caleb Clark
@@ -248,6 +248,20 @@ dependencies:
248
248
  - - ~>
249
249
  - !ruby/object:Gem::Version
250
250
  version: '1.3'
251
+ - !ruby/object:Gem::Dependency
252
+ name: bugsnag
253
+ requirement: !ruby/object:Gem::Requirement
254
+ requirements:
255
+ - - ~>
256
+ - !ruby/object:Gem::Version
257
+ version: '1.3'
258
+ type: :runtime
259
+ prerelease: false
260
+ version_requirements: !ruby/object:Gem::Requirement
261
+ requirements:
262
+ - - ~>
263
+ - !ruby/object:Gem::Version
264
+ version: '1.3'
251
265
  - !ruby/object:Gem::Dependency
252
266
  name: rack-jsonr
253
267
  requirement: !ruby/object:Gem::Requirement
@@ -395,10 +409,10 @@ files:
395
409
  - lib/fanforce/plugin_factory/assets/lib/vendors/knockout/knockout.debug.js
396
410
  - lib/fanforce/plugin_factory/assets/lib/vendors/underscore/underscore.debug.js
397
411
  - lib/fanforce/plugin_factory/config/_error_handling.rb
412
+ - lib/fanforce/plugin_factory/config/core_config.rb
398
413
  - lib/fanforce/plugin_factory/config/helpers/assets.rb
399
414
  - lib/fanforce/plugin_factory/config/helpers/fanforce.rb
400
415
  - lib/fanforce/plugin_factory/config/helpers/json.rb
401
- - lib/fanforce/plugin_factory/config/sinatra_config.rb
402
416
  - lib/fanforce/plugin_factory/initializers/ff_globals.rb
403
417
  - lib/fanforce/plugin_factory/layouts/add_edit_initiative.haml
404
418
  - lib/fanforce/plugin_factory/layouts/add_source.haml