Skip to content

Commit

Permalink
Modernized gem with Bundler and RSpec 2.0 support
Browse files Browse the repository at this point in the history
  • Loading branch information
RISCfuture committed Oct 31, 2010
1 parent 98c63bd commit 929a833
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 48 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ coverage
rdoc
pkg
.rvmrc
.bundle

## PROJECT::SPECIFIC
keys.json
File renamed without changes.
14 changes: 14 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
source :rubygems

# DEPENDENCIES
gem 'oauth', '>= 0.3.6'
gem 'json', '>= 1.2.0'
gem 'multipart-post', '>= 1.0'
gem 'mechanize', '>= 1.0.0'


# DEVELOPMENT
gem 'jeweler'

# TEST
gem 'rspec', '>= 2.0'
40 changes: 40 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
GEM
remote: http://rubygems.org/
specs:
diff-lcs (1.1.2)
gemcutter (0.6.1)
git (1.2.5)
jeweler (1.4.0)
gemcutter (>= 0.1.0)
git (>= 1.2.5)
rubyforge (>= 2.0.0)
json (1.4.6)
json_pure (1.4.6)
mechanize (1.0.0)
nokogiri (>= 1.2.1)
multipart-post (1.0.1)
nokogiri (1.4.3.1)
oauth (0.4.3)
rspec (2.0.1)
rspec-core (~> 2.0.1)
rspec-expectations (~> 2.0.1)
rspec-mocks (~> 2.0.1)
rspec-core (2.0.1)
rspec-expectations (2.0.1)
diff-lcs (>= 1.1.2)
rspec-mocks (2.0.1)
rspec-core (~> 2.0.1)
rspec-expectations (~> 2.0.1)
rubyforge (2.0.4)
json_pure (>= 1.1.7)

PLATFORMS
ruby

DEPENDENCIES
jeweler
json (>= 1.2.0)
mechanize (>= 1.0.0)
multipart-post (>= 1.0)
oauth (>= 0.3.6)
rspec (>= 2.0)
58 changes: 22 additions & 36 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,48 +1,32 @@
require 'rubygems'
require 'rake'

begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "dropbox"
gem.version = File.read("VERSION").chomp.strip
gem.summary = %Q{Ruby client library for the official Dropbox API}
gem.description = %Q{An easy-to-use client library for the official Dropbox API.}
gem.email = "dropbox@timothymorgan.info"
gem.homepage = "http://github.com/RISCfuture/dropbox"
gem.authors = ["Tim Morgan"]

gem.files += FileList["lib/dropbox/*.rb"]
gem.add_development_dependency "rspec", ">= 1.2.9"
gem.add_runtime_dependency "oauth", ">= 0.3.6"
gem.add_runtime_dependency "json", ">= 1.2.0"
gem.add_runtime_dependency "multipart-post", ">= 1.0"
gem.add_runtime_dependency "mechanize", ">= 1.0.0"
end
Jeweler::GemcutterTasks.new
Jeweler::RubyforgeTasks.new
require 'bundler'
rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
end

require 'spec/rake/spectask'
Spec::Rake::SpecTask.new(:spec) do |spec|
spec.libs << 'lib' << 'spec'
spec.spec_files = FileList['spec/**/*_spec.rb']
puts "Bundler is not installed; install with `gem install bundler`."
exit 1
end

Spec::Rake::SpecTask.new(:rcov) do |spec|
spec.libs << 'lib' << 'spec'
spec.pattern = 'spec/**/*_spec.rb'
spec.rcov = true
Bundler.require :default

Jeweler::Tasks.new do |gem|
gem.name = "dropbox"
gem.summary = %Q{Ruby client library for the official Dropbox API}
gem.description = %Q{An easy-to-use client library for the official Dropbox API.}
gem.email = "dropbox@timothymorgan.info"
gem.homepage = "http://github.com/RISCfuture/dropbox"
gem.authors = [ "Tim Morgan" ]
gem.add_dependency 'oauth', '>= 0.3.6'
gem.add_dependency 'json', '>= 1.2.0'
gem.add_dependency 'multipart-post', '>= 1.0'
gem.add_dependency 'mechanize', '>= 1.0.0'
end
Jeweler::GemcutterTasks.new

