muck-engine 0.2.10 → 0.2.11
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/muck_engine/tasks.rb +41 -11
- data/muck-engine.gemspec +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.11
|
data/lib/muck_engine/tasks.rb
CHANGED
@@ -25,6 +25,16 @@ class MuckEngine
|
|
25
25
|
|
26
26
|
namespace :muck do
|
27
27
|
|
28
|
+
# just returns the names of the gems as specified by muck_gems
|
29
|
+
def muck_gem_names
|
30
|
+
if defined?(muck_gems)
|
31
|
+
muck_gems
|
32
|
+
else
|
33
|
+
puts "Please create a method named 'muck_gems' in the namespace :muck in your rakefile."
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# Returns the folder name for each gem. Note that muck-solr lives in the acts_as_solr directory
|
28
38
|
def muck_gem_paths
|
29
39
|
if defined?(muck_gems)
|
30
40
|
muck_gems.collect{|name| muck_gem_path(name)}
|
@@ -41,6 +51,14 @@ class MuckEngine
|
|
41
51
|
end
|
42
52
|
end
|
43
53
|
|
54
|
+
def muck_gem_lib(gem_name)
|
55
|
+
if gem_name == 'muck-solr'
|
56
|
+
'acts_as_solr'
|
57
|
+
else
|
58
|
+
gem_name.sub('-', '_')
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
44
62
|
def muck_unpack(gem_name)
|
45
63
|
system("gem unpack #{gem_name} --target=#{muck_gems_path}")
|
46
64
|
end
|
@@ -74,7 +92,7 @@ class MuckEngine
|
|
74
92
|
end
|
75
93
|
|
76
94
|
def release_gem(path, gem_name)
|
77
|
-
gem_path = File.join(path, gem_name)
|
95
|
+
gem_path = File.join(path, muck_gem_path(gem_name))
|
78
96
|
puts "releasing #{gem_name}"
|
79
97
|
inside gem_path do
|
80
98
|
if File.exists?('pkg/*')
|
@@ -87,15 +105,27 @@ class MuckEngine
|
|
87
105
|
write_new_gem_version(path, gem_name)
|
88
106
|
end
|
89
107
|
|
108
|
+
# examples of stuff we need to look for:
|
109
|
+
# config.gem "muck-raker", :lib => 'muck_raker', :version => '>=0.3.2'
|
90
110
|
def write_new_gem_version(path, gem_name)
|
91
|
-
|
111
|
+
puts "Updating version for: #{gem_name}"
|
112
|
+
gem_lib = muck_gem_lib(gem_name)
|
113
|
+
gem_path = File.join(path, muck_gem_path(gem_name))
|
92
114
|
env_file = File.join(RAILS_ROOT, 'config', 'environment.rb')
|
93
115
|
version = IO.read(File.join(gem_path, 'VERSION')).strip
|
94
116
|
environment = IO.read(env_file)
|
95
|
-
search = Regexp.new(
|
96
|
-
if environment.gsub!(search, ":lib => '#{
|
97
|
-
search = Regexp.new(
|
98
|
-
environment.gsub!(search, "config.gem '#{gem_name}', :version => '>=#{version}'")
|
117
|
+
search = Regexp.new(/\:lib\s*=>\s*['"]#{gem_lib}['"],\s*\:version\s*=>\s*['"][ <>=~]*\d+\.\d+\.\d+['"]/)
|
118
|
+
if environment.gsub!(search, ":lib => '#{gem_lib}', :version => '>=#{version}'").nil?
|
119
|
+
search = Regexp.new(/config.gem\s*['"]#{gem_name}['"],\s*\:version\s*=>\s*['"][ <>=~]*\d+\.\d+\.\d+['"]/)
|
120
|
+
if environment.gsub!(search, "config.gem '#{gem_name}', :version => '>=#{version}'").nil?
|
121
|
+
require 'ruby-debug'
|
122
|
+
debugger
|
123
|
+
t = 0
|
124
|
+
search = Regexp.new(/config.gem\s*['"]#{gem_name}['"]/)
|
125
|
+
if environment.gsub!(search, "config.gem '#{gem_name}', :version => '>=#{version}'").nil?
|
126
|
+
puts "Could not update version for #{gem_name}"
|
127
|
+
end
|
128
|
+
end
|
99
129
|
end
|
100
130
|
|
101
131
|
File.open(env_file, 'w') { |f| f.write(environment) }
|
@@ -159,17 +189,17 @@ class MuckEngine
|
|
159
189
|
|
160
190
|
desc "Release and commit muck gems"
|
161
191
|
task :release_commit_gems do
|
162
|
-
|
192
|
+
muck_gem_names.each do |gem_name|
|
163
193
|
message = "Released new gem"
|
164
194
|
release_gem("#{projects_path}", gem_name)
|
165
|
-
git_commit("#{projects_path}/#{gem_name}", message)
|
166
|
-
git_push("#{projects_path}/#{gem_name}")
|
195
|
+
git_commit("#{projects_path}/#{muck_gem_path(gem_name)}", message)
|
196
|
+
git_push("#{projects_path}/#{muck_gem_path(gem_name)}")
|
167
197
|
end
|
168
198
|
end
|
169
199
|
|
170
200
|
desc "Release muck gems"
|
171
201
|
task :release_gems do
|
172
|
-
|
202
|
+
muck_gem_names.each do |gem_name|
|
173
203
|
release_gem("#{projects_path}", gem_name)
|
174
204
|
end
|
175
205
|
end
|
@@ -205,7 +235,7 @@ class MuckEngine
|
|
205
235
|
|
206
236
|
desc "Write muck gem versions into muck"
|
207
237
|
task :versions do
|
208
|
-
|
238
|
+
muck_gem_names.each do |gem_name|
|
209
239
|
write_new_gem_version("#{projects_path}", gem_name)
|
210
240
|
end
|
211
241
|
end
|
data/muck-engine.gemspec
CHANGED