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 CHANGED
@@ -1 +1 @@
1
- 0.2.10
1
+ 0.2.11
@@ -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
- gem_path = File.join(path, gem_name)
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('\:lib\s+=>\s+\'' + gem_name + '\',\s+\:version\s+=>\s+[\'\"][ <>=~]*\d+\.\d+\.\d+[\'\"]')
96
- if environment.gsub!(search, ":lib => '#{gem_name}', :version => '>=#{version}'").nil?
97
- search = Regexp.new('config.gem\s+\'' + gem_name + '\',\s+\:version\s+=>\s+[\'\"][ <>=~]*\d+\.\d+\.\d+[\'\"]')
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
- muck_gem_paths.each do |gem_name|
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
- muck_gem_paths.each do |gem_name|
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
- muck_gem_paths.each do |gem_name|
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
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{muck-engine}
8
- s.version = "0.2.10"
8
+ s.version = "0.2.11"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Justin Ball"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: muck-engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.10
4
+ version: 0.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Ball