task :spec => :check_dependencies

task :default => :spec
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new

require 'rake/rdoctask'
Rake::RDocTask.new do |rdoc|
Rake::RDocTask.new(:doc) do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION').chomp.strip : ""

rdoc.rdoc_dir = 'rdoc'
Expand All @@ -51,3 +35,5 @@ Rake::RDocTask.new do |rdoc|
rdoc.rdoc_files.include('LICENSE')
rdoc.rdoc_files.include('lib/**/*.rb')
end

task(default: :spec)
9 changes: 4 additions & 5 deletions dropbox.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Gem::Specification.new do |s|

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Tim Morgan"]
s.date = %q{2010-10-06}
s.date = %q{2010-10-31}
s.description = %q{An easy-to-use client library for the official Dropbox API.}
s.email = %q{dropbox@timothymorgan.info}
s.extra_rdoc_files = [
Expand All @@ -20,7 +20,10 @@ Gem::Specification.new do |s|
s.files = [
".document",
".gitignore",
".rspec",
"ChangeLog",
"Gemfile",
"Gemfile.lock",
"LICENSE",
"README.rdoc",
"Rakefile",
Expand All @@ -46,7 +49,6 @@ Gem::Specification.new do |s|
"spec/dropbox/revision_spec.rb",
"spec/dropbox/session_spec.rb",
"spec/dropbox_spec.rb",
"spec/spec.opts",
"spec/spec_helper.rb"
]
s.homepage = %q{http://github.com/RISCfuture/dropbox}
Expand All @@ -69,20 +71,17 @@ Gem::Specification.new do |s|
s.specification_version = 3

if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
s.add_runtime_dependency(%q<oauth>, [">= 0.3.6"])
s.add_runtime_dependency(%q<json>, [">= 1.2.0"])
s.add_runtime_dependency(%q<multipart-post>, [">= 1.0"])
s.add_runtime_dependency(%q<mechanize>, [">= 1.0.0"])
else
s.add_dependency(%q<rspec>, [">= 1.2.9"])
s.add_dependency(%q<oauth>, [">= 0.3.6"])
s.add_dependency(%q<json>, [">= 1.2.0"])
s.add_dependency(%q<multipart-post>, [">= 1.0"])
s.add_dependency(%q<mechanize>, [">= 1.0.0"])
end
else
s.add_dependency(%q<rspec>, [">= 1.2.9"])
s.add_dependency(%q<oauth>, [">= 0.3.6"])
s.add_dependency(%q<json>, [">= 1.2.0"])
s.add_dependency(%q<multipart-post>, [">= 1.0"])
Expand Down
2 changes: 1 addition & 1 deletion lib/dropbox/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def authorize!

login_form.login_email = @authorizing_user
login_form.login_password = @authorizing_password
auth_page = login_form.submit()
auth_page = login_form.submit

auth_form = auth_page.form_with(:action => 'authorize')
if auth_form
Expand Down
12 changes: 6 additions & 6 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
Bundler.require :default, :test

$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'rubygems'
require 'dropbox.rb'
require 'spec'
require 'spec/autorun'

require 'dropbox'

module ExternalKeysFileHelper
def read_keys_file
unless File.exist?('keys.json')
raise "Please add a keys.json file to the project directory containing your Dropbox API key and secret. See keys.json.example to get started."
end

keys_file_contents = open("keys.json", "r").read()
keys_file_contents = open("keys.json", "r").read
data = JSON.parse(keys_file_contents)
unless %w( key secret email password ).all? { |key| data.include? key }
raise "Your keys.json file does contain all the required information. See keys.json.example for more help."
Expand All @@ -21,6 +21,6 @@ def read_keys_file
end
end

Spec::Runner.configure do |config|
RSpec.configure do |config|
config.include(ExternalKeysFileHelper)
end

0 comments on commit 929a833

Please sign in to comment.