le1t0-deprec 2.1.6.002 → 2.1.6.003
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/lib/deprec/recipes_minus_rails.rb +10 -110
- metadata +3 -3
data/CHANGELOG
CHANGED
@@ -4,122 +4,22 @@ unless Capistrano::Configuration.respond_to?(:instance)
|
|
4
4
|
end
|
5
5
|
|
6
6
|
# manually loading all recipes is cumbersome and leads to a lot of conflicts when merging branches.
|
7
|
-
# I rewrote this file so recipes get loaded automatically. Only files mentioned in the
|
7
|
+
# I rewrote this file so recipes get loaded automatically. Only files mentioned in the preload_recipes list and all
|
8
8
|
# files ending in .rb get loaded, so rename them to prevent them being loaded (as I did with some based on the
|
9
9
|
# old code)
|
10
10
|
|
11
11
|
# Loading is done as follows:
|
12
|
-
# -
|
13
|
-
# -
|
14
|
-
# - load the rest of the recipes to the end of the load order list
|
15
|
-
# - require all recipes mentioned in the load order list in the order that they are mentioned
|
12
|
+
# - preload a couple of recipes in a certain order
|
13
|
+
# - load all other recipes in directory order
|
16
14
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
next if [ ".", "..", "rails" ].include?(entry)
|
21
|
-
fqn = File.join(base_dir, entry)
|
22
|
-
if File.directory?(fqn)
|
23
|
-
recipes += load_recipe_names(fqn, "#{prefix}#{entry}/")
|
24
|
-
elsif fqn =~ /\.rb$/
|
25
|
-
recipes << "#{prefix}#{entry.gsub(/\.rb$/, '')}"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
recipes
|
15
|
+
preload_recipes = [ "canonical", "deprec", "deprecated" ]
|
16
|
+
base_recipes = Dir.glob("#{File.dirname(__FILE__)}/recipes/*.rb").collect do |filename|
|
17
|
+
File.basename(filename, '.rb')
|
29
18
|
end
|
30
|
-
|
31
|
-
|
32
|
-
copy_of_dependencies = {}
|
33
|
-
# load defined dependencies + make values of type array if they aren't + add entries for non-mentioned dependencies
|
34
|
-
# themselves
|
35
|
-
yield().each do |recipe, dependencies|
|
36
|
-
copy_of_dependencies[recipe.to_s] = [dependencies].flatten.collect { |dependency| dependency.to_s }
|
37
|
-
copy_of_dependencies[recipe.to_s].each do |dependency|
|
38
|
-
copy_of_dependencies[dependency] = [] if copy_of_dependencies[dependency].nil?
|
39
|
-
end
|
40
|
-
end
|
41
|
-
recipies_load_order = []
|
42
|
-
|
43
|
-
# define load order for all depended upon recipes
|
44
|
-
offset = 0
|
45
|
-
while copy_of_dependencies.keys.size > 0 do
|
46
|
-
current = copy_of_dependencies.keys[offset]
|
47
|
-
if current.nil? && offset > 0
|
48
|
-
offset -= 1
|
49
|
-
next
|
50
|
-
end
|
51
|
-
raise "cannot find recipe #{current}.rb in the filesystem!" if !File.exist?("#{File.dirname(__FILE__)}/recipes/#{current}.rb")
|
52
|
-
dependencies = copy_of_dependencies[current]
|
53
|
-
if dependencies.size == 0 || dependencies.all? { |dependency| recipies_load_order.include?(dependency) }
|
54
|
-
recipies_load_order << current
|
55
|
-
copy_of_dependencies.delete(current)
|
56
|
-
else
|
57
|
-
offset = (offset + 1) % copy_of_dependencies.keys.size
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
load_recipe_names("#{File.dirname(__FILE__)}/recipes/").each do |recipe|
|
62
|
-
recipies_load_order << recipe unless recipies_load_order.include?(recipe)
|
63
|
-
end
|
64
|
-
|
65
|
-
recipies_load_order
|
19
|
+
alternatives_recipes = Dir.glob("#{File.dirname(__FILE__)}/recipes/*/*.rb").collect do |filename|
|
20
|
+
"#{File.basename(File.dirname(filename))}/#{File.basename(filename, '.rb')}"
|
66
21
|
end
|
67
22
|
|
68
|
-
|
69
|
-
# key is the recipe to load, value is the recipe that should be loaded earlier already
|
70
|
-
# value can be an array (to denote multiple dependencies), but doesn't have to be
|
71
|
-
# TODO: cleanup and minimize number of dependencies.
|
72
|
-
# NOTE: this is only needed to define a load order. If one recipe is needed to be loaded
|
73
|
-
# before all others, just mention it by itself with an empty array dependencies list, since
|
74
|
-
# all other recipes are loaded after the recipes mentioned here.
|
75
|
-
# NOTE2: internally the dependencies processor works with strings, but we can specify using
|
76
|
-
# symbols here
|
77
|
-
{
|
78
|
-
:deprec => :canonical,
|
79
|
-
:deprecated => :deprec,
|
80
|
-
:chef => :deprecated,
|
81
|
-
:"app/mongrel" => :chef,
|
82
|
-
:"app/passenger" => :"app/mongrel",
|
83
|
-
:"db/mysql" => :"app/passenger",
|
84
|
-
:"db/postgresql" => :"db/mysql",
|
85
|
-
:"db/sqlite" => :"db/postgresql",
|
86
|
-
:"db/couchdb" => :"db/sqlite",
|
87
|
-
:"ruby/mri" => :"db/couchdb",
|
88
|
-
:"ruby/ree" => :"ruby/mri",
|
89
|
-
:"web/apache" => :"ruby/ree",
|
90
|
-
:"web/nginx" => :"web/apache",
|
91
|
-
:git => :"web/nginx",
|
92
|
-
:svn => :git,
|
93
|
-
:integrity => :svn,
|
94
|
-
:users => :integrity,
|
95
|
-
:ssh => :users,
|
96
|
-
:php => :ssh,
|
97
|
-
:aoe => :php,
|
98
|
-
:xen => :aoe,
|
99
|
-
:xentools => :xen,
|
100
|
-
:ddclient => :xentools,
|
101
|
-
:ntp => :ddclient,
|
102
|
-
:logrotate => :ntp,
|
103
|
-
:ssl => :logrotate,
|
104
|
-
:postfix => :ssl,
|
105
|
-
:memcache => :postfix,
|
106
|
-
:monit => :memcache,
|
107
|
-
:network => :monit,
|
108
|
-
:nagios => :network,
|
109
|
-
:collectd => :nagios,
|
110
|
-
:syslog => :collectd,
|
111
|
-
:heartbeat => :syslog,
|
112
|
-
:haproxy => :heartbeat,
|
113
|
-
:ubuntu => :haproxy,
|
114
|
-
:lvm => :ubuntu,
|
115
|
-
:vnstat => :lvm,
|
116
|
-
:utils => :vnstat,
|
117
|
-
:wpmu => :utils,
|
118
|
-
:ar_sendmail => :wpmu,
|
119
|
-
:starling => :ar_sendmail
|
120
|
-
}
|
121
|
-
end
|
122
|
-
|
123
|
-
recipies_load_order.each do |recipe|
|
23
|
+
(preload_recipes + base_recipes + alternatives_recipes).each do |recipe|
|
124
24
|
require "#{File.dirname(__FILE__)}/recipes/#{recipe}"
|
125
|
-
end
|
25
|
+
end
|
metadata
CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
|
|
6
6
|
- 2
|
7
7
|
- 1
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 2.1.6.
|
9
|
+
- 3
|
10
|
+
version: 2.1.6.003
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Le1t0
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-05-
|
18
|
+
date: 2010-05-23 00:00:00 +02:00
|
19
19
|
default_executable: depify
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|