bundle_notification 0.1.0 → 0.2.0

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
- SHA1:
3
- metadata.gz: b046884fa40a09e53b7060881fc04a217669b1be
4
- data.tar.gz: 493318dedbfa7f20d945e08c4c89a5050086fc66
2
+ SHA256:
3
+ metadata.gz: 2a231784d1a1b74ec10be4eed111d283bfbdc6386f62be831962c944ab19ad50
4
+ data.tar.gz: 9f05f49490047b2e40d2252a34d599567e2ee724ab22f1e5c70d1ca6ee101363
5
5
  SHA512:
6
- metadata.gz: b70c086cd7c621ee7a28537664f4abc61740200e1281b08265ff9e242969b7dedb5a9050239b4f35381d2e78098388bc12a204f4bf35a05ce87e23d7195c6243
7
- data.tar.gz: 4ae21ba08bab367778aca463f57655e2d3e403d9b741aac6c5fb60500fadebe565682b4959e4a674f31794b63decd9243b636a1b8b64f483976b095b18274524
6
+ metadata.gz: 75b6d6729ea8bae8b68cb1af5ad398c4773ae882355c66cfd7d0d64d60972d72b8c18fdfbfb7b43bbd944e3ecd57c5921bb92a317b0c627331e0b02c43f3556f
7
+ data.tar.gz: f8389cf4abfca2d68b16bfedca7f5ab91ab303aef40c25a5696d00e368112259c140bdb7f4d6a134c2756f884e34546db893bea5e12bf091627f6bd6569730d0
@@ -1 +1 @@
1
- 2.3.4
1
+ 2.5.0
data/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  source 'https://rubygems.org'
3
4
 
4
5
  # Specify your gem's dependencies in bundle_notification.gemspec
data/README.md CHANGED
@@ -57,6 +57,24 @@ MyMailer.deliver_unsent_snippets #5
57
57
 
58
58
  This will send 2 emails: One to <recipient_1@example.com> with `['message 1', 'message 2']` and another to <recipient_2@example.com> with `['message 3']`
59
59
 
60
+ ## Configuration
61
+
62
+ The configuration can be accessed through `BundleNotification.config` and
63
+ changed through `BundleNotification.configure`:
64
+
65
+ ```ruby
66
+ BundleNotification.configure do |config|
67
+ config.serializer = JSON
68
+ end
69
+ ```
70
+
71
+ Available configration options are:
72
+
73
+ * **serializer**: The serializer used for the snippet data. It is passed on to
74
+ `ActiveRecord::Base#serialize` as a second argument and, hence, can be
75
+ anything that implements the `dump` and `load` methods. Per ActiveRecord's
76
+ default it is YAML, if not set.
77
+
60
78
  ## Development
61
79
 
62
80
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'bundler/gem_tasks'
3
4
  require 'rspec/core/rake_task'
4
5
  require 'rubocop-ci'
@@ -1,10 +1,8 @@
1
- # coding: utf-8
2
1
  # frozen_string_literal: true
