Browse code

copydot task can be called with parameters, no need for separate copydot_deploy

Frederic Hemberger authored on 22/09/2011 at 08:17:31
Showing 1 changed files
... ...
@@ -197,36 +197,24 @@ end
197 197
 
198 198
 desc "Default deploy task"
199 199
 task :deploy do
200
-  [:copydot, "#{deploy_default}"].each { |t| Rake::Task[t].execute }
200
+  Rake::Task[:copydot].invoke(source_dir, public_dir)
201
+  Rake::Task["#{deploy_default}"].execute
201 202
 end
202 203
 
203 204
 desc "Generate website and deploy"
204
-task :gen_deploy do
205
-  [:integrate, :generate, :deploy].each { |t| Rake::Task[t].execute }
205
+task :gen_deploy => [:integrate, :generate, :deploy] do
206 206
 end
207 207
 
208 208
 desc "copy dot files for deployment"
209
-task :copydot do
209
+task :copydot, :source, :dest do |t, args|
210 210
   exclusions = [".", "..", ".DS_Store"]
211
-  Dir["#{source_dir}/**/.*"].each do |file|
211
+  Dir["#{args.source}/**/.*"].each do |file|
212 212
     if !File.directory?(file) && !exclusions.include?(File.basename(file))
213
-      cp(file, file.gsub(/#{source_dir}/, "#{public_dir}"));
213
+      cp(file, file.gsub(/#{args.source}/, "#{args.dest}"));
214 214
     end
215 215
   end
216 216
 end
217 217
 
218
-desc "copy dot files for Github Pages deployment"
219
-task :copydot_deploy do
220
-  exclusions = [".", "..", ".DS_Store"]
221
-  Dir["#{public_dir}/**/.*"].each do |file|
222
-    if !File.directory?(file) && !exclusions.include?(File.basename(file))
223
-      cp(file, file.gsub(/#{public_dir}/, "#{deploy_dir}"));
224
-    end
225
-  end
226
-  puts "\n## copying #{public_dir} to #{deploy_dir}"
227
-end
228
-
229
-
230 218
 desc "Deploy website via rsync"
231 219
 task :rsync do
232 220
   puts "## Deploying website via Rsync"
... ...
@@ -237,7 +225,8 @@ desc "deploy public directory to github pages"
237 237
 multitask :push do
238 238
   puts "## Deploying branch to Github Pages "
239 239
   (Dir["#{deploy_dir}/*"]).each { |f| rm_rf(f) }
240
-  Rake::Task[:copydot_deploy].execute
240
+  Rake::Task[:copydot].invoke(public_dir, deploy_dir)
241
+  puts "\n## copying #{public_dir} to #{deploy_dir}"
241 242
   cd "#{deploy_dir}" do
242 243
     system "git add ."
243 244
     system "git add -u"