Permalink
Browse files

Simplify gem handling

  • Loading branch information...
mynyml committed Jan 6, 2010
1 parent bc4758a commit fc736eebad9743d7479742b1908eba60c4a6332b
Showing with 37 additions and 132 deletions.
  1. +21 −57 Rakefile
  2. +16 −75 simple_router.gemspec
View
@@ -1,66 +1,30 @@
-# --------------------------------------------------
-# based on thin's Rakefile (http://github.com/macournoyer/thin)
-# --------------------------------------------------
-require 'rake/gempackagetask'
-require 'rake/rdoctask'
-require 'pathname'
-require 'yaml'
-
-RUBY_1_9 = RUBY_VERSION =~ /^1\.9/
-WIN = (RUBY_PLATFORM =~ /mswin|cygwin/)
-SUDO = (WIN ? "" : "sudo")
-
-def gem
- RUBY_1_9 ? 'gem19' : 'gem'
-end
-
-def all_except(res)
- Dir['**/*'].reject do |path|
- Array(res).any? {|re| path.match(re) }
- end
-end
-
-spec = Gem::Specification.new do |s|
- s.name = 'simple_router'
- s.version = '0.9'
- s.summary = "Simple, minimalistic, standalone router meant to be used with pure rack applications."
- s.description = "Simple, minimalistic, standalone router meant to be used with pure rack applications."
- s.author = "Martin Aumont"
- s.email = 'mynyml@gmail.com'
- s.homepage = ''
- s.has_rdoc = true
- s.require_path = "lib"
- s.files = all_except([/doc\/.*/, /pkg\/*/])
+def gem_opt
+ defined?(Gem) ? "-rubygems" : ""
end
-Rake::GemPackageTask.new(spec) do |p|
- p.gem_spec = spec
+def ruby(path)
+ path = "-e'%w( #{path.join(' ')} ).each {|p| require p }'" if path.is_a?(Array)
+ system "ruby #{gem_opt} -I.:lib:test #{path}"
end
-desc "Remove package products"
-task :clean => :clobber_package
-
-desc "Update the gemspec for GitHub's gem server"
-task :gemspec do
- Pathname("#{spec.name}.gemspec").open('w') {|f| f << YAML.dump(spec) }
-end
+# --------------------------------------------------
+# Tests
+# --------------------------------------------------
+task(:default => :test)
-desc "Install gem"
-task :install => [:clobber, :package] do
- sh "#{SUDO} #{gem} install pkg/#{spec.full_name}.gem"
+desc "Run tests"
+task(:test) do
+ exit ruby( Dir['test/**/test_*.rb'] - ['test/test_helper.rb'] )
end
-desc "Uninstall gem"
-task :uninstall => :clean do
- sh "#{SUDO} #{gem} uninstall -v #{spec.version} -x #{spec.name}"
+# --------------------------------------------------
+# Docs
+# --------------------------------------------------
+desc "Generate YARD Documentation"
+task(:yardoc) do
+ require 'yard'
+ files = %w( lib/**/*.rb )
+ options = %w( -o doc/yard --readme README --files LICENSE )
+ YARD::CLI::Yardoc.run *(options + files)
end
-desc "Generate rdoc documentation."
-Rake::RDocTask.new("rdoc") { |rdoc|
- rdoc.rdoc_dir = 'doc/rdoc'
- rdoc.title = "Simple Router - Document"
- rdoc.options << '--line-numbers' << '--inline-source'
- rdoc.options << '--charset' << 'utf-8'
- rdoc.rdoc_files.include('README')
- rdoc.rdoc_files.include('lib/**/*.rb')
-}
View
@@ -1,76 +1,17 @@
---- !ruby/object:Gem::Specification
-name: simple_router
-version: !ruby/object:Gem::Version
- version: "0.9"
-platform: ruby
-authors:
-- Martin Aumont
-autorequire:
-bindir: bin
-cert_chain: []
-
-date: 2009-05-23 00:00:00 -04:00
-default_executable:
-dependencies: []
-
-description: Simple, minimalistic, standalone router meant to be used with pure rack applications.
-email: mynyml@gmail.com
-executables: []
-
-extensions: []
-
-extra_rdoc_files: []
-
-files:
-- Rakefile
-- test
-- test/engines
-- test/engines/test_simple_engine.rb
-- test/test_simple_router.rb
-- test/test_dsl.rb
-- test/test_routes.rb
-- test/test_helper.rb
-- examples
-- examples/rack_app.ru
-- simple_router.gemspec
-- TODO
-- lib
-- lib/simple_router
-- lib/simple_router/routes.rb
-- lib/simple_router/engines
-- lib/simple_router/engines/simple_engine.rb
-- lib/simple_router/dsl.rb
-- lib/simple_router.rb
-- doc
-- LICENSE
-- README
-has_rdoc: true
-homepage: ""
-licenses: []
-
-post_install_message:
-rdoc_options: []
-
-require_paths:
-- lib
-required_ruby_version: !ruby/object:Gem::Requirement
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- version: "0"
- version:
-required_rubygems_version: !ruby/object:Gem::Requirement
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- version: "0"
- version:
-requirements: []
-
-rubyforge_project:
-rubygems_version: 1.3.3
-signing_key:
-specification_version: 3
-summary: Simple, minimalistic, standalone router meant to be used with pure rack applications.
-test_files: []
+Gem::Specification.new do |s|
+ s.name = 'rack-abstract-format'
+ s.version = "0.9.8"
+ s.summary = "Rack middleware that abstracts format (extension) away from the path (into env)"
+ s.description = "Rack middleware that abstracts format (extension) away from the path (into env)."
+ s.author = "mynyml"
+ s.email = "mynyml@gmail.com"
+ s.homepage = "http://github.com/mynyml/rack-abstract-format"
+ s.rubyforge_project = "rack-abstract-format"
+ s.has_rdoc = false
+ s.require_path = "lib"
+ s.files = File.read("Manifest").strip.split("\n")
+
+ s.add_development_dependency 'rack'
+ s.add_development_dependency 'nanotest'
+end

0 comments on commit fc736ee

Please sign in to comment.