Permalink
Browse files

gemify

  • Loading branch information...
1 parent f6b2ed3 commit 9c7129baa047f337e90ffdc68d18ef441d6748cf @ddollar committed May 19, 2009
Showing with 161 additions and 2 deletions.
  1. +2 −0 .gitignore
  2. +12 −2 README.rdoc
  3. +82 −0 Rakefile
  4. +14 −0 config/gem.rb
  5. +23 −0 config/gemspec.rb.erb
  6. +28 −0 rack-debug.gemspec
View
@@ -0,0 +1,2 @@
+doc/*
+pkg
View
@@ -2,12 +2,22 @@ Installation:
script/plugin install git://github.com/ddollar/rack-debug.git
-Usage:
+Usage (Rails):
+ # Rails
# config/environments/development.rb
config.middleware.use "Rack::Debug"
- # add debugger statements to your code
+Usage (Rack::Builder):
+
+ # add a use line to your builder
+ Rack::Builder.new do
+ use Rack::Debug
+ run MyApp.new
+ end
+
+Add breakpoints to your code
+
@user = User.find(params[:id])
debugger
render :show
View
@@ -0,0 +1,82 @@
+require 'rubygems'
+require 'erb'
+require 'yaml'
+require 'rake'
+
+begin
+ require 'hanna/rdoctask'
+rescue LoadError
+ require 'rake/rdoctask'
+end
+
+namespace :gem do
+
+ task :config do
+ @config = OpenStruct.new
+
+ File.open("config/gem.rb", "r") do |gem_config|
+ eval(gem_config.read)
+ end
+
+ @config.files = FileList["{bin,doc,lib,test}/**/*"].to_a.map do |file|
+ '"' + file + '"'
+ end.join(',')
+ end
+
+ desc "Build the gem"
+ task :build => [ 'gem:config', 'gem:spec:build' ] do
+ spec = nil
+ File.open("#{@config.name}.gemspec", 'r') do |gemspec|
+ eval gemspec.read
+ end
+ gemfile = Gem::Builder.new(spec).build
+ Dir.mkdir('pkg') unless File.exists?('pkg')
+ File.rename(gemfile, "pkg/#{gemfile}")
+ end
+
+ namespace :spec do
+
+ desc "Build gemspec"
+ task :build => [ :config ] do
+ File.open("config/gemspec.rb.erb", "r") do |template|
+ File.open("#{@config.name}.gemspec", "w") do |gemspec|
+ template_data = "<% config = YAML::load(%{#{Regexp.escape(YAML::dump(@config))}}) %>\n"
+ template_data += template.read
+ original_stdout = $stdout
+ $stdout = gemspec
+ ERB.new(template_data).run
+ $stdout = original_stdout
+ end
+ end
+ end
+
+ desc "Test gemspec against Github"
+ task :test => [ 'gem:config', :build ] do
+ require 'rubygems/specification'
+ data = File.read("#{@config.name}.gemspec")
+ spec = nil
+ Thread.new { spec = eval("$SAFE = 3\n#{data}") }.join
+ puts spec
+ end
+
+ end
+end
+
+namespace :rdoc do
+
+ desc 'Generate RDoc'
+ rd = Rake::RDocTask.new(:build) do |rdoc|
+ Rake::Task['gem:config'].invoke
+ rdoc.title = @config.name
+ rdoc.main = 'README.rdoc'
+ rdoc.rdoc_dir = 'doc'
+ rdoc.options << '--line-numbers' << '--inline-source'
+ rdoc.rdoc_files.include('README.rdoc', 'lib/**/*.rb')
+ end
+
+ desc 'View RDoc'
+ task :view => [ :build ] do
+ system %{open doc/index.html}
+ end
+
+end
View
@@ -0,0 +1,14 @@
+@config.name = "rack-debug"
+@config.version = '1.0.0'
+@config.homepage = "http://github.com/ddollar/rack-debug"
+@config.summary = "Rack::Debug adds a middlerware interface to ruby-debug"
+
+@config.description = <<-DESCRIPTION
+
+Rack::Debug adds a middlerware interface to ruby-debug
+http://github.com/github/rack-debug
+
+DESCRIPTION
+
+@config.author_name = "David Dollar"
+@config.author_email = "ddollar@gmail.com"
View
@@ -0,0 +1,23 @@
+spec = Gem::Specification.new do |s|
+
+ s.name = "<%= config.name %>"
+ s.version = "<%= config.version %>"
+ s.summary = "<%= config.summary %>"
+ s.homepage = "<%= config.homepage %>"
+
+ s.description = <<-DESCRIPTION
+<%= config.description %>
+ DESCRIPTION
+
+ s.author = "<%= config.author_name %>"
+ s.email = "<%= config.author_email %>"
+
+ s.files = [<%= config.files %>]
+ s.platform = Gem::Platform::RUBY
+
+ s.rubyforge_project = "<%= config.name %>"
+ s.require_path = "lib"
+ s.has_rdoc = true
+ s.extra_rdoc_files = ["README.rdoc"]
+
+end
View
@@ -0,0 +1,28 @@
+
+spec = Gem::Specification.new do |s|
+
+ s.name = "rack-debug"
+ s.version = "1.0.0"
+ s.summary = "Rack::Debug adds a middlerware interface to ruby-debug"
+ s.homepage = "http://github.com/ddollar/rack-debug"
+
+ s.description = <<-DESCRIPTION
+
+Rack::Debug adds a middlerware interface to ruby-debug
+http://github.com/github/rack-debug
+
+
+ DESCRIPTION
+
+ s.author = "David Dollar"
+ s.email = "ddollar@gmail.com"
+
+ s.files = ["doc/classes","doc/classes/Rack","doc/classes/Rack/Debug.html","doc/classes/Rack.html","doc/created.rid","doc/files","doc/files/lib","doc/files/lib/rack","doc/files/lib/rack/debug_rb.html","doc/files/lib/rack-debug_rb.html","doc/files/README_rdoc.html","doc/fr_class_index.html","doc/fr_file_index.html","doc/fr_method_index.html","doc/index.html","doc/rdoc-style.css","lib/rack","lib/rack/debug.rb"]
+ s.platform = Gem::Platform::RUBY
+
+ s.rubyforge_project = "rack-debug"
+ s.require_path = "lib"
+ s.has_rdoc = true
+ s.extra_rdoc_files = ["README.rdoc"]
+
+end

0 comments on commit 9c7129b

Please sign in to comment.