From 4e8649114b5d13c5621e793b63abc7a03751ae36 Mon Sep 17 00:00:00 2001 From: winton Date: Tue, 26 Jan 2010 14:00:59 -0800 Subject: [PATCH] Updating gem_template to use Dep --- README.markdown | 2 +- Rakefile | 34 +++------------------------------- bin/gem_template | 4 ++-- config/dep.rb | 38 ++++++++++++++++++++++++++++++++++++++ gemspec.rb | 18 ------------------ lib/gem_template.rb | 3 ++- spec/spec.opts | 1 - spec/spec_helper.rb | 17 +++-------------- 8 files changed, 49 insertions(+), 68 deletions(-) create mode 100644 config/dep.rb delete mode 100644 gemspec.rb delete mode 100644 spec/spec.opts diff --git a/README.markdown b/README.markdown index 264a180..1f3db33 100644 --- a/README.markdown +++ b/README.markdown @@ -7,7 +7,7 @@ Requirements ------------
-sudo gem install stencil --source http://gemcutter.org
+sudo gem install stencil
 
Setup the template diff --git a/Rakefile b/Rakefile index 23d7a33..5a4e6f6 100644 --- a/Rakefile +++ b/Rakefile @@ -1,29 +1,7 @@ -require 'rubygems' -require 'rake' -require 'rake/gempackagetask' -require 'spec/rake/spectask' -require 'gemspec' - -desc "Generate gemspec" -task :gemspec do - File.open("#{Dir.pwd}/#{GEM_NAME}.gemspec", 'w') do |f| - f.write(GEM_SPEC.to_ruby) - end -end - -desc "Install gem" -task :install do - Rake::Task['gem'].invoke - `sudo gem uninstall #{GEM_NAME} -x` - `sudo gem install pkg/#{GEM_NAME}*.gem` - `rm -Rf pkg` -end - -desc "Package gem" -Rake::GemPackageTask.new(GEM_SPEC) do |pkg| - pkg.gem_spec = GEM_SPEC -end +require "#{File.dirname(__FILE__)}/config/dep" +Dep.rakefile! +# You can delete this after you use it desc "Rename project" task :rename do name = ENV['NAME'] || File.basename(Dir.pwd) @@ -42,10 +20,4 @@ task :rename do `sed -i "" 's/gem_template/#{name}/g' #{path}` end end -end - -desc "Run specs" -Spec::Rake::SpecTask.new do |t| - t.spec_opts = ["--format", "specdoc", "--colour"] - t.spec_files = FileList["spec/**/*_spec.rb"] end \ No newline at end of file diff --git a/bin/gem_template b/bin/gem_template index 2ab65da..888d14d 100644 --- a/bin/gem_template +++ b/bin/gem_template @@ -1,4 +1,4 @@ #!/usr/bin/env ruby -$:.push File.expand_path("#{File.dirname(__FILE__)}/../lib") -require 'gem_template' +$:.push File.expand_path("#{File.dirname(__FILE__)}/../config/dep") +Dep.bin! \ No newline at end of file diff --git a/config/dep.rb b/config/dep.rb new file mode 100644 index 0000000..b10b394 --- /dev/null +++ b/config/dep.rb @@ -0,0 +1,38 @@ +require 'rubygems' +require 'dep' + +Dep.gem do + + dep '=0.1.1' + rake '=0.8.7', :require => %w(rake) + rspec '=1.3.0' +end + +Dep.gemspec do + + author 'Winton Welsh' + email 'mail@wintoni.us' + name 'gem_template' + homepage "http://github.com/winton/#{name}" + root File.expand_path("#{File.dirname(__FILE__)}/../") + summary "" + version '0.1.0' +end + +Dep.profile do + + bin :require => %w(lib/gem_template) + + gemspec do + dep + end + + lib :require => %w(lib/gem_template/gem_template) + + rakefile :require => %w(dep/tasks) do + rake :require => %w(rake/gempackagetask) + rspec :require => %w(spec/rake/spectask) + end + + spec_helper :require => %w(dep/spec_helper lib/gem_template pp) +end \ No newline at end of file diff --git a/gemspec.rb b/gemspec.rb deleted file mode 100644 index 81dcfe2..0000000 --- a/gemspec.rb +++ /dev/null @@ -1,18 +0,0 @@ -GEM_NAME = 'gem_template' -GEM_FILES = FileList['**/*'] - FileList['coverage', 'coverage/**/*', 'pkg', 'pkg/**/*'] -GEM_SPEC = Gem::Specification.new do |s| - # == CONFIGURE == - s.author = "Winton Welsh" - s.email = "mail@wintoni.us" - s.homepage = "http://github.com/winton/#{GEM_NAME}" - s.summary = "" - # == CONFIGURE == - s.executables << GEM_NAME - s.extra_rdoc_files = [ "README.markdown" ] - s.files = GEM_FILES.to_a - s.has_rdoc = false - s.name = GEM_NAME - s.platform = Gem::Platform::RUBY - s.require_path = "lib" - s.version = "0.1.0" -end \ No newline at end of file diff --git a/lib/gem_template.rb b/lib/gem_template.rb index 159ba63..4e2dc6a 100644 --- a/lib/gem_template.rb +++ b/lib/gem_template.rb @@ -1 +1,2 @@ -require File.dirname(__FILE__) + "/gem_template/gem_template" +require File.expand_path("#{File.dirname(__FILE__)}/../config/dep") +Dep.lib! \ No newline at end of file diff --git a/spec/spec.opts b/spec/spec.opts deleted file mode 100644 index 4e1e0d2..0000000 --- a/spec/spec.opts +++ /dev/null @@ -1 +0,0 @@ ---color diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 88df6fd..809af03 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,16 +1,5 @@ -$testing = true -SPEC = File.dirname(__FILE__) -$:.unshift File.expand_path("#{SPEC}/../lib") - -require 'gem_template' -require 'pp' +require File.expand_path("#{File.dirname(__FILE__)}/../config/dep") +Dep.spec_helper! Spec::Runner.configure do |config| -end - -# For use with rspec textmate bundle -def debug(object) - puts "
"
-  puts object.pretty_inspect.gsub('<', '<').gsub('>', '>')
-  puts "
" -end +end \ No newline at end of file