Permalink
Browse files

extract subproject logic from Rakefile

  • Loading branch information...
1 parent d965690 commit 71dec45b8ec9bab6e4e7556b375d69978fdb2da9 @rkh committed May 2, 2010
Showing with 45 additions and 43 deletions.
  1. +3 −43 Rakefile
  2. +42 −0 subproject.rb
View
@@ -1,7 +1,9 @@
# see tasks/*.task for rake tasks
$RELATIVE_LOAD_PATH = Dir.glob '{*,.}/lib'
-$LOAD_PATH.unshift(*$RELATIVE_LOAD_PATH)
+$LOAD_PATH.unshift('.', *$RELATIVE_LOAD_PATH)
+
+require 'subproject'
task :default => "setup:read_only" if ENV['RUN_CODE_RUN']
task :default => ["setup:check", :spec]
@@ -10,48 +12,6 @@ require "rake/clean"
CLEAN.include "**/*.rbc"
CLOBBER.include "*.gem", "doc"
-require 'ostruct'
-class Subproject < OpenStruct
- extend Enumerable
- @list ||= []
-
- def self.each(&block)
- @list.each(&block)
- end
-
- def self.new(name, options = {})
- options[:public_remote] ||= "git://github.com/rkh/#{name}.git"
- options[:private_remote] ||= "git@github.com:rkh/#{name}.git"
- options.merge! :name => name
- result = super options
- yield result if block_given?
- @list << result
- result
- end
-
- def self.names
- map { |p| p.name }
- end
-
- def self.[](name)
- detect { |p| p.name == name }
- end
-
- new "async-rack"
- new "haml-more"
- new "monkey-lib"
- new "sinatra-advanced-routes"
- new "sinatra-compass"
- new "sinatra-config-file"
- new "sinatra-more-server"
- new "sinatra-namespace"
- new "sinatra-reloader"
- new "sinatra-sugar"
- new "sinatra-test-helper"
- new "yard-sinatra"
-
-end
-
def insert_desc(*values)
return unless Rake.application.last_comment
Rake.application.last_comment.replace(Rake.application.last_comment % values)
View
@@ -0,0 +1,42 @@
+require 'ostruct'
+
+class Subproject < OpenStruct
+ extend Enumerable
+ @list ||= []
+
+ def self.each(&block)
+ @list.each(&block)
+ end
+
+ def self.new(name, options = {})
+ options[:public_remote] ||= "git://github.com/rkh/#{name}.git"
+ options[:private_remote] ||= "git@github.com:rkh/#{name}.git"
+ options.merge! :name => name
+ result = super options
+ yield result if block_given?
+ @list << result
+ result
+ end
+
+ def self.names
+ map { |p| p.name }
+ end
+
+ def self.[](name)
+ detect { |p| p.name == name }
+ end
+
+ new "async-rack"
+ new "haml-more"
+ new "monkey-lib"
+ new "sinatra-advanced-routes"
+ new "sinatra-compass"
+ new "sinatra-config-file"
+ new "sinatra-more-server"
+ new "sinatra-namespace"
+ new "sinatra-reloader"
+ new "sinatra-sugar"
+ new "sinatra-test-helper"
+ new "yard-sinatra"
+
+end

0 comments on commit 71dec45

Please sign in to comment.