launch_control 0.3.1 → 0.4.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
2
  SHA1:
3
- metadata.gz: 0fa6a3a80f5a4b971a64ddb0ad392fc0ac6e9035
4
- data.tar.gz: 18cf4f8424ddc26483adf94bdbc1889f36606aca
3
+ metadata.gz: 862084a345e31444834f1be53cabc41e7c2ca9fa
4
+ data.tar.gz: 97ba4842f3be6640dfc571c0bda30fbf177092d9
5
5
  SHA512:
6
- metadata.gz: 5f7f059404c3dad83d3ba779d97271be50db7ebe2bf4ae54164dc099e00479ab12dffa283b6d7894cc4b022db28560cfd9a0994820e8b4a4e35346608d7405fc
7
- data.tar.gz: 8f28f6a0c25a7d0341d1a44021a67b6a1a6afe21a4acb6b9a9a312954643f5115acbb43b08c06aa45e918c0fa85335c4a573f2820febadf484aaa1bb8bbc1555
6
+ metadata.gz: ea6f1112b7f95097cece49d81452ff1e5d731b1bcb15aa62e1c15b4bd5c87a7b545859cd7fda5723e86a323a348e8e415d48656ae06acb283b362102352e9390
7
+ data.tar.gz: c5e0495a06647b62bb5a180f04476c419bc1cd030a64c7598a274d52f75961a25b6f197faf5db666aed169272696f6c99e75c1b9e0d7c08e1bd7234d78e47cc4
@@ -177,11 +177,6 @@ module LaunchControl
177
177
  attr_accessor :configuration
178
178
  end
179
179
 
180
- def self.configure
181
- self.configuration ||= Configuration.new
182
- yield(configuration)
183
- end
184
-
185
180
  class Configuration
186
181
  attr_accessor :mandrill_api_key
187
182
 
@@ -190,4 +185,11 @@ module LaunchControl
190
185
  end
191
186
  end
192
187
 
188
+ def self.configure
189
+ self.configuration ||= Configuration.new
190
+ yield(configuration) if block_given?
191
+ end
192
+
193
+ # Ensure default config
194
+ configure
193
195
  end
@@ -1,4 +1,5 @@
1
1
  module LaunchControl
2
+ class ContractFailure < StandardError; end
2
3
 
3
4
  require 'hash_validator'
4
5
 
@@ -41,13 +42,18 @@ module LaunchControl
41
42
  options
42
43
  end
43
44
 
44
-
45
- def deliver(options)
45
+ def deliver!(options)
46
46
  options = merged_options(options)
47
47
  launch = LaunchControl::Mailer.new(template, options)
48
+ raise ContractFailure.new(error_string) unless valid?(options) && launch.valid?
48
49
  valid?(options) && launch.valid? && launch.deliver
49
50
  end
50
51
 
52
+ def deliver(options)
53
+ ActiveSupport::Deprecation.warn('deliver is deprecated. Use deliver! instead.')
54
+ deliver!(options)
55
+ end
56
+
51
57
  def default_email_contract
