foreplay 0.10.1 → 0.10.2
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 +4 -4
- data/lib/foreplay.rb +54 -0
- data/lib/foreplay/engine.rb +0 -2
- data/lib/foreplay/version.rb +1 -1
- data/spec/lib/hash_spec.rb +1 -1
- metadata +3 -5
- data/lib/hash.rb +0 -30
- data/lib/string.rb +0 -21
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8309e23db1f7672cdaed6a12e16ff0b169d12585
|
|
4
|
+
data.tar.gz: 44607300ff2632d6c3d55f7a2d2ed254c1519b86
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 44ffafaac345689e2e0da36d4a2abf5c65545508d38ad5b881d99e2c40621cee76d7ea4b22f0a7d15853c89894bbfe1fbd645c384f6404b994f4339c6cec10e2
|
|
7
|
+
data.tar.gz: 3fd4c8e252f3692d77252f4b3deb724a45356007423b28aa51f9e58d99a12425b96734c730802b683a593476be5474cafc01a7564b6d85f1e954e572b6db2143
|
data/lib/foreplay.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require 'active_support/core_ext'
|
|
1
2
|
require 'foreplay/version'
|
|
2
3
|
require 'foreplay/engine'
|
|
3
4
|
require 'foreplay/launcher'
|
|
@@ -14,3 +15,56 @@ module Foreplay
|
|
|
14
15
|
fail message
|
|
15
16
|
end
|
|
16
17
|
end
|
|
18
|
+
|
|
19
|
+
require 'active_support/core_ext/object'
|
|
20
|
+
|
|
21
|
+
class Hash
|
|
22
|
+
# Returns a new hash with +hash+ and +other_hash+ merged recursively, including arrays.
|
|
23
|
+
#
|
|
24
|
+
# h1 = { x: { y: [4,5,6] }, z: [7,8,9] }
|
|
25
|
+
# h2 = { x: { y: [7,8,9] }, z: 'xyz' }
|
|
26
|
+
# h1.supermerge(h2)
|
|
27
|
+
# #=> {:x=>{:y=>[4, 5, 6, 7, 8, 9]}, :z=>[7, 8, 9, "xyz"]}
|
|
28
|
+
def supermerge(other_hash)
|
|
29
|
+
fail 'supermerge only works if you pass a hash. '\
|
|
30
|
+
"You passed a #{self.class} and a #{other_hash.class}." unless other_hash.is_a?(Hash)
|
|
31
|
+
|
|
32
|
+
new_hash = deep_dup
|
|
33
|
+
|
|
34
|
+
other_hash.each_pair do |k, v|
|
|
35
|
+
tv = new_hash[k]
|
|
36
|
+
|
|
37
|
+
if tv.is_a?(Hash) && v.is_a?(Hash)
|
|
38
|
+
new_hash[k] = tv.supermerge(v)
|
|
39
|
+
elsif tv.is_a?(Array) || v.is_a?(Array)
|
|
40
|
+
new_hash[k] = Array.wrap(tv) + Array.wrap(v)
|
|
41
|
+
else
|
|
42
|
+
new_hash[k] = v
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
new_hash
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Some useful additions to the String class
|
|
51
|
+
class String
|
|
52
|
+
colors = %w(black red green yellow blue magenta cyan white)
|
|
53
|
+
|
|
54
|
+
colors.each_with_index do |fg_color, i|
|
|
55
|
+
fg = 30 + i
|
|
56
|
+
define_method(fg_color) { ansi_attributes(fg) }
|
|
57
|
+
|
|
58
|
+
colors.each_with_index do |bg_color, j|
|
|
59
|
+
define_method("#{fg_color}_on_#{bg_color}") { ansi_attributes(fg, 40 + j) }
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def ansi_attributes(*args)
|
|
64
|
+
"\e[#{args.join(';')}m#{self}\e[0m"
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def fake_erb
|
|
68
|
+
gsub(/(<%=\s+([^%]+)\s+%>)/) { |e| eval "_ = #{e.split[1]}" }
|
|
69
|
+
end
|
|
70
|
+
end
|
data/lib/foreplay/engine.rb
CHANGED
data/lib/foreplay/version.rb
CHANGED
data/spec/lib/hash_spec.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: foreplay
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.10.
|
|
4
|
+
version: 0.10.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Xenapto
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-05-
|
|
11
|
+
date: 2015-05-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: foreman
|
|
@@ -236,8 +236,6 @@ files:
|
|
|
236
236
|
- lib/foreplay/setup.rb
|
|
237
237
|
- lib/foreplay/setup/foreplay.yml
|
|
238
238
|
- lib/foreplay/version.rb
|
|
239
|
-
- lib/hash.rb
|
|
240
|
-
- lib/string.rb
|
|
241
239
|
- spec/lib/foreplay/deploy_spec.rb
|
|
242
240
|
- spec/lib/foreplay/secrets_spec.rb
|
|
243
241
|
- spec/lib/foreplay/setup_spec.rb
|
|
@@ -263,7 +261,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
263
261
|
version: '0'
|
|
264
262
|
requirements: []
|
|
265
263
|
rubyforge_project:
|
|
266
|
-
rubygems_version: 2.4.
|
|
264
|
+
rubygems_version: 2.4.7
|
|
267
265
|
signing_key:
|
|
268
266
|
specification_version: 4
|
|
269
267
|
summary: 'Example: foreplay deploy production'
|
data/lib/hash.rb
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
require 'active_support/core_ext/object'
|
|
2
|
-
|
|
3
|
-
class Hash
|
|
4
|
-
# Returns a new hash with +hash+ and +other_hash+ merged recursively, including arrays.
|
|
5
|
-
#
|
|
6
|
-
# h1 = { x: { y: [4,5,6] }, z: [7,8,9] }
|
|
7
|
-
# h2 = { x: { y: [7,8,9] }, z: 'xyz' }
|
|
8
|
-
# h1.supermerge(h2)
|
|
9
|
-
# #=> {:x=>{:y=>[4, 5, 6, 7, 8, 9]}, :z=>[7, 8, 9, "xyz"]}
|
|
10
|
-
def supermerge(other_hash)
|
|
11
|
-
fail 'supermerge only works if you pass a hash. '\
|
|
12
|
-
"You passed a #{self.class} and a #{other_hash.class}." unless other_hash.is_a?(Hash)
|
|
13
|
-
|
|
14
|
-
new_hash = deep_dup
|
|
15
|
-
|
|
16
|
-
other_hash.each_pair do |k, v|
|
|
17
|
-
tv = new_hash[k]
|
|
18
|
-
|
|
19
|
-
if tv.is_a?(Hash) && v.is_a?(Hash)
|
|
20
|
-
new_hash[k] = tv.supermerge(v)
|
|
21
|
-
elsif tv.is_a?(Array) || v.is_a?(Array)
|
|
22
|
-
new_hash[k] = Array.wrap(tv) + Array.wrap(v)
|
|
23
|
-
else
|
|
24
|
-
new_hash[k] = v
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
new_hash
|
|
29
|
-
end
|
|
30
|
-
end
|
data/lib/string.rb
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# Some useful additions to the String class
|
|
2
|
-
class String
|
|
3
|
-
colors = %w(black red green yellow blue magenta cyan white)
|
|
4
|
-
|
|
5
|
-
colors.each_with_index do |fg_color, i|
|
|
6
|
-
fg = 30 + i
|
|
7
|
-
define_method(fg_color) { ansi_attributes(fg) }
|
|
8
|
-
|
|
9
|
-
colors.each_with_index do |bg_color, j|
|
|
10
|
-
define_method("#{fg_color}_on_#{bg_color}") { ansi_attributes(fg, 40 + j) }
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def ansi_attributes(*args)
|
|
15
|
-
"\e[#{args.join(';')}m#{self}\e[0m"
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def fake_erb
|
|
19
|
-
gsub(/(<%=\s+([^%]+)\s+%>)/) { |e| eval "_ = #{e.split[1]}" }
|
|
20
|
-
end
|
|
21
|
-
end
|