public
Description: Merb More: The Full Stack. Take what you need; leave what you don't.
Homepage: http://www.merbivore.com
Clone URL: git://github.com/wycats/merb-more.git
moved the freezer rake tasks to merb-freezer
mattetti (author)
Tue Apr 08 23:43:04 -0700 2008
commit  98bb0d5a33537f61adbba39d8467e0ff599f65b6
tree    5d877b05994a6706f251e6c4d1220b8bef59ae49
parent  49ae567a0af1bcc24edfe012da935567e1cd77f3
...
3
4
5
6
 
7
8
9
...
3
4
5
 
6
7
8
9
0
@@ -3,7 +3,7 @@ require 'rake/gempackagetask'
0
 
0
 PLUGIN = "merb-freezer"
0
 NAME = "merb-freezer"
0
-VERSION = "0.0.1"
0
+VERSION = "1.0.0"
0
 AUTHOR = "Matt Aimonetti"
0
 EMAIL = "mattaimonetti@gmail.com"
0
 HOMEPAGE = "http://www.merbivore.com"
...
1
2
3
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
6
7
...
 
 
 
 
1
2
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
0
@@ -1,6 +1,90 @@
0
-namespace :merb_freezer do
0
- desc "Do something for merb-freezer"
0
- task :default do
0
- puts "merb-freezer doesn't do anything"
0
+class Freezer
0
+
0
+ class << self
0
+
0
+ def components
0
+ {
0
+ "core" => "git://github.com/wycats/merb-core.git",
0
+ "more" => "git://github.com/wycats/merb-more.git",
0
+ "plugins" => "git://github.com/wycats/merb-plugins.git"
0
+ }
0
+ end
0
+
0
+ def framework_dir
0
+ # Should allow customization of this directory's location?
0
+ File.join(File.dirname(__FILE__), "framework")
0
+ end
0
+
0
+ def gitmodules
0
+ File.join(File.dirname(__FILE__), ".gitmodules")
0
+ end
0
+
0
+ def freeze(component, update = false)
0
+ new(component, update).freeze
0
+ end
0
+
0
+ end
0
+
0
+ def initialize(component, update)
0
+ @component = "merb-" + component
0
+ @update = update
0
+ end
0
+
0
+ def freeze
0
+ # Ensure that required git commands are available
0
+ %w(git-pull git-submodule).each do |bin|
0
+ next if in_path?(bin)
0
+ $stderr.puts "ERROR: #{bin} must be avaible in PATH"
0
+ exit 1
0
+ end
0
+
0
+ unless File.directory?(framework_dir)
0
+ puts "Creating framework directory ..."
0
+ FileUtils.mkdir_p(framework_dir)
0
+ end
0
+
0
+ if managed?
0
+ puts "#{@component} seems to be already managed by git-submodule."
0
+ if @update
0
+ puts "Trying to update #{@component} ..."
0
+ sh "cd #{framework_dir}/#{@component} && git-pull"
0
+ end
0
+ else
0
+ puts "Creating submodule for #{@component} ..."
0
+ sh "git-submodule --quiet add #{components[@component.gsub("merb-", '')]} #{File.basename(framework_dir)}/#{@component}"
0
+ if $?.success?
0
+ sh("git-submodule init")
0
+ else
0
+ # Should this instead be a raise?
0
+ $stderr.puts("ERROR: unable to create submodule for #{@component}")
0
+ end
0
+ end
0
+ end
0
+
0
+ protected
0
+
0
+ def in_submodule?
0
+ return false unless File.exists?(gitmodules)
0
+ File.read(gitmodules) =~ %r![submodule "#{framework_dir}/#{@component}"]!
0
+ end
0
+
0
+ def managed?
0
+ File.directory?(File.join(framework_dir, @component)) || in_submodule?
0
+ end
0
+
0
+ def in_path?(bin)
0
+ `which #{bin}`
0
+ !$?.nil? && $?.success?
0
+ end
0
+
0
+end
0
+
0
+task :freeze => Freezer.components.keys.map { |component| "freeze:#{component}" }
0
+namespace :freeze do
0
+ Freezer.components.each do |component, git_repository|
0
+ desc "Freeze #{component} from #{git_repository}"
0
+ task component do
0
+ Freezer.freeze(component, ENV["UPDATE"])
0
+ end
0
   end
0
 end
0
\ No newline at end of file
...
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
...
32
33
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -32,95 +32,3 @@ desc "Add new files to subversion"
0
 task :svn_add do
0
    system "svn status | grep '^\?' | sed -e 's/? *//' | sed -e 's/ /\ /g' | xargs svn add"
0
 end
0
-
0
-
0
-class Freezer
0
-
0
- class << self
0
-
0
- def components
0
- {
0
- "core" => "git://github.com/wycats/merb-core.git",
0
- "more" => "git://github.com/wycats/merb-more.git",
0
- "plugins" => "git://github.com/wycats/merb-plugins.git"
0
- }
0
- end
0
-
0
- def framework_dir
0
- # Should allow customization of this directory's location?
0
- File.join(File.dirname(__FILE__), "framework")
0
- end
0
-
0
- def gitmodules
0
- File.join(File.dirname(__FILE__), ".gitmodules")
0
- end
0
-
0
- def freeze(component, update = false)
0
- new(component, update).freeze
0
- end
0
-
0
- end
0
-
0
- def initialize(component, update)
0
- @component = "merb-" + component
0
- @update = update
0
- end
0
-
0
- def freeze
0
- # Ensure that required git commands are available
0
- %w(git-pull git-submodule).each do |bin|
0
- next if in_path?(bin)
0
- $stderr.puts "ERROR: #{bin} must be avaible in PATH"
0
- exit 1
0
- end
0
-
0
- unless File.directory?(framework_dir)
0
- puts "Creating framework directory ..."
0
- FileUtils.mkdir_p(framework_dir)
0
- end
0
-
0
- if managed?
0
- puts "#{@component} seems to be already managed by git-submodule."
0
- if @update
0
- puts "Trying to update #{@component} ..."
0
- sh "cd #{framework_dir}/#{@component} && git-pull"
0
- end
0
- else
0
- puts "Creating submodule for #{@component} ..."
0
- sh "git-submodule --quiet add #{components[@component.gsub("merb-", '')]} #{File.basename(framework_dir)}/#{@component}"
0
- if $?.success?
0
- sh("git-submodule init")
0
- else
0
- # Should this instead be a raise?
0
- $stderr.puts("ERROR: unable to create submodule for #{@component}")
0
- end
0
- end
0
- end
0
-
0
- protected
0
-
0
- def in_submodule?
0
- return false unless File.exists?(gitmodules)
0
- File.read(gitmodules) =~ %r![submodule "#{framework_dir}/#{@component}"]!
0
- end
0
-
0
- def managed?
0
- File.directory?(File.join(framework_dir, @component)) || in_submodule?
0
- end
0
-
0
- def in_path?(bin)
0
- `which #{bin}`
0
- !$?.nil? && $?.success?
0
- end
0
-
0
-end
0
-
0
-task :freeze => Freezer.components.keys.map { |component| "freeze:#{component}" }
0
-namespace :freeze do
0
- Freezer.components.each do |component, git_repository|
0
- desc "Freeze #{component} from #{git_repository}"
0
- task component do
0
- Freezer.freeze(component, ENV["UPDATE"])
0
- end
0
- end
0
-end

Comments

    No one has commented yet.