52
58
  {
53
59
  to: lambda { |to| [Array,String,Hash].include?(to.class) },
@@ -65,6 +71,10 @@ module LaunchControl
65
71
  end
66
72
  end
67
73
 
74
+ def error_string
75
+ (@errors || {}).map { |(attr, message)|
76
+ "#{attr} #{message}"
77
+ }.join(', ')
78
+ end
68
79
  end
69
-
70
80
  end
@@ -1,3 +1,3 @@
1
1
  module LaunchControl
2
- VERSION = "0.3.1"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,169 +1,169 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: launch_control
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Teague
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-12-10 00:00:00.000000000 Z
11
+ date: 2016-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mandrill-api
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.0'
20
- - - '>='
20
+ - - ">="
21
21
  - !ruby/object:Gem::Version
22
22
  version: 1.0.53
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - ~>
27
+ - - "~>"
28
28
  - !ruby/object:Gem::Version
29
29
  version: '1.0'
30
- - - '>='
30
+ - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 1.0.53
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: hash_validator
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ~>
37
+ - - "~>"
38
38
  - !ruby/object:Gem::Version
39
39
  version: '0.4'
40
- - - '>='
40
+ - - ">="
41
41
  - !ruby/object:Gem::Version
42
42
  version: 0.4.0
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - ~>
47
+ - - "~>"
48
48
  - !ruby/object:Gem::Version
49
49
  version: '0.4'
50
- - - '>='
50
+ - - ">="
51
51
  - !ruby/object:Gem::Version
52
52
  version: 0.4.0
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: activesupport
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
- - - '>='
57
+ - - ">="
58
58
  - !ruby/object:Gem::Version
59
59
  version: 3.2.13
60
60
  type: :runtime
61
61
  prerelease: false
62
62
  version_requirements: !ruby/object:Gem::Requirement
63
63
  requirements:
64
- - - '>='
64
+ - - ">="
65
65
  - !ruby/object:Gem::Version
66
66
  version: 3.2.13
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: bundler
69
69
  requirement: !ruby/object:Gem::Requirement
70
70
  requirements:
71
- - - '>='
71
+ - - ">="
72
72
  - !ruby/object:Gem::Version
73
73
  version: '1.10'
74
74
  type: :development
75
75
  prerelease: false
76
76
  version_requirements: !ruby/object:Gem::Requirement
77
77
  requirements:
78
- - - '>='
78
+ - - ">="
79
79
  - !ruby/object:Gem::Version
80
80
  version: '1.10'
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: rake
83
83
  requirement: !ruby/object:Gem::Requirement
84
84
  requirements:
85
- - - '>='
85
+ - - ">="
86
86
  - !ruby/object:Gem::Version
87
87
  version: '10.0'
88
88
  type: :development
89
89
  prerelease: false
90
90
  version_requirements: !ruby/object:Gem::Requirement
91
91
  requirements:
92
- - - '>='
92
+ - - ">="
93
93
  - !ruby/object:Gem::Version
94
94
  version: '10.0'
95
95
  - !ruby/object:Gem::Dependency
96
96
  name: rspec
97
97
  requirement: !ruby/object:Gem::Requirement
98
98
  requirements:
99
- - - ~>
99
+ - - "~>"
100
100
  - !ruby/object:Gem::Version
101
101
  version: '3.2'
102
- - - '>='
102
+ - - ">="
103
103
  - !ruby/object:Gem::Version
104
104
  version: 3.2.0
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - ~>
109
+ - - "~>"
110
110
  - !ruby/object:Gem::Version
111
111
  version: '3.2'
112
- - - '>='
112
+ - - ">="
113
113
  - !ruby/object:Gem::Version
114
114
  version: 3.2.0
115
115
  - !ruby/object:Gem::Dependency
116
116
  name: pry
117
117
  requirement: !ruby/object:Gem::Requirement
118
118
  requirements:
119
- - - ~>
119
+ - - "~>"
120
120
  - !ruby/object:Gem::Version
121
121
  version: '0.9'
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: 0.9.12
125
125
  type: :development
126
126
  prerelease: false
127
127
  version_requirements: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ~>
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0.9'
132
- - - '>='
132
+ - - ">="
133
133
  - !ruby/object:Gem::Version
134
134
  version: 0.9.12
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: webmock
137
137
  requirement: !ruby/object:Gem::Requirement
138
138
  requirements:
139
- - - '>='
139
+ - - ">="
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0'
142
142
  type: :development
143
143
  prerelease: false
144
144
  version_requirements: !ruby/object:Gem::Requirement
145
145
  requirements:
146
- - - '>='
146
+ - - ">="
147
147
  - !ruby/object:Gem::Version
148
148
  version: '0'
149
149
  - !ruby/object:Gem::Dependency
150
150
  name: simplecov
151
151
  requirement: !ruby/object:Gem::Requirement
152
152
  requirements:
153
- - - ~>
153
+ - - "~>"
154
154
  - !ruby/object:Gem::Version
155
155
  version: '0.10'
156
- - - '>='
156
+ - - ">="
157
157
  - !ruby/object:Gem::Version
158
158
  version: 0.10.0
159
159
  type: :development
160
160
  prerelease: false
161
161
  version_requirements: !ruby/object:Gem::Requirement
162
162
  requirements:
163
- - - ~>
163
+ - - "~>"
164
164
  - !ruby/object:Gem::Version
165
165
  version: '0.10'
166
- - - '>='
166
+ - - ">="
167
167
  - !ruby/object:Gem::Version
168
168
  version: 0.10.0
169
169
  description:
@@ -173,9 +173,9 @@ executables: []
173
173
  extensions: []
174
174
  extra_rdoc_files: []
175
175
  files:
176
- - .gitignore
177
- - .rspec
178
- - .travis.yml
176
+ - ".gitignore"
177
+ - ".rspec"
178
+ - ".travis.yml"
179
179
  - Gemfile
180
180
  - LICENSE.txt
181
181
  - README.md
@@ -197,17 +197,17 @@ require_paths:
197
197
  - lib
198
198
  required_ruby_version: !ruby/object:Gem::Requirement
199
199
  requirements:
200
- - - '>='
200
+ - - ">="
201
201
  - !ruby/object:Gem::Version
202
202
  version: '0'
203
203
  required_rubygems_version: !ruby/object:Gem::Requirement
204
204
  requirements:
205
- - - '>='
205
+ - - ">="
206
206
  - !ruby/object:Gem::Version
207
207
  version: '0'
208
208
  requirements: []
209
209
  rubyforge_project:
210
- rubygems_version: 2.4.5
210
+ rubygems_version: 2.4.8
211
211
  signing_key:
212
212
  specification_version: 4
213
213
  summary: Ensure that emails delivered to Mandrill meet a specified contract.