disco_app 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb7a296f6ce7a9ce25aae89a29d0e7e572cb4d8951204eb228a4082bcdd79c26
4
- data.tar.gz: 894c605bfaf8d52a9b318fb5eb2a77d00523a16bb8a9785208843c65e9da0163
3
+ metadata.gz: 2aea621a853026f74eafff2e73f50d988c2ee307c34d695e3bec09d91fa1a89e
4
+ data.tar.gz: 3b52502b57d84599268706459a7e87953436bd9ea2058e0419e96053252813fd
5
5
  SHA512:
6
- metadata.gz: db0e0e1e6466cc93acebaf0b8fd908db03f90a3156df7471bcbbfbf741065e87f3664024f30dd99bd62de365f6097904b41626a1b714a728e65c43b9dcb6e662
7
- data.tar.gz: 56f900ff28ac24213f52664603f27fe7d0bc74575a2286ddfcb71948c27790e887f36603a79b863ae8a7395170e03ee04f71a01294436b0c1d7a2b669b36bfb5
6
+ metadata.gz: 867867d75021ba2020107b0ade11795dff0154da13ac82807702c006e7c8091e99a183ea2ea652469c27324211e6668c819cb6922058e8e5caaa560ce7d9e9ab
7
+ data.tar.gz: a414302c5d3291c64bc018179bb6db40f23dccb09aa7cd3c0a41f75eb33b76dde0bfbd9e595c1ab50df0635ea189fa907f198ef8f188f9b0c668da24e178b7a0
@@ -6,16 +6,25 @@ module DiscoApp::Concerns::SynchroniseCarrierServiceJob
6
6
  # Don't proceed unless we have a name and callback url.
7
7
  return unless carrier_service_name and callback_url
8
8
 
9
- # Don't proceed if the carrier service is already registered.
10
- return if current_carrier_service_names.include?(carrier_service_name)
11
-
12
- # Otherwise, register the carrier service.
13
- ShopifyAPI::CarrierService.create(
14
- name: carrier_service_name,
15
- callback_url: callback_url,
16
- service_discovery: true,
17
- format: 'json'
18
- )
9
+ # Registered the carrier service if it hasn't been registered yet.
10
+ unless current_carrier_service_names.include?(carrier_service_name)
11
+ ShopifyAPI::CarrierService.create(
12
+ name: carrier_service_name,
13
+ callback_url: callback_url,
14
+ service_discovery: true,
15
+ format: :json
16
+ )
17
+ end
18
+
19
+ # Ensure any existing carrier services (with the correct name) are active
20
+ # and have a current callback URL.
21
+ current_carrier_services.each do |carrier_service|
22
+ if carrier_service.name == carrier_service_name
23
+ carrier_service.callback_url = callback_url
24
+ carrier_service.active = true
25
+ carrier_service.save
26
+ end
27
+ end
19
28
  end
20
29
 
21
30
  protected
@@ -30,7 +39,7 @@ module DiscoApp::Concerns::SynchroniseCarrierServiceJob
30
39
 
31
40
  private
32
41
 
33
- # Return a list of currently registered callback URLs.
42
+ # Return a list of currently registered carrier service names.
34
43
  def current_carrier_service_names
35
44
  current_carrier_services.map(&:name)
36
45
  end
@@ -22,6 +22,14 @@ module DiscoApp::Concerns::SynchroniseWebhooksJob
22
22
  webhook.delete
23
23
  end
24
24
  end
25
+
26
+ # Ensure webhook addresses are current.
27
+ current_webhooks.each do |webhook|
28
+ unless webhook.address == webhooks_url
29
+ webhook.address = webhooks_url
30
+ webhook.save
31
+ end
32
+ end
25
33
  end
26
34
 
27
35
  protected
@@ -1,3 +1,3 @@
1
1
  module DiscoApp
2
- VERSION = '0.8.1'
2
+ VERSION = '0.8.2'
3
3
  end
@@ -1,14 +1,15 @@
1
1
  module DiscoApp
2
2
  module Generators
3
- class RollbarifyGenerator < Rails::Generators::Base
3
+ class MonitorifyGenerator < Rails::Generators::Base
4
4
 
5
5
  source_root File.expand_path('../templates', __FILE__)
6
6
 
7
- # Install the Rollbar and OJ gems.
7
+ # Install the Rollbar, OJ and New Relic gems.
8
8
  def install_gems
9
9
  # Add gem to Gemfile
10
10
  gem 'rollbar', '~> 2.7.1'
11
11
  gem 'oj', '~> 2.14.3'
12
+ gem 'newrelic_rpm', '~> 3.14.1.311'
12
13
 
13
14
  # Install gem.
14
15
  Bundler.with_clean_env do
@@ -16,9 +17,10 @@ module DiscoApp
16
17
  end
17
18
  end
18
19
 
19
- # Copy initializer.
20
+ # Copy Rollbar initializer and New Relic config file.
20
21
  def configure
21
22
  copy_file 'initializers/rollbar.rb', 'config/initializers/rollbar.rb'
23
+ copy_file 'config/newrelic.yml', 'config/newrelic.yml'
22
24
  end
23
25
 
24
26
  end
@@ -0,0 +1,26 @@
1
+ # This file configures the New Relic Agent.
2
+ #
3
+ # For full documentation of agent configuration options, please refer to
4
+ # https://docs.newrelic.com/docs/agents/ruby-agent/installation-configuration/ruby-agent-configuration
5
+
6
+ common: &default_settings
7
+ license_key: <%= ENV['NEW_RELIC_LICENSE_KEY'] %>
8
+ app_name: <%= ENV['SHOPIFY_APP_NAME'] || 'Unknown App' %>
9
+
10
+ # To disable the agent regardless of other settings, uncomment the following:
11
+ # agent_enabled: false
12
+
13
+ # Logging level for log/newrelic_agent.log
14
+ log_level: info
15
+
16
+ development:
17
+ <<: *default_settings
18
+ app_name: <%= ENV['SHOPIFY_APP_NAME'] || 'Unknown App' %> (Development)
19
+ developer_mode: true
20
+
21
+ test:
22
+ <<: *default_settings
23
+ monitor_mode: false
24
+
25
+ production:
26
+ <<: *default_settings
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: disco_app
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Ballard
@@ -341,9 +341,10 @@ files:
341
341
  - lib/generators/disco_app/USAGE
342
342
  - lib/generators/disco_app/disco_app_generator.rb
343
343
  - lib/generators/disco_app/mailify/mailify_generator.rb
344
+ - lib/generators/disco_app/monitorify/monitorify_generator.rb
345
+ - lib/generators/disco_app/monitorify/templates/config/newrelic.yml
346
+ - lib/generators/disco_app/monitorify/templates/initializers/rollbar.rb
344
347
  - lib/generators/disco_app/reactify/reactify_generator.rb
345
- - lib/generators/disco_app/rollbarify/rollbarify_generator.rb
346
- - lib/generators/disco_app/rollbarify/templates/initializers/rollbar.rb
347
348
  - lib/generators/disco_app/templates/assets/javascripts/application.js
348
349
  - lib/generators/disco_app/templates/assets/stylesheets/application.scss
349
350
  - lib/generators/disco_app/templates/config/puma.rb