launch_control 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/launch_control.gemspec +1 -0
- data/lib/launch_control.rb +1 -1
- data/lib/launch_control/mandrill_contract.rb +17 -9
- data/lib/launch_control/version.rb +1 -1
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6ca5a72db16aac918a2604d405c7633cf386907
|
4
|
+
data.tar.gz: ca9f3df4166bc41e187786f3857f73499d4c03ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64f62077388716398fee4dbb881dcf1c29cc7038da4f6d23a083688491bacabf37fb321334d197b091fcfa35bc2b75d1b2246d7c5c74538203d9346afbbf0765
|
7
|
+
data.tar.gz: cefceac0ff5419c5c448fc4fc5b97f59f5517104c6abb953366797ecf273691538208fc5d4cb1564f57568a1e54007a01bb3efede087f10acaaa508032c312ce
|
data/launch_control.gemspec
CHANGED
@@ -35,5 +35,6 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.add_development_dependency "rspec", '~> 3.2', ">= 3.2.0"
|
36
36
|
spec.add_development_dependency "pry", '~> 0.9', ">= 0.9.12"
|
37
37
|
spec.add_development_dependency "webmock"
|
38
|
+
spec.add_development_dependency "byebug"
|
38
39
|
spec.add_development_dependency "simplecov", '~> 0.10', ">= 0.10.0"
|
39
40
|
end
|
data/lib/launch_control.rb
CHANGED
@@ -38,15 +38,18 @@ module LaunchControl
|
|
38
38
|
default_email_contract.merge!(validations)
|
39
39
|
end
|
40
40
|
|
41
|
+
def defaults
|
42
|
+
{}
|
43
|
+
end
|
44
|
+
|
41
45
|
def merged_options(options)
|
42
|
-
options
|
46
|
+
defaults.merge(options)
|
43
47
|
end
|
44
48
|
|
45
|
-
def deliver!(options)
|
46
|
-
|
47
|
-
launch = LaunchControl::Mailer.new(template, options)
|
49
|
+
def deliver!(options = {})
|
50
|
+
launch = LaunchControl::Mailer.new(template, merged_options(options))
|
48
51
|
raise ContractFailure.new(error_string) unless valid?(options) && launch.valid?
|
49
|
-
|
52
|
+
launch.deliver
|
50
53
|
end
|
51
54
|
|
52
55
|
def deliver(options)
|
@@ -55,14 +58,15 @@ module LaunchControl
|
|
55
58
|
end
|
56
59
|
|
57
60
|
def default_email_contract
|
61
|
+
# Note that subject is not required as it can be set in Mandrill
|
58
62
|
{
|
59
|
-
to:
|
60
|
-
subject: 'string'
|
63
|
+
to: lambda { |to| [Array,String,Hash].include?(to.class) && to.present? }
|
61
64
|
}
|
62
65
|
end
|
63
66
|
|
64
|
-
def valid?(options)
|
65
|
-
|
67
|
+
def valid?(options = {})
|
68
|
+
merged_options = merged_options(options)
|
69
|
+
validator = HashValidator.validate(merged_options, merged_contract)
|
66
70
|
if validator.valid?
|
67
71
|
true
|
68
72
|
else
|
@@ -76,5 +80,9 @@ module LaunchControl
|
|
76
80
|
"#{attr} #{message}"
|
77
81
|
}.join(', ')
|
78
82
|
end
|
83
|
+
|
84
|
+
def string_present?
|
85
|
+
lambda { |value| value.class == String && value.present? }
|
86
|
+
end
|
79
87
|
end
|
80
88
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: launch_control
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Teague
|
@@ -146,6 +146,20 @@ dependencies:
|
|
146
146
|
- - ">="
|
147
147
|
- !ruby/object:Gem::Version
|
148
148
|
version: '0'
|
149
|
+
- !ruby/object:Gem::Dependency
|
150
|
+
name: byebug
|
151
|
+
requirement: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
156
|
+
type: :development
|
157
|
+
prerelease: false
|
158
|
+
version_requirements: !ruby/object:Gem::Requirement
|
159
|
+
requirements:
|
160
|
+
- - ">="
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: '0'
|
149
163
|
- !ruby/object:Gem::Dependency
|
150
164
|
name: simplecov
|
151
165
|
requirement: !ruby/object:Gem::Requirement
|