Permalink
Browse files

Moved test_unit generator to test_unit_generators folder

Stopped supporting /generators folder look up in any RubyGem; must use a scope
Upgraded gem to put config into /config folder


git-svn-id: svn+ssh://rubyforge.org/var/svn/rubigen/trunk@22 bdf7f5a1-e071-427e-899e-064d0b0c9aa4
  • Loading branch information...
1 parent 4e4b6d2 commit d0b62470e01ebea1c0e2f995113b9dfa30e50e1a nicwilliams committed Nov 2, 2007
View
@@ -1,3 +1,7 @@
+== 1.0.7 2007-11-02
+
+* Moved test_unit generator to test_unit scope (instead of global scope)
+
== 1.0.6 2007-10-18
* Templates can end with .erb (e.g. model.rb.erb) and template_copy_each will remove the .erb extension (create model.rb)
View
@@ -13,6 +13,8 @@ app_generators/ruby_app/templates/lib/module.rb
app_generators/ruby_app/templates/test/test_helper.rb.erb
bin/install_rubigen_scripts
bin/ruby_app
+config/hoe.rb
+config/requirements.rb
examples/rails_generators/applications/app/USAGE
examples/rails_generators/applications/app/app_generator.rb
examples/rails_generators/components/controller/USAGE
@@ -88,9 +90,6 @@ generators/install_rubigen_scripts/install_rubigen_scripts_generator.rb
generators/install_rubigen_scripts/templates/script/destroy
generators/install_rubigen_scripts/templates/script/generate
generators/install_rubigen_scripts/templates/script/win_script.cmd
-generators/test_unit/USAGE
-generators/test_unit/templates/test.rb
-generators/test_unit/test_unit_generator.rb
lib/rubigen.rb
lib/rubigen/base.rb
lib/rubigen/commands.rb
@@ -106,10 +105,14 @@ lib/rubigen/scripts/update.rb
lib/rubigen/simple_logger.rb
lib/rubigen/spec.rb
lib/rubigen/version.rb
+log/debug.log
script/destroy
script/generate
script/txt2html
setup.rb
+tasks/deployment.rake
+tasks/environment.rake
+tasks/website.rake
test/examples_from_rails/generator_test_helper.rb
test/examples_from_rails/test_rails_resource_generator.rb
test/examples_from_rails/test_rails_scaffold_generator.rb
@@ -119,6 +122,10 @@ test/test_generator_helper.rb
test/test_helper.rb
test/test_install_rubigen_scripts_generator.rb
test/test_lookup.rb
+test/test_rubigen.rb
+test_unit_generators/test_unit/USAGE
+test_unit_generators/test_unit/templates/test.rb
+test_unit_generators/test_unit/test_unit_generator.rb
website/index.html
website/index.txt
website/javascripts/rounded_corners_lite.inc.js
View
146 Rakefile
@@ -1,144 +1,4 @@
-require 'rubygems'
-begin
- require 'rake'
-rescue LoadError
- puts 'This script should only be accessed via the "rake" command.'
- puts 'Installation: gem install rake -y'
- exit
-end
-require 'rake/clean'
-require 'rake/testtask'
-require 'rake/packagetask'
-require 'rake/gempackagetask'
-require 'rake/rdoctask'
-require 'rake/contrib/rubyforgepublisher'
-require 'fileutils'
-begin
- require 'hoe'
-rescue LoadError
- puts 'This Rakefile requires the "hoe" RubyGem.'
- puts 'Installation: gem install hoe -y'
- exit
-end
+require 'config/requirements'
+require 'config/hoe' # setup Hoe + all gem configuration
-
-
-include FileUtils
-require File.join(File.dirname(__FILE__), 'lib', 'rubigen', 'version')
-
-AUTHOR = ['Dr Nic Williams', 'Jeremy Kemper'] # can also be an array of Authors
-EMAIL = "drnicwilliams@gmail.com"
-DESCRIPTION = <<-EOS
-A framework to allow Ruby applications to generate file/folder stubs (like the rails command does for Ruby on Rails, and the ‘script/generate’ command within a Rails application during development).
-EOS
-GEM_NAME = 'rubigen' # what ppl will type to install your gem
-
-@config_file = "~/.rubyforge/user-config.yml"
-@config = nil
-def rubyforge_username
- unless @config
- begin
- @config = YAML.load(File.read(File.expand_path(@config_file)))
- rescue
- puts <<-EOS
-ERROR: No rubyforge config file found: #{@config_file}"
-Run 'rubyforge setup' to prepare your env for access to Rubyforge
- - See http://newgem.rubyforge.org/rubyforge.html for more details
- EOS
- exit
- end
- end
- @rubyforge_username ||= @config["username"]
-end
-
-RUBYFORGE_PROJECT = 'rubigen' # The unix name for your project
-HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
-DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
-
-NAME = "rubigen"
-REV = nil
-# UNCOMMENT IF REQUIRED:
-# REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil
-VERS = Rubigen::VERSION::STRING + (REV ? ".#{REV}" : "")
-CLEAN.include ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store']
-# RDOC_OPTS = ['--quiet', '--title', 'rubigen documentation',
-# "--opname", "index.html",
-# "--line-numbers",
-# "--main", "README",
-# "--inline-source"]
-
-class Hoe
- def extra_deps
- @extra_deps.reject! { |x| Array(x).first == 'hoe' }
- @extra_deps
- end
-end
-
-# Generate all the Rake tasks
-# Run 'rake -T' to see list of generated tasks (from gem root directory)
-hoe = Hoe.new(GEM_NAME, VERS) do |p|
- p.author = AUTHOR
- p.description = DESCRIPTION
- p.email = EMAIL
- p.summary = DESCRIPTION
- p.url = HOMEPATH
- p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
- p.test_globs = ["test/**/test_*.rb"]
- p.clean_globs |= CLEAN #An array of file patterns to delete on clean.
-
- # == Optional
- p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
- # An array of rubygem dependencies [name, version], e.g. [ ['activesupport', '>= 1.3.1'] ]
- p.extra_deps = [['activesupport', '>= 1.3.1']]
-
-end
-
-CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\n\n")
-PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
-hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
-
-desc 'Generate website files'
-task :website_generate do
- Dir['website/**/*.txt'].each do |txt|
- sh %{ ruby script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
- end
-end
-
-desc 'Upload website files to rubyforge'
-task :website_upload do
- host = "#{rubyforge_username}@rubyforge.org"
- remote_dir = "/var/www/gforge-projects/#{PATH}/"
- local_dir = 'website'
- sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
-end
-
-desc 'Generate and upload website files'
-task :website => [:website_generate, :website_upload, :publish_docs]
-
-desc 'Release the website and new gem version'
-task :deploy => [:check_version, :website, :release] do
- puts "Remember to create SVN tag:"
- puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
- "svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
- puts "Suggested comment:"
- puts "Tagging release #{CHANGES}"
-end
-
-desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
-task :local_deploy => [:website_generate, :install_gem]
-
-task :check_version do
- unless ENV['VERSION']
- puts 'Must pass a VERSION=x.y.z release version'
- exit
- end
- unless ENV['VERSION'] == VERS
- puts "Please update your version.rb to match the release version, currently #{VERS}"
- exit
- end
-end
-
-desc 'Install the package as a gem'
-task :install_gem_no_doc => [:clean, :package] do
- sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
-end
+Dir['tasks/**/*.rake'].each { |rake| load rake }
View
@@ -0,0 +1,74 @@
+require 'rubigen/version'
+
+AUTHOR = ['Dr Nic Williams', 'Jeremy Kemper'] # can also be an array of Authors
+EMAIL = "drnicwilliams@gmail.com"
+DESCRIPTION = <<-EOS
+A framework to allow Ruby applications to generate file/folder stubs (like the rails command does for Ruby on Rails, and the ‘script/generate’ command within a Rails application during development).
+EOS
+GEM_NAME = 'rubigen' # what ppl will type to install your gem
+
+RUBYFORGE_PROJECT = 'rubigen' # The unix name for your project
+HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
+DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
+
+@config_file = "~/.rubyforge/user-config.yml"
+@config = nil
+RUBYFORGE_USERNAME = "unknown"
+def rubyforge_username
+ unless @config
+ begin
+ @config = YAML.load(File.read(File.expand_path(@config_file)))
+ rescue
+ puts <<-EOS
+ERROR: No rubyforge config file found: #{@config_file}
+Run 'rubyforge setup' to prepare your env for access to Rubyforge
+ - See http://newgem.rubyforge.org/rubyforge.html for more details
+ EOS
+ exit
+ end
+ end
+ RUBYFORGE_USERNAME.replace @config["username"]
+end
+
+
+REV = nil
+# UNCOMMENT IF REQUIRED:
+# REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil
+VERS = Rubigen::VERSION::STRING + (REV ? ".#{REV}" : "")
+RDOC_OPTS = ['--quiet', '--title', 'rubigen documentation',
+ "--opname", "index.html",
+ "--line-numbers",
+ "--main", "README",
+ "--inline-source"]
+
+class Hoe
+ def extra_deps
+ @extra_deps.reject! { |x| Array(x).first == 'hoe' }
+ @extra_deps
+ end
+end
+
+# Generate all the Rake tasks
+# Run 'rake -T' to see list of generated tasks (from gem root directory)
+hoe = Hoe.new(GEM_NAME, VERS) do |p|
+ p.author = AUTHOR
+ p.description = DESCRIPTION
+ p.email = EMAIL
+ p.summary = DESCRIPTION
+ p.url = HOMEPATH
+ p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
+ p.test_globs = ["test/**/test_*.rb"]
+ p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
+
+ # == Optional
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\\n\\n")
+ #p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
+
+ #p.spec_extras = {} # A hash of extra values to set in the gemspec.
+
+end
+
+CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
+PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
+hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
+hoe.rsync_args = '-av --delete --ignore-errors'
View
@@ -0,0 +1,17 @@
+require 'fileutils'
+include FileUtils
+
+require 'rubygems'
+%w[rake hoe newgem rubigen].each do |req_gem|
+ begin
+ require req_gem
+ rescue LoadError
+ puts "This Rakefile requires the '#{req_gem}' RubyGem."
+ puts "Installation: gem install #{req_gem} -y"
+ exit
+ end
+end
+
+$:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
+
+require 'rubigen'
View
@@ -23,7 +23,7 @@
# The layout of generator files can be seen in the built-in
# +test_unit+ generator:
#
-# generators/
+# test_unit_generators/
# test_unit/
# test_unit_generator.rb
# templates/
@@ -20,9 +20,8 @@ def build_generator(name, params, sources, options)
end
else
RubiGen::Base.reset_sources
- RubiGen::Base.append_sources(*sources) unless sources.blank?
+ RubiGen::Base.prepend_sources(*sources) unless sources.blank?
end
- # generator_options = options.find { |o| o.is_a?(Hash) } || {}
RubiGen::Base.instance(name, params, options)
end
View
@@ -113,8 +113,8 @@ def application_sources(filters = [])
# generating in the context of this application, so search
# APP_ROOT/generators.
# 2. User home directory. Search ~/.rubigen/generators.
- # 3. RubyGems. Search for gems containing /generators folder.
- # 4. Builtins. test_unit.
+ # 3. RubyGems. Search for gems containing /{scope}_generators folder.
+ # 4. Builtins. None currently.
#
# Search can be filtered by passing one or more prefixes.
# e.g. use_component_sources!(:rubygems) means it will also search in the following
@@ -129,7 +129,6 @@ def use_component_sources!(*filters)
new_sources << PathSource.new(:vendor, "#{::APP_ROOT}/vendor/generators")
new_sources << PathSource.new(:plugins, "#{::APP_ROOT}/vendor/plugins/*/**/generators")
end
- new_sources << PathSource.new(:builtin, File.join(File.dirname(__FILE__), %w[.. .. generators]))
new_sources << filtered_sources(filters)
write_inheritable_attribute(:sources, new_sources.flatten)
end
View
@@ -2,7 +2,7 @@ module Rubigen #:nodoc:
module VERSION #:nodoc:
MAJOR = 1
MINOR = 0
- TINY = 6
+ TINY = 7
STRING = [MAJOR, MINOR, TINY].join('.')
end
View
@@ -1,9 +1,14 @@
#!/usr/bin/env ruby
APP_ROOT = File.join(File.dirname(__FILE__), '..')
-require File.join(File.dirname(__FILE__), %w[.. lib rubigen])
+begin
+ require 'rubigen'
+rescue LoadError
+ require 'rubygems'
+ require 'rubigen'
+end
require 'rubigen/scripts/destroy'
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
-RubiGen::Base.use_component_sources! :rubygems, :merb
+RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme]
RubiGen::Scripts::Destroy.new.run(ARGV)
View
@@ -1,9 +1,14 @@
#!/usr/bin/env ruby
APP_ROOT = File.join(File.dirname(__FILE__), '..')
-require File.join(File.dirname(__FILE__), %w[.. lib rubigen])
+begin
+ require 'rubigen'
+rescue LoadError
+ require 'rubygems'
+ require 'rubigen'
+end
require 'rubigen/scripts/generate'
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
-RubiGen::Base.use_component_sources! :rubygems, :newgem
+RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme]
RubiGen::Scripts::Generate.new.run(ARGV)
Oops, something went wrong.

0 comments on commit d0b6247

Please sign in to comment.