Skip to content

Commit

Permalink
Bring build toolchain up to current standards
Browse files Browse the repository at this point in the history
This is a first minimal pass for developing on modern Rubies like 2.2.x:

  - Test::Unit hasn’t been in the standard lib for awhile, switch to
    minitest since it seems to be the preferred community equivalent
    these days versus the test-unit backport.
  - Update mocha for current minutest support.
  - Current Rake versions don’t have RDocTask, so use RDoc::Task and put
    rdoc in the dev dependencies.
  • Loading branch information
ches committed Nov 3, 2015
1 parent 7bc6b7a commit 28acd73
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Gemfile
@@ -1,4 +1,4 @@
source :rubygems
source 'https://rubygems.org'
gemspec

gem 'ruby-debug', :platforms => :mri_18
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,4 +1,4 @@
Copyright (c) 2009-2011 Blake Carlson
Copyright (c) 2009-2015 Blake Carlson

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
35 changes: 28 additions & 7 deletions README.rdoc
@@ -1,6 +1,6 @@
= Rack::GridFS

Rack:GridFS is a Rack middleware for creating HTTP endpoints for files
Rack::GridFS is a Rack middleware for creating HTTP endpoints for files
stored in MongoDB's GridFS. You can configure a prefix string which
will be used to match the path of a request, and further look up GridFS
files based on either their +ObjectId+ or +filename+ field.
Expand All @@ -12,13 +12,21 @@ For example,
If the prefix is "gridfs", then the id will be be "someobjectid".

You can also use Rack::GridFS::Endpoint as a rack endpoint if you want to
handle routing another way
handle routing another way.

== Mongo Driver Compatibility Notes
== Ruby Version and Mongo Driver Compatibility Notes

This version is currently based on mongo-1.2+. As there were significant changes
to the GridFS API prior to v1.0, you may have luck with the git-tagged version
0.2.0 of this library with earlier versions of the driver.
The library hasn't been updated for some time and is in the process of being
brought up to modern standards on the `master` branch. It probably does not yet
work with current versions of the `mongo` and `bson` gems (patches welcome if
you need it faster than we can deliver it). Support for Ruby 1.8 is almost
certainly already dropped on master—it was supported up to gem release/git tag
v0.4.1.

If for some reason you need support for ancient versions of the `mongo` driver
prior to v1.2, these were supported in rack-gridfs 0.3.0 and below. 0.4.x
supports `mongo` 1.2(.x?) which made substantial changes to the earlier GridFS
API.

== Installation

Expand Down Expand Up @@ -147,6 +155,19 @@ these files as such:
config.middleware.insert_after Rack::Runtime, Rack::GridFS,
:prefix => 'uploads', :lookup => :path, :database => "my_app_#{Rails.env}"

== Development and Contributing

Running the project and unit tests in development follows typical procedure for
a Ruby project:

$ git clone https://github.com/skinandbones/rack-gridfs.git
$ cd rack-gridfs
$ bundle install
$ bundle exec rake test

Note that the test suite expects that you have MongoDB running locally on the
default port and will use a database called `test`.

== Copyright

Copyright (c) 2010-2011 Blake Carlson. See LICENSE for details.
Copyright (c) 2010-2015 Blake Carlson. See LICENSE for details.
16 changes: 9 additions & 7 deletions Rakefile
@@ -1,13 +1,19 @@
require 'bundler/setup'
require 'rake/testtask'
require 'rdoc/task'

require File.expand_path("../lib/rack/gridfs/version", __FILE__)

Bundler::GemHelper.install_tasks

require 'rake/testtask'
Rake::TestTask.new(:test) do |test|
test.libs << 'lib' << 'test'
test.pattern = 'test/**/*_test.rb'
test.verbose = true
end

task :default => :test

begin
require 'rcov/rcovtask'
Rcov::RcovTask.new do |test|
Expand All @@ -22,12 +28,8 @@ rescue LoadError
end
end

task :default => :test

