Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 10 commits
  • 13 files changed
  • 0 commit comments
  • 2 contributors
Commits on May 08, 2012
@adammck adammck Remove Gemfile.lock.
This file should not be checked into version control when developing
gems, because it imposes very specific dependencies on app authors
attempting to use it.

See: http://yehudakatz.com/2010/12/16/clarifying-the-roles-of-the-gemspec-and-gemfile/
c6b6264
@adammck adammck Remove duplicate dependencies from Gemfile.
Since we're using Jeweler to generate the gemspec, the dependencies
belong in the Rakefile.

This was already patched by @aub, but his pull request hasn't been
accepted yet. I'm including it here to keep things simple.
495b66b
@adammck adammck Remove rubygems and bundler boilerplate.
These are both environmental concerns, and do not belong in library
code. And RubyGems is part of the 1.9 stdlib, so this isn't necessary.
c690fad
@adammck adammck Use SimpleCov instead of RCov.
RCov doesn't work on Ruby 1.9. SimpleCov does.
71c1b96
@adammck adammck Fix rake/rdoctask deprecation warning. c4913ab
@adammck adammck Fix removed Faraday JSON middleware.
The JSON request middleware is no longer included with Faraday. This
seems to have already been partially fixed, since FaradayMiddleware
was already a dependency.

