GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Rubygem
Description: Resource-oriented open source Ruby framework for Web apps.
Homepage: http://rubywaves.com/
Clone URL: git://github.com/dyoder/waves.git
created freeze and unfreeze tasks in the app Rakefile
automatthew (author)
Wed Jul 09 09:30:00 -0700 2008
commit  3c067fc7e442442925be7a5fc851149eacb06cd5
tree    41f34f7f577ddc49fe6d046ea9475b21626bee26
parent  6a9e69ed813f0401aa1bf1f2b90cf59305df898d
...
3
4
5
6
7
8
9
10
 
 
 
11
12
13
 
 
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
...
3
4
5
 
 
6
 
 
7
8
9
10
 
 
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
0
@@ -3,12 +3,70 @@
0
 # Warning: This file is clobbered when you update your
0
 # application with the waves script. Accordingly, you may
0
 # wish to keep your tasks in .rb or .rake files in lib/tasks
0
-require 'startup'
0
-Waves::Console.load(:mode => ENV['mode'])
0
 
0
-# load tasks from waves framework
0
-%w( cluster generate gem ).each { |task| require "tasks/#{task}.rb" }
0
+begin
0
+ require 'startup'
0
+ Waves::Console.load(:mode => ENV['mode'])
0
 
0
-# load tasks from this app's lib/tasks
0
-Dir["lib/tasks/*.{rb,rake}"].each { |task| require task }
0
+ # load tasks from waves framework
0
+ %w( cluster generate gem ).each { |task| require "tasks/#{task}.rb" }
0
 
0
+ # load tasks from this app's lib/tasks
0
+ Dir["lib/tasks/*.{rb,rake}"].each { |task| require task }
0
+
0
+rescue LoadError => e
0
+ if e.message == 'no such file to load -- waves'
0
+ puts "Can't find Waves source. Install gem, freeze Waves, or define WAVES in startup.rb"
0
+ puts
0
+ else
0
+ raise e
0
+ end
0
+end
0
+
0
+namespace :waves do
0
+
0
+ desc "freeze src=<wherever> to ./waves"
0
+ task :freeze do
0
+
0
+ target = "#{Dir.pwd}/waves"
0
+ src = ENV['src']
0
+ raise "Please specify the location of waves using src=wherever" unless src
0
+ raise "No directory found at '#{src}'" unless File.directory?(src)
0
+
0
+ items = FileList["#{src}/*"]
0
+ puts "Freezing from: #{src}"
0
+ items.each do |item|
0
+ puts "copying #{item}"
0
+ cp_r item, target
0
+ end
0
+
0
+ end
0
+
0
+ desc "unfreeze (i.e. delete) the waves source at ./waves"
0
+ task :unfreeze do
0
+ frozen = "#{Dir.pwd}/waves"
0
+ rm_r frozen if File.exist?(frozen)
0
+ end
0
+
0
+ # Convenience task to allow you to freeze the current Waves
0
+ # source without knowing where it is. This task only gets
0
+ # defined when the Rakefile successfully loaded Waves and if
0
+ # there's nothing in the way at ./waves
0
+ if defined?(WAVES) && !File.exist?("#{Dir.pwd}/waves")
0
+ namespace :freeze do
0
+ desc "freeze current Waves source to ./waves"
0
+ task :current do
0
+ target = "#{Dir.pwd}/waves"
0
+ current = File.expand_path( WAVES )
0
+ items = FileList["#{current}/*"]
0
+ puts "Freezing from: #{current}"
0
+ items.each do |item|
0
+ puts "copying #{item}"
0
+ cp_r item, target
0
+ end
0
+
0
+ end
0
+ end
0
+ end
0
+
0
+end
0
\ No newline at end of file

Comments

    No one has commented yet.