require 'rake/rdoctask'
Rake::RDocTask.new do |rdoc|
require File.expand_path("../lib/rack/gridfs/version", __FILE__)

RDoc::Task.new do |rdoc|
rdoc.main = 'README.rdoc'
rdoc.rdoc_dir = 'rdoc'
rdoc.title = "Rack::GridFS #{Rack::GridFS::VERSION}"
rdoc.rdoc_files.include(%w[ README* CHANGES* ])
Expand Down
10 changes: 6 additions & 4 deletions rack-gridfs.gemspec
Expand Up @@ -5,8 +5,8 @@ Gem::Specification.new do |s|
s.name = "rack-gridfs"
s.version = Rack::GridFS::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Blake Carlson"]
s.email = ['blake@coin-operated.net']
s.authors = ['Blake Carlson', 'Ches Martin']
s.email = ['blake@coin-operated.net', 'ches@whiskeyandgrits.net']
s.homepage = "http://github.com/skinandbones/rack-gridfs"
s.summary = "Serve MongoDB GridFS files from Rack"
s.description = "Rack middleware for creating HTTP endpoints for files stored in MongoDB's GridFS"
Expand All @@ -19,10 +19,12 @@ Gem::Specification.new do |s|
s.add_dependency('mime-types')

s.add_development_dependency('bundler', '>= 1.0.0')
s.add_development_dependency('mocha', '0.9.12')
s.add_development_dependency('minitest', '~> 5.8')
s.add_development_dependency('mocha', '~> 1.1')
s.add_development_dependency('rack-test')
s.add_development_dependency('rake')
s.add_development_dependency('shoulda')
s.add_development_dependency('rdoc', '>= 2.4.2')
s.add_development_dependency('shoulda-context', '~> 1.2')

s.files = Dir.glob("lib/**/*") + %w(LICENSE README.rdoc Rakefile)
s.require_path = 'lib'
Expand Down
2 changes: 1 addition & 1 deletion test/caching_test.rb
@@ -1,6 +1,6 @@
require 'test_helper'

class CachingTest < Test::Unit::TestCase
class CachingTest < Minitest::Test
include Rack::Test::Methods
include Rack::GridFS::Test::Methods

Expand Down
4 changes: 2 additions & 2 deletions test/config_test.rb
@@ -1,6 +1,6 @@
require 'test_helper'

class ConfigTest < Test::Unit::TestCase
class ConfigTest < Minitest::Test
include Rack::Test::Methods
include Rack::GridFS::Test::Methods

Expand Down Expand Up @@ -92,7 +92,7 @@ class ConfigTest < Test::Unit::TestCase

should "have a default mapper" do
mware = Rack::GridFS::Endpoint.new(@options.except(:mapper))
assert_not_nil mware.instance_variable_get(:@options)[:mapper]
refute_nil mware.instance_variable_get(:@options)[:mapper]
end

should "connect to the MongoDB server" do
Expand Down
2 changes: 1 addition & 1 deletion test/exceptions_test.rb
@@ -1,6 +1,6 @@
require 'test_helper'

class ExceptionsTest < Test::Unit::TestCase
class ExceptionsTest < Minitest::Test
include Rack::Test::Methods
include Rack::GridFS::Test::Methods

Expand Down
2 changes: 1 addition & 1 deletion test/gridfs_test.rb
Expand Up @@ -3,7 +3,7 @@
require 'test_helper'
require 'pp'

class Rack::GridFSTest < Test::Unit::TestCase
class Rack::GridFSTest < Minitest::Test
include Rack::Test::Methods
include Rack::GridFS::Test::Methods

Expand Down
6 changes: 3 additions & 3 deletions test/test_helper.rb
@@ -1,6 +1,6 @@
require 'test/unit'
require 'shoulda'
require 'mocha'
require 'minitest/autorun'
require 'shoulda/context'
require 'mocha/mini_test'

require 'rack/builder'
require 'rack/mock'
Expand Down

0 comments on commit 28acd73

Please sign in to comment.