The tests are now passing on Ruby 1.9.
06656ca
@adammck adammck Add Jeweler development dependency.
It's only used for generating the gemspec, but the Rakefile requires
it, and this seems less surprising than rescuing the LoadError.
a896a88
@adammck adammck Fix tests for Ruby 1.8.7.
The newline between the object and method doesn't work in Ruby 1.8.
Otherwise, the gem already works fine. So I figure this should be
fixed.
e64b553
@adammck adammck Remove duplicate dependencies from gemspec. 6d9f900
Commits on May 09, 2012
@andrewpbrett andrewpbrett Merge pull request #7 from adammck/fix_environment
Fix the environment for Ruby 1.8.7 through 1.9.3
b2a235d
View
2 .gitignore
@@ -1,3 +1,5 @@
+Gemfile.lock
+
# rcov generated
coverage
View
22 Gemfile
@@ -1,20 +1,2 @@
-source "http://rubygems.org"
-# Add dependencies required to use your gem here.
-# Example:
-# gem "activesupport", ">= 2.3.5"
-
-gem "oauth2", "= 0.5.2"
-gem "faraday", "= 0.7.4"
-gem "faraday_middleware", "= 0.7.0"
-gem "hashie", "= 1.2"
-gem "json"
-
-# Add dependencies to develop your gem here.
-# Include everything needed to run rake, tests, features, etc.
-group :development do
- gem "shoulda", ">= 0"
- gem "webmock", "= 1.7.4"
- gem "bundler", "~> 1.0.0"
- gem "jeweler", "~> 1.6.4"
- gem "rcov", ">= 0"
-end
+source "https://rubygems.org"
+gemspec
View
45 Gemfile.lock
@@ -1,45 +0,0 @@
-GEM
- remote: http://rubygems.org/
- specs:
- addressable (2.2.6)
- crack (0.3.1)
- faraday (0.7.4)
- addressable (~> 2.2.6)
- multipart-post (~> 1.1.0)
- rack (>= 1.1.0, < 2)
- faraday_middleware (0.7.0)
- faraday (~> 0.7.3)
- git (1.2.5)
- hashie (1.2.0)
- jeweler (1.6.4)
- bundler (~> 1.0)
- git (>= 1.2.5)
- rake
- json (1.6.5)
- multi_json (1.0.4)
- multipart-post (1.1.3)
- oauth2 (0.5.2)
- faraday (~> 0.7)
- multi_json (~> 1.0)
- rack (1.3.4)
- rake (0.9.2)
- rcov (0.9.10)
- shoulda (2.11.3)
- webmock (1.7.4)
- addressable (~> 2.2, > 2.2.5)
- crack (>= 0.1.7)
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- bundler (~> 1.0.0)
- faraday (= 0.7.4)
- faraday_middleware (= 0.7.0)
- hashie (= 1.2)
- jeweler (~> 1.6.4)
- json
- oauth2 (= 0.5.2)
- rcov
- shoulda
- webmock (= 1.7.4)
View
41 Rakefile
@@ -1,19 +1,9 @@
# encoding: utf-8
-require 'rubygems'
-require 'bundler'
-begin
- Bundler.setup(:default, :development)
-rescue Bundler::BundlerError => e
- $stderr.puts e.message
- $stderr.puts "Run `bundle install` to install missing gems"
- exit e.status_code
-end
-require 'rake'
+task :default => :test
require 'jeweler'
Jeweler::Tasks.new do |gem|
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
gem.name = "health_graph"
gem.homepage = "http://github.com/kennyma/health_graph"
gem.license = "MIT"
@@ -21,13 +11,16 @@ Jeweler::Tasks.new do |gem|
gem.description = "This is a wrapper for RunKeeper Health Graph RESTful API."
gem.email = "kenny@kennyma.me"
gem.authors = ["Kenny Ma"]
- # dependencies defined in Gemfile
- gem.add_dependency 'oauth2', '= 0.5.2'
- gem.add_dependency 'faraday', '= 0.7.4'
- gem.add_dependency 'faraday_middleware', '= 0.7.0'
- gem.add_dependency 'hashie', '= 1.2'
- gem.add_dependency 'webmock', '= 1.7.6'
- gem.add_dependency 'json'
+
+ gem.add_dependency "oauth2", ">= 0.5.2"
+ gem.add_dependency "faraday", ">= 0.7.4"
+ gem.add_dependency "faraday_middleware", ">= 0.7.8"
+ gem.add_dependency "hashie", ">= 1.2"
+ gem.add_dependency "webmock", ">= 1.7.6"
+
+ gem.add_development_dependency "shoulda"
+ gem.add_development_dependency "simplecov"
+ gem.add_development_dependency "jeweler"
end
Jeweler::RubygemsDotOrgTasks.new
@@ -38,17 +31,7 @@ Rake::TestTask.new(:test) do |test|
test.verbose = true
end
-require 'rcov/rcovtask'
-Rcov::RcovTask.new do |test|
- test.libs << 'test'
- test.pattern = 'test/**/test_*.rb'
- test.verbose = true
- test.rcov_opts << '--exclude "gems/*"'
-end
-
-task :default => :test
-
-require 'rake/rdoctask'
+require 'rdoc/task'
Rake::RDocTask.new do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
View
79 health_graph.gemspec
@@ -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 = ["Kenny Ma"]
- s.date = "2012-03-11"
+ s.date = "2012-05-08"
s.description = "This is a wrapper for RunKeeper Health Graph RESTful API."
s.email = "kenny@kennyma.me"
s.extra_rdoc_files = [
@@ -19,7 +19,6 @@ Gem::Specification.new do |s|
s.files = [
".document",
"Gemfile",
- "Gemfile.lock",
"LICENSE.txt",
"README.rdoc",
"Rakefile",
@@ -59,68 +58,46 @@ Gem::Specification.new do |s|
"test/helper.rb",
"test/test_health_graph.rb"
]
- s.homepage = %q{http://github.com/kennyma/health_graph}
+ s.homepage = "http://github.com/kennyma/health_graph"
s.licenses = ["MIT"]
s.require_paths = ["lib"]
- s.rubygems_version = %q{1.3.7}
- s.summary = %q{Ruby gem for RunKeeper Health Graph API}
+ s.rubygems_version = "1.8.24"
+ s.summary = "Ruby gem for RunKeeper Health Graph API"
if s.respond_to? :specification_version then
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q<oauth2>, ["= 0.5.2"])
- s.add_runtime_dependency(%q<faraday>, ["= 0.7.4"])
- s.add_runtime_dependency(%q<faraday_middleware>, ["= 0.7.0"])
- s.add_runtime_dependency(%q<hashie>, ["= 1.2"])
- s.add_runtime_dependency(%q<json>, [">= 0"])
+ s.add_runtime_dependency(%q<health_graph>, [">= 0"])
+ s.add_runtime_dependency(%q<oauth2>, [">= 0.5.2"])
+ s.add_runtime_dependency(%q<faraday>, [">= 0.7.4"])
+ s.add_runtime_dependency(%q<faraday_middleware>, [">= 0.7.8"])
+ s.add_runtime_dependency(%q<hashie>, [">= 1.2"])
+ s.add_runtime_dependency(%q<webmock>, [">= 1.7.6"])
s.add_development_dependency(%q<shoulda>, [">= 0"])
- s.add_development_dependency(%q<webmock>, ["= 1.7.4"])
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
- s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
- s.add_development_dependency(%q<rcov>, [">= 0"])
- s.add_runtime_dependency(%q<oauth2>, ["= 0.5.2"])
- s.add_runtime_dependency(%q<faraday>, ["= 0.7.4"])
- s.add_runtime_dependency(%q<faraday_middleware>, ["= 0.7.0"])
- s.add_runtime_dependency(%q<hashie>, ["= 1.2"])
- s.add_runtime_dependency(%q<webmock>, ["= 1.7.6"])
- s.add_runtime_dependency(%q<json>, [">= 0"])
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
else
- s.add_dependency(%q<oauth2>, ["= 0.5.2"])
- s.add_dependency(%q<faraday>, ["= 0.7.4"])
- s.add_dependency(%q<faraday_middleware>, ["= 0.7.0"])
- s.add_dependency(%q<hashie>, ["= 1.2"])
- s.add_dependency(%q<json>, [">= 0"])
+ s.add_dependency(%q<health_graph>, [">= 0"])
+ s.add_dependency(%q<oauth2>, [">= 0.5.2"])
+ s.add_dependency(%q<faraday>, [">= 0.7.4"])
+ s.add_dependency(%q<faraday_middleware>, [">= 0.7.8"])
+ s.add_dependency(%q<hashie>, [">= 1.2"])
+ s.add_dependency(%q<webmock>, [">= 1.7.6"])
s.add_dependency(%q<shoulda>, [">= 0"])
- s.add_dependency(%q<webmock>, ["= 1.7.4"])
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
- s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
- s.add_dependency(%q<rcov>, [">= 0"])
- s.add_dependency(%q<oauth2>, ["= 0.5.2"])
- s.add_dependency(%q<faraday>, ["= 0.7.4"])
- s.add_dependency(%q<faraday_middleware>, ["= 0.7.0"])
- s.add_dependency(%q<hashie>, ["= 1.2"])
- s.add_dependency(%q<webmock>, ["= 1.7.6"])
- s.add_dependency(%q<json>, [">= 0"])
+ s.add_dependency(%q<simplecov>, [">= 0"])
+ s.add_dependency(%q<jeweler>, [">= 0"])
end
else
- s.add_dependency(%q<oauth2>, ["= 0.5.2"])
- s.add_dependency(%q<faraday>, ["= 0.7.4"])
- s.add_dependency(%q<faraday_middleware>, ["= 0.7.0"])
- s.add_dependency(%q<hashie>, ["= 1.2"])
- s.add_dependency(%q<json>, [">= 0"])
+ s.add_dependency(%q<health_graph>, [">= 0"])
+ s.add_dependency(%q<oauth2>, [">= 0.5.2"])
+ s.add_dependency(%q<faraday>, [">= 0.7.4"])
+ s.add_dependency(%q<faraday_middleware>, [">= 0.7.8"])
+ s.add_dependency(%q<hashie>, [">= 1.2"])
+ s.add_dependency(%q<webmock>, [">= 1.7.6"])
s.add_dependency(%q<shoulda>, [">= 0"])
- s.add_dependency(%q<webmock>, ["= 1.7.4"])
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
- s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
- s.add_dependency(%q<rcov>, [">= 0"])
- s.add_dependency(%q<oauth2>, ["= 0.5.2"])
- s.add_dependency(%q<faraday>, ["= 0.7.4"])
- s.add_dependency(%q<faraday_middleware>, ["= 0.7.0"])
- s.add_dependency(%q<hashie>, ["= 1.2"])
- s.add_dependency(%q<webmock>, ["= 1.7.6"])
- s.add_dependency(%q<json>, [">= 0"])
+ s.add_dependency(%q<simplecov>, [">= 0"])
+ s.add_dependency(%q<jeweler>, [">= 0"])
end
end
View
2 lib/health_graph/api.rb
@@ -44,7 +44,7 @@ def connection method
Faraday.new(merged_options) do |builder|
builder.use Faraday::Request::UrlEncoded
- builder.use Faraday::Request::JSON if method == :post
+ builder.use FaradayMiddleware::EncodeJson if method == :post
builder.use Faraday::Response::Mashify
builder.use Faraday::Response::ParseJson
builder.adapter(HealthGraph.adapter)
View
18 test/health_graph/test_fitness_activities_feed.rb
@@ -3,17 +3,17 @@
class TestFitnessActivitiesFeed < Test::Unit::TestCase
context "fitness activities" do
setup do
- stub_request(:get, HealthGraph.endpoint + '/user')
- .with(:header => {'Authorization' => 'Bearer ' + TEST_USER_TOKEN, 'Accept' => HealthGraph.accept_headers[:user]})
- .to_return(:body => fixture('user_get.json'))
+ stub_request(:get, HealthGraph.endpoint + '/user'
+ ).with(:header => { 'Authorization' => 'Bearer ' + TEST_USER_TOKEN, 'Accept' => HealthGraph.accept_headers[:user]}
+ ).to_return(:body => fixture('user_get.json'))
- stub_request(:get, HealthGraph.endpoint + '/fitnessActivities')
- .with(:header => {'Authorization' => 'Bearer ' + TEST_USER_TOKEN, 'Accept' => HealthGraph.accept_headers[:fitness_activities_feed]})
- .to_return(:body => fixture('fitness_activities_feed.json'))
+ stub_request(:get, HealthGraph.endpoint + '/fitnessActivities'
+ ).with(:header => {'Authorization' => 'Bearer ' + TEST_USER_TOKEN, 'Accept' => HealthGraph.accept_headers[:fitness_activities_feed]}
+ ).to_return(:body => fixture('fitness_activities_feed.json'))
- stub_request(:get, HealthGraph.endpoint + '/fitnessActivities?pageSize=3')
- .with(:header => {'Authorization' => 'Bearer ' + TEST_USER_TOKEN, 'Accept' => HealthGraph.accept_headers[:fitness_activities_feed]})
- .to_return(:body => fixture('fitness_activities_feed.json'))
+ stub_request(:get, HealthGraph.endpoint + '/fitnessActivities?pageSize=3'
+ ).with(:header => {'Authorization' => 'Bearer ' + TEST_USER_TOKEN, 'Accept' => HealthGraph.accept_headers[:fitness_activities_feed]}
+ ).to_return(:body => fixture('fitness_activities_feed.json'))
@user = HealthGraph::User.new(TEST_USER_TOKEN)
end
View
10 test/health_graph/test_new_fitness_activity.rb
@@ -3,14 +3,14 @@
class TestNewFitnessActivity < Test::Unit::TestCase
context "New Fitness Activity" do
setup do
- stub_request(:post, HealthGraph.endpoint + '/fitnessActivities')
- .with(:header => {'Authorization' => 'Bearer ' + TEST_USER_TOKEN, 'Accept' => HealthGraph.accept_headers[:new_fitness_activity]})
- .to_return(:status => 201, :headers => {'location' => '/fitnessActivities/20'})
+ stub_request(:post, HealthGraph.endpoint + '/fitnessActivities'
+ ).with(:header => {'Authorization' => 'Bearer ' + TEST_USER_TOKEN, 'Accept' => HealthGraph.accept_headers[:new_fitness_activity]}
+ ).to_return(:status => 201, :headers => {'location' => '/fitnessActivities/20'})
end
should "make request to api" do
- activity = HealthGraph::NewFitnessActivity.new(TEST_USER_TOKEN, json_fixture('new_fitness_activity_params.json'))
- assert_requested :post, HealthGraph.endpoint + '/fitnessActivities', :header => {'Authorization' => 'Bearer ' + TEST_USER_TOKEN, 'Accept' => HealthGraph.accept_headers[:new_fitness_activity]}, :times => 1
+ activity = HealthGraph::NewFitnessActivity.new(TEST_USER_TOKEN, json_fixture('new_fitness_activity_params.json'))
+ assert_requested :post, HealthGraph.endpoint + '/fitnessActivities', :header => {'Authorization' => 'Bearer ' + TEST_USER_TOKEN, 'Accept' => HealthGraph.accept_headers[:new_fitness_activity]}, :times => 1
end
should "get location" do
View
12 test/health_graph/test_profile.rb
@@ -3,13 +3,13 @@
class TestProfile < Test::Unit::TestCase
context "profile" do
setup do
- stub_request(:get, HealthGraph.endpoint + '/user')
- .with(:header => {'Authorization' => 'Bearer ' + TEST_USER_TOKEN, 'Accept' => HealthGraph.accept_headers[:user]})
- .to_return(:body => fixture('user_get.json'))
+ stub_request(:get, HealthGraph.endpoint + '/user'
+ ).with(:header => {'Authorization' => 'Bearer ' + TEST_USER_TOKEN, 'Accept' => HealthGraph.accept_headers[:user]}
+ ).to_return(:body => fixture('user_get.json'))
- stub_request(:get, HealthGraph.endpoint + '/profile')
- .with(:header => {'Authorization' => 'Bearer ' + TEST_USER_TOKEN, 'Accept' => HealthGraph.accept_headers[:profile]})
- .to_return(:body => fixture('profile_get.json'))
+ stub_request(:get, HealthGraph.endpoint + '/profile'
+ ).with(:header => {'Authorization' => 'Bearer ' + TEST_USER_TOKEN, 'Accept' => HealthGraph.accept_headers[:profile]}
+ ).to_return(:body => fixture('profile_get.json'))
@user = HealthGraph::User.new(TEST_USER_TOKEN)
end
View
12 test/health_graph/test_sleep_feed.rb
@@ -3,13 +3,13 @@
class TestSleepFeed < Test::Unit::TestCase
context "sleep" do
setup do
- stub_request(:get, HealthGraph.endpoint + '/user')
- .with(:header => {'Authorization' => 'Bearer ' + TEST_USER_TOKEN, 'Accept' => HealthGraph.accept_headers[:user]})
- .to_return(:body => fixture('user_get.json'))
+ stub_request(:get, HealthGraph.endpoint + '/user'
+ ).with(:header => {'Authorization' => 'Bearer ' + TEST_USER_TOKEN, 'Accept' => HealthGraph.accept_headers[:user]}
+ ).to_return(:body => fixture('user_get.json'))
- stub_request(:get, HealthGraph.endpoint + '/sleep')
- .with(:header => {'Authorization' => 'Bearer ' + TEST_USER_TOKEN, 'Accept' => HealthGraph.accept_headers[:sleep_feed]})
- .to_return(:body => fixture('sleep_feed_get.json'))
+ stub_request(:get, HealthGraph.endpoint + '/sleep'
+ ).with(:header => {'Authorization' => 'Bearer ' + TEST_USER_TOKEN, 'Accept' => HealthGraph.accept_headers[:sleep_feed]}
+ ).to_return(:body => fixture('sleep_feed_get.json'))
@user = HealthGraph::User.new(TEST_USER_TOKEN)
end
View
6 test/health_graph/test_user.rb
@@ -3,9 +3,9 @@
class TestUser < Test::Unit::TestCase
context "user" do
setup do
- stub_request(:get, HealthGraph.endpoint + '/user')
- .with(:header => {'Authorization' => 'Bearer ' + TEST_USER_TOKEN, 'Accept' => HealthGraph.accept_headers[:user]})
- .to_return(:body => fixture('user_get.json'))
+ stub_request(:get, HealthGraph.endpoint + '/user'
+ ).with(:header => {'Authorization' => 'Bearer ' + TEST_USER_TOKEN, 'Accept' => HealthGraph.accept_headers[:user]}
+ ).to_return(:body => fixture('user_get.json'))
end
should "make request to api" do
View
12 test/health_graph/test_weight_feed.rb
@@ -3,13 +3,13 @@
class TestWeightFeed < Test::Unit::TestCase
context "weight" do
setup do
- stub_request(:get, HealthGraph.endpoint + '/user')
- .with(:header => {'Authorization' => 'Bearer ' + TEST_USER_TOKEN, 'Accept' => HealthGraph.accept_headers[:user]})
- .to_return(:body => fixture('user_get.json'))
+ stub_request(:get, HealthGraph.endpoint + '/user'
+ ).with(:header => {'Authorization' => 'Bearer ' + TEST_USER_TOKEN, 'Accept' => HealthGraph.accept_headers[:user]}
+ ).to_return(:body => fixture('user_get.json'))
- stub_request(:get, HealthGraph.endpoint + '/weight')
- .with(:header => {'Authorization' => 'Bearer ' + TEST_USER_TOKEN, 'Accept' => HealthGraph.accept_headers[:weight_feed]})
- .to_return(:body => fixture('weight_feed_get.json'))
+ stub_request(:get, HealthGraph.endpoint + '/weight'
+ ).with(:header => {'Authorization' => 'Bearer ' + TEST_USER_TOKEN, 'Accept' => HealthGraph.accept_headers[:weight_feed]}
+ ).to_return(:body => fixture('weight_feed_get.json'))
@user = HealthGraph::User.new(TEST_USER_TOKEN)
end
View
12 test/helper.rb
@@ -1,12 +1,6 @@
-require 'rubygems'
-require 'bundler'
-begin
- Bundler.setup(:default, :development)
-rescue Bundler::BundlerError => e
- $stderr.puts e.message
- $stderr.puts "Run `bundle install` to install missing gems"
- exit e.status_code
-end
+require 'simplecov'
+SimpleCov.start
+
require 'test/unit'
require 'shoulda'
require 'webmock/test_unit'

No commit comments for this range

Something went wrong with that request. Please try again.