2
+
3
3
  lib = File.expand_path('../lib', __FILE__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require 'bundle_notification/version'
6
-
7
- # rubocop:disable Metrics/BlockLength
8
6
  Gem::Specification.new do |spec|
9
7
  spec.name = 'bundle_notification'
10
8
  spec.version = BundleNotification::VERSION
@@ -30,13 +28,13 @@ Gem::Specification.new do |spec|
30
28
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
29
  spec.require_paths = ['lib']
32
30
 
31
+ spec.add_development_dependency 'actionmailer', '>= 4.0', '< 5.2'
33
32
  spec.add_development_dependency 'bundler', '~> 1.14'
33
+ spec.add_development_dependency 'factory_girl'
34
34
  spec.add_development_dependency 'rake', '~> 10.0'
35
35
  spec.add_development_dependency 'rspec', '~> 3.0'
36
- spec.add_development_dependency 'actionmailer', '>= 4.0', '< 5.2'
37
- spec.add_development_dependency 'sqlite3'
38
- spec.add_development_dependency 'factory_girl'
39
36
  spec.add_development_dependency 'simplecov'
37
+ spec.add_development_dependency 'sqlite3'
40
38
 
41
39
  spec.add_dependency 'activerecord', '>= 4.0', '< 5.2'
42
40
  spec.add_dependency 'activesupport', '>= 4.0', '< 5.2'
@@ -1,7 +1,17 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'bundle_notification/mailer_helper'
3
4
  require 'bundle_notification/version'
5
+ require 'bundle_notification/config'
4
6
 
5
7
  module BundleNotification
6
- # Your code goes here...
8
+ def self.configure
9
+ @config = Config.new
10
+ yield(@config)
11
+ @config
12
+ end
13
+
14
+ def self.config
15
+ @config ||= Config.new
16
+ end
7
17
  end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BundleNotification
4
+ class Config
5
+ attr_accessor :serializer
6
+ end
7
+ end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'active_support/time'
3
4
  require 'bundle_notification/snippet'
4
5
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'active_support/concern'
2
+
3
3
  require 'bundle_notification/deliver'
4
4
  require 'bundle_notification/snippet_message'
5
5
 
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BundleNotification
4
+ module Serializer
5
+ class << self
6
+ delegate :dump, to: :serializer
7
+
8
+ def load(data)
9
+ serializer.load(data) if data
10
+ end
11
+
12
+ def serializer
13
+ BundleNotification.config.serializer || YAML
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,11 +1,13 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'active_record'
4
+ require 'bundle_notification/serializer'
3
5
 
4
6
  module BundleNotification
5
7
  class Snippet < ActiveRecord::Base
6
8
  self.table_name = 'bundle_notification_snippets'
7
9
 
8
- serialize :data
10
+ serialize :data, Serializer
9
11
 
10
12
  scope :unsent_for, ->(mailer_class) { where(mailer_class: mailer_class, sent_at: nil) }
11
13
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'bundle_notification/snippet'
3
4
 
4
5
  module BundleNotification
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module BundleNotification
3
- VERSION = '0.1.0'
4
+ VERSION = '0.2.0'
4
5
  end
metadata CHANGED
@@ -1,93 +1,93 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundle_notification
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ad2games GmbH
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-07 00:00:00.000000000 Z
11
+ date: 2018-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
14
+ name: actionmailer
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.14'
19
+ version: '4.0'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5.2'
20
23
  type: :development
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: '1.14'
29
+ version: '4.0'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5.2'
27
33
  - !ruby/object:Gem::Dependency
28
- name: rake
34
+ name: bundler
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - "~>"
32
38
  - !ruby/object:Gem::Version
33
- version: '10.0'
39
+ version: '1.14'
34
40
  type: :development
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
44
  - - "~>"
39
45
  - !ruby/object:Gem::Version
40
- version: '10.0'
46
+ version: '1.14'
41
47
  - !ruby/object:Gem::Dependency
42
- name: rspec
48
+ name: factory_girl
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
- - - "~>"
51
+ - - ">="
46
52
  - !ruby/object:Gem::Version
47
- version: '3.0'
53
+ version: '0'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
- - - "~>"
58
+ - - ">="
53
59
  - !ruby/object:Gem::Version
54
- version: '3.0'
60
+ version: '0'
55
61
  - !ruby/object:Gem::Dependency
56
- name: actionmailer
62
+ name: rake
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '4.0'
62
- - - "<"
65
+ - - "~>"
63
66
  - !ruby/object:Gem::Version
64
- version: '5.2'
67
+ version: '10.0'
65
68
  type: :development
66
69
  prerelease: false
67
70
  version_requirements: !ruby/object:Gem::Requirement
68
71
  requirements:
69
- - - ">="
70
- - !ruby/object:Gem::Version
71
- version: '4.0'
72
- - - "<"
72
+ - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '5.2'
74
+ version: '10.0'
75
75
  - !ruby/object:Gem::Dependency
76
- name: sqlite3
76
+ name: rspec
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - ">="
79
+ - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '0'
81
+ version: '3.0'
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - ">="
86
+ - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: '0'
88
+ version: '3.0'
89
89
  - !ruby/object:Gem::Dependency
90
- name: factory_girl
90
+ name: simplecov
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
93
  - - ">="
@@ -101,7 +101,7 @@ dependencies:
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  - !ruby/object:Gem::Dependency
104
- name: simplecov
104
+ name: sqlite3
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
107
  - - ">="
@@ -175,8 +175,10 @@ files:
175
175
  - bundle_notification.gemspec
176
176
  - circle.yml
177
177
  - lib/bundle_notification.rb
178
+ - lib/bundle_notification/config.rb
178
179
  - lib/bundle_notification/deliver.rb
179
180
  - lib/bundle_notification/mailer_helper.rb
181
+ - lib/bundle_notification/serializer.rb
180
182
  - lib/bundle_notification/snippet.rb
181
183
  - lib/bundle_notification/snippet_message.rb
182
184
  - lib/bundle_notification/version.rb
@@ -201,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
203
  version: '0'
202
204
  requirements: []
203
205
  rubyforge_project:
204
- rubygems_version: 2.5.2
206
+ rubygems_version: 2.7.3
205
207
  signing_key:
206
208
  specification_version: 4
207
209
  summary: Bundle ActionMailer notifications