Browse files

first post

  • Loading branch information...
0 parents commit 221b67c393d131fa81d4799c5ed961c83bbee5f2 @flavorjones committed Jul 21, 2010
23 .autotest
@@ -0,0 +1,23 @@
+# -*- ruby -*-
+
+require 'autotest/restart'
+
+# Autotest.add_hook :initialize do |at|
+# at.extra_files << "../some/external/dependency.rb"
+#
+# at.libs << ":../some/external"
+#
+# at.add_exception 'vendor'
+#
+# at.add_mapping(/dependency.rb/) do |f, _|
+# at.files_matching(/test_.*rb$/)
+# end
+#
+# %w(TestA TestB).each do |klass|
+# at.extra_class_map[klass] = "test/test_misc.rb"
+# end
+# end
+
+# Autotest.add_hook :run_command do |at|
+# system "rake build"
+# end
6 CHANGELOG.rdoc
@@ -0,0 +1,6 @@
+=== 1.0.0 / 2010-07-21
+
+* 1 major enhancement
+
+ * Birthday!
+
8 Manifest.txt
@@ -0,0 +1,8 @@
+.autotest
+History.txt
+Manifest.txt
+README.txt
+Rakefile
+bin/hoe_bundler
+lib/hoe_bundler.rb
+test/test_hoe_bundler.rb
57 README.md
@@ -0,0 +1,57 @@
+= hoe_bundler
+
+* FIX (url)
+
+== DESCRIPTION:
+
+FIX (describe your package)
+
+== FEATURES/PROBLEMS:
+
+* FIX (list of features or problems)
+
+== SYNOPSIS:
+
+ FIX (code sample of usage)
+
+== REQUIREMENTS:
+
+* FIX (list of requirements)
+
+== INSTALL:
+
+* FIX (sudo gem install, anything else)
+
+== DEVELOPERS:
+
+After checking out the source, run:
+
+ $ rake newb
+
+This task will install any missing dependencies, run the tests/specs,
+and generate the RDoc.
+
+== LICENSE:
+
+(The MIT License)
+
+Copyright (c) 2010 FIX
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 Rakefile
@@ -0,0 +1,20 @@
+# -*- ruby -*-
+
+require 'rubygems'
+require 'hoe'
+
+Hoe.plugin :git
+
+Hoe.spec 'hoe-bundler' do
+ developer('Mike Dalessio', 'mike.dalessio@gmail.com')
+
+ self.extra_rdoc_files = FileList["*.rdoc"]
+ self.history_file = "CHANGELOG.rdoc"
+ self.readme_file = "README.md"
+ self.test_globs = ["test/test_*.rb"]
+
+ extra_deps << ["hoe", ">=2.2.0"]
+ extra_dev_deps << ["rake", ">=0"]
+end
+
+# vim: syntax=ruby
36 lib/hoe/bundler.rb
@@ -0,0 +1,36 @@
+class Hoe #:nodoc:
+ #
+ # Rake task to generate a bundler Gemfile based on your declared hoe dependencies.
+ #
+ # * <tt>bundler:gemfile</tt>
+ #
+ # Why would you want to do this? I mean, why would anyone want to use bundler to test their gem?
+ #
+ # 1. to make sure you've declared all your dependencies in your Hoe.spec.
+ # 2. to make sure you're testing against the exact versions of dependencies that you're claiming in your Hoe.spec.
+ #
+ module Bundler
+ VERSION = "1.0.0" #:nodoc:
+
+ def define_bundler_tasks
+ desc "generate a bundler Gemfile from your Hoe.spec dependencies"
+ task "bundler:gemfile" do
+ File.open("Gemfile","w") do |gemfile|
+ gemfile.puts "# -*- ruby -*-"
+ gemfile.puts
+ gemfile.puts "source :gemcutter"
+ gemfile.puts
+ self.extra_deps.each do |name, version|
+ gemfile.puts %Q{gem "#{name}", "#{version.gsub(/ /,'')}"}
+ end
+ gemfile.puts
+ self.extra_dev_deps.each do |name, version|
+ gemfile.puts %Q{gem "#{name}", "#{version.gsub(/ /,'')}", :group => [:development, :test]}
+ end
+ gemfile.puts
+ gemfile.puts "# vim: syntax=ruby"
+ end
+ end
+ end
+ end
+end
23 test/fixture_project/.autotest
@@ -0,0 +1,23 @@
+# -*- ruby -*-
+
+require 'autotest/restart'
+
+# Autotest.add_hook :initialize do |at|
+# at.extra_files << "../some/external/dependency.rb"
+#
+# at.libs << ":../some/external"
+#
+# at.add_exception 'vendor'
+#
+# at.add_mapping(/dependency.rb/) do |f, _|
+# at.files_matching(/test_.*rb$/)
+# end
+#
+# %w(TestA TestB).each do |klass|
+# at.extra_class_map[klass] = "test/test_misc.rb"
+# end
+# end
+
+# Autotest.add_hook :run_command do |at|
+# system "rake build"
+# end
13 test/fixture_project/Gemfile
@@ -0,0 +1,13 @@
+# -*- ruby -*-
+
+source :gemcutter
+
+gem "yyy", ">=0"
+gem "zzz", "<1.5.0"
+
+gem "rubyforge", ">=2.0.4", :group => [:development, :test]
+gem "aaa", ">=0", :group => [:development, :test]
+gem "bbb", ">=2.2.0", :group => [:development, :test]
+gem "hoe", ">=2.6.1", :group => [:development, :test]
+
+# vim: syntax=ruby
6 test/fixture_project/History.txt
@@ -0,0 +1,6 @@
+=== 1.0.0 / 2010-07-21
+
+* 1 major enhancement
+
+ * Birthday!
+
8 test/fixture_project/Manifest.txt
@@ -0,0 +1,8 @@
+.autotest
+History.txt
+Manifest.txt
+README.txt
+Rakefile
+bin/fixture_project
+lib/fixture_project.rb
+test/test_fixture_project.rb
57 test/fixture_project/README.txt
@@ -0,0 +1,57 @@
+= fixture_project
+
+* FIX (url)
+
+== DESCRIPTION:
+
+FIX (describe your package)
+
+== FEATURES/PROBLEMS:
+
+* FIX (list of features or problems)
+
+== SYNOPSIS:
+
+ FIX (code sample of usage)
+
+== REQUIREMENTS:
+
+* FIX (list of requirements)
+
+== INSTALL:
+
+* FIX (sudo gem install, anything else)
+
+== DEVELOPERS:
+
+After checking out the source, run:
+
+ $ rake newb
+
+This task will install any missing dependencies, run the tests/specs,
+and generate the RDoc.
+
+== LICENSE:
+
+(The MIT License)
+
+Copyright (c) 2010 FIX
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11 test/fixture_project/Rakefile
@@ -0,0 +1,11 @@
+require 'rubygems'
+require 'hoe'
+$: << File.expand_path(File.join(File.dirname(__FILE__),"../../lib"))
+Hoe.plugin :bundler
+Hoe.spec "fixture_project" do
+ developer("MCA","mca@example.com")
+ extra_deps << ["yyy", ">=0"]
+ extra_deps << ["zzz", "< 1.5.0"]
+ extra_dev_deps << ["aaa", ">=0"]
+ extra_dev_deps << ["bbb", ">= 2.2.0"]
+end
3 test/fixture_project/bin/fixture_project
@@ -0,0 +1,3 @@
+#!/usr/bin/env ruby
+
+abort "you need to write me"
3 test/fixture_project/lib/fixture_project.rb
@@ -0,0 +1,3 @@
+class FixtureProject
+ VERSION = '1.0.0'
+end
8 test/fixture_project/test/test_fixture_project.rb
@@ -0,0 +1,8 @@
+require "test/unit"
+require "fixture_project"
+
+class TestFixtureProject < Test::Unit::TestCase
+ def test_sanity
+ flunk "write tests or I will kneecap you"
+ end
+end
24 test/test_hoe_bundler.rb
@@ -0,0 +1,24 @@
+require "test/unit"
+require "fileutils"
+
+class TestHoeBundler < Test::Unit::TestCase
+ def test_output
+ gemfile = nil
+ Dir.chdir(File.join(File.dirname(__FILE__), "fixture_project")) do
+ FileUtils.rm_f "Gemfile"
+ begin
+ system "rake bundler:gemfile"
+ gemfile = File.read "Gemfile"
+ end
+ end
+
+ assert_match %r{^# -\*- ruby -\*-$}, gemfile
+ assert_match %r{^source :gemcutter$}, gemfile
+ assert_match %r{^gem "yyy", ">=0"$}, gemfile
+ assert_match %r{^gem "zzz", "<1.5.0"$}, gemfile
+ assert_match %r{^gem "aaa", ">=0", :group => \[:development, :test\]$}, gemfile
+ assert_match %r{^gem "bbb", ">=2.2.0", :group => \[:development, :test\]$}, gemfile
+ assert_match %r{^gem "hoe", ">=\d\.\d\.\d", :group => \[:development, :test\]$}, gemfile
+ assert_match %r{^# vim: syntax=ruby$}, gemfile
+ end
+end

0 comments on commit 221b67c

Please sign in to comment.