Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Preparing for v1.0.0

  • Loading branch information...
commit 1e73a48d70af37bdaf111caa621ef1a2521f123e 1 parent 69a44bf
@leemhenson leemhenson authored
View
18 .bnsignore
@@ -1,18 +0,0 @@
-# The list of files that should be ignored by Mr Bones.
-# Lines that start with '#' are comments.
-#
-# A .gitignore file can be used instead by setting it as the ignore
-# file in your Rakefile:
-#
-# Bones {
-# ignore_file '.gitignore'
-# }
-#
-# For a project with a C extension, the following would be a good set of
-# exclude patterns (uncomment them if you want to use them):
-# *.[oa]
-# *~
-announcement.txt
-coverage
-doc
-pkg
View
2  .rvmrc
@@ -1,3 +1,3 @@
-rvm jruby-1.6.3@jmongo --create
+rvm jruby-head@jmongo --create
export JRUBY_OPTS="--1.9"
View
21 Gemfile.lock
@@ -1,20 +1,17 @@
PATH
remote: .
specs:
- jmongo (0.1.6)
+ jmongo (1.0.0-java)
GEM
remote: http://rubygems.org/
specs:
awesome_print (0.4.0)
- bones (3.7.0)
- little-plugger (>= 1.1.2)
- loquacious (>= 1.7.0)
- rake (>= 0.8.7)
diff-lcs (1.1.2)
- little-plugger (1.1.2)
- loquacious (1.8.1)
- rake (0.9.2)
+ fuubar (0.0.6)
+ rspec (~> 2.0)
+ rspec-instafail (~> 0.1.8)
+ ruby-progressbar (~> 0.0.10)
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
@@ -22,13 +19,15 @@ GEM
rspec-core (2.6.4)
rspec-expectations (2.6.0)
diff-lcs (~> 1.1.2)
+ rspec-instafail (0.1.8)
rspec-mocks (2.6.0)
+ ruby-progressbar (0.0.10)
PLATFORMS
java
DEPENDENCIES
- awesome_print
- bones (>= 3.4.1)
+ awesome_print (~> 0.4)
+ fuubar (~> 0.0)
jmongo!
- rspec
+ rspec (~> 2.6)
View
125 Rakefile
@@ -1,17 +1,118 @@
+require 'date'
+require 'rspec/core/rake_task'
-begin
- require 'bones'
-rescue LoadError
- abort '### Please install the "bones" gem ###'
+#############################################################################
+#
+# Helper functions
+#
+#############################################################################
+
+def name
+ @name ||= Dir['*.gemspec'].first.split('.').first
+end
+
+def version
+ line = File.read("lib/#{name}/version.rb")[/^\s*VERSION\s*=\s*.*/]
+ line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
+end
+
+def date
+ Date.today.to_s
+end
+
+def rubyforge_project
+ name
+end
+
+def gemspec_file
+ "#{name}.gemspec"
+end
+
+def gem_file
+ "#{name}-#{version}.gem"
+end
+
+def replace_header(head, header_name)
+ head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
end
-task :default => 'test:run'
-task 'gem:release' => 'test:run'
+#############################################################################
+#
+# Custom tasks
+#
+#############################################################################
-Bones {
- name 'jmongo'
- authors 'Chuck Remes'
- email 'cremes@mac.com'
- url 'http://github.com/chuckremes/jmongo'
-}
+default_rspec_opts = %w[--colour --format Fuubar]
+desc "Run all examples"
+RSpec::Core::RakeTask.new(:spec) do |t|
+ t.rspec_opts = default_rspec_opts
+end
+
+#############################################################################
+#
+# Packaging tasks
+#
+#############################################################################
+
+desc "Create tag v#{version} and build and push #{gem_file} to Rubygems"
+task :release => :build do
+ unless `git branch` =~ /^\* master$/
+ puts "You must be on the master branch to release!"
+ exit!
+ end
+ sh "git commit --allow-empty -a -m 'Release #{version}'"
+ sh "git tag v#{version}"
+ sh "git push origin master"
+ sh "git push origin v#{version}"
+ sh "gem push pkg/#{name}-#{version}.gem"
+end
+
+desc "Build #{gem_file} into the pkg directory"
+task :build => :gemspec do
+ sh "mkdir -p pkg"
+ sh "gem build #{gemspec_file}"
+ sh "mv #{gem_file} pkg"
+end
+
+desc "Generate #{gemspec_file}"
+task :gemspec => :validate do
+ # read spec file and split out manifest section
+ spec = File.read(gemspec_file)
+ head, manifest, tail = spec.split(" # = MANIFEST =\n")
+
+ # replace name version and date
+ replace_header(head, :name)
+ replace_header(head, :version)
+ replace_header(head, :date)
+ #comment this out if your rubyforge_project has a different name
+ #replace_header(head, :rubyforge_project)
+
+ # determine file list from git ls-files
+ files = `git ls-files`.
+ split("\n").
+ sort.
+ reject { |file| file =~ /^\./ }.
+ reject { |file| file =~ /^(rdoc|pkg)/ }.
+ map { |file| " #{file}" }.
+ join("\n")
+
+ # piece file back together and write
+ manifest = " s.files = %w[\n#{files}\n ]\n"
+ spec = [head, manifest, tail].join(" # = MANIFEST =\n")
+ File.open(gemspec_file, 'w') { |io| io.write(spec) }
+ puts "Updated #{gemspec_file}"
+end
+
+desc "Validate #{gemspec_file}"
+task :validate do
+ libfiles = Dir['lib/*'] - ["lib/#{name}.rb", "lib/#{name}"]
+ unless libfiles.empty?
+ puts "Directory `lib` should only contain a `#{name}.rb` file and `#{name}` dir."
+ exit!
+ end
+ unless Dir['VERSION*'].empty?
+ puts "A `VERSION` file at root level violates Gem best practices."
+ exit!
+ end
+end
View
74 jmongo.gemspec
@@ -1,39 +1,47 @@
-# -*- encoding: utf-8 -*-
-
Gem::Specification.new do |s|
- s.name = %q{jmongo}
- s.version = "0.1.6"
+ s.name = 'jmongo'
+ s.version = '1.0.0'
+ s.date = '2011-09-15'
+ s.platform = Gem::Platform::RUBY
+ s.authors = ["Chuck Remes","Guy Boertje", "Lee Henson"]
+ s.email = ["cremes@mac.com", "guyboertje@gmail.com", "lee.m.henson@gmail.com"]
+ s.summary = "Thin ruby wrapper around Mongo Java Driver; for JRuby only"
+ s.description = %q{Thin jruby wrapper around Mongo Java Driver}
+ s.homepage = 'http://github.com/chuckremes/jmongo'
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = ["Chuck Remes","Guy Boertje"]
- s.date = %q{2010-05-05}
- s.default_executable = %q{jmongo}
- s.description = %q{Thin jruby wrapper around Mongo Java Driver}
- s.email = %q{cremes@mac.com}
- s.executables = ["jmongo"]
- s.extra_rdoc_files = ["History.txt", "README.txt", "bin/jmongo", "version.txt", "LICENSE.txt"]
- s.files = ["History.txt", "README.txt", "Rakefile", "bin/jmongo", "lib/jmongo.rb", "lib/jmongo_jext.rb", "lib/jmongo/ajrb.rb", "lib/jmongo/collection.rb", "lib/jmongo/connection.rb", "lib/jmongo/cursor.rb", "lib/jmongo/db.rb", "lib/jmongo/utils.rb", "spec/jmongo_spec.rb", "spec/spec_helper.rb", "version.txt"]
- s.files += ["lib/jmongo/mongo-2.6.3.jar"]
- s.homepage = %q{http://github.com/chuckremes/jmongo}
- s.rdoc_options = ["--main", "README.txt"]
- s.require_paths = ["lib"]
+ s.executables = ["jmongo"]
+ s.extra_rdoc_files = ["History.txt", "README.txt", "bin/jmongo", "LICENSE.txt"]
+ s.rdoc_options = ["--main", "README.txt"]
s.rubyforge_project = %q{jmongo}
- s.rubygems_version = %q{1.3.1}
- s.summary = "Thin ruby wrapper around Mongo Java Driver; for JRuby only"
- #"lib/jmongo/mongo-2.2.jar",
- if s.respond_to? :specification_version then
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
- s.specification_version = 2
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
- s.add_development_dependency(%q<bones>, [">= 3.4.1"])
- else
- s.add_dependency(%q<bones>, [">= 3.4.1"])
- end
- else
- s.add_dependency(%q<bones>, [">= 3.4.1"])
- end
+ # = MANIFEST =
+ s.files = %w[
+ Gemfile
+ Gemfile.lock
+ History.txt
+ LICENSE.txt
+ README.txt
+ Rakefile
+ bin/jmongo
+ jmongo.gemspec
+ lib/jmongo.rb
+ lib/jmongo/ajrb.rb
+ lib/jmongo/collection.rb
+ lib/jmongo/connection.rb
+ lib/jmongo/cursor.rb
+ lib/jmongo/db.rb
+ lib/jmongo/exceptions.rb
+ lib/jmongo/jmongo_jext.rb
+ lib/jmongo/mongo-2.6.3.jar
+ lib/jmongo/utils.rb
+ lib/jmongo/version.rb
+ spec/jmongo_spec.rb
+ spec/spec_helper.rb
+ ]
+ # = MANIFEST =
- s.add_development_dependency 'awesome_print'
- s.add_development_dependency 'rspec'
+ s.add_development_dependency 'awesome_print', '~> 0.4'
+ s.add_development_dependency 'fuubar', '~> 0.0'
+ s.add_development_dependency 'rspec', '~> 2.6'
end
View
3  lib/jmongo.rb
@@ -92,7 +92,7 @@ def self.require_all_jars_relative_to( fname, dir = nil )
Mongo.require_all_jars_relative_to(__FILE__)
# import all of the java packages we'll need into the JMongo namespace
-require 'jmongo_jext'
+require 'jmongo/jmongo_jext'
Mongo.require_all_libs_relative_to(__FILE__)
@@ -104,5 +104,4 @@ module Mongo
module Constants
DEFAULT_BATCH_SIZE = 100
end
-
end
View
0  lib/jmongo_jext.rb → lib/jmongo/jmongo_jext.rb
File renamed without changes
View
BIN  lib/jmongo/old-jars/mongo-2.2.jar
Binary file not shown
View
3  lib/jmongo/version.rb
@@ -0,0 +1,3 @@
+module Mongo
+ VERSION = '1.0.0'
+end
View
1  version.txt
@@ -1 +0,0 @@
-0.1.6
Please sign in to comment.
Something went wrong with that request. Please try again.