first_github_commit 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ ---
2
+ BUNDLE_DISABLE_SHARED_GEMS: "1"
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use 1.9.2
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source :rubygems
2
+
3
+ gem 'redirect_follower'
4
+
5
+ group :development do
6
+ gem 'jeweler'
7
+ gem 'shoulda', "2.10.3"
8
+ gem 'simplecov'
9
+ end
@@ -0,0 +1,26 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ gemcutter (0.6.1)
5
+ git (1.2.5)
6
+ jeweler (1.4.0)
7
+ gemcutter (>= 0.1.0)
8
+ git (>= 1.2.5)
9
+ rubyforge (>= 2.0.0)
10
+ json_pure (1.4.6)
11
+ redirect_follower (0.1.1)
12
+ rubyforge (2.0.4)
13
+ json_pure (>= 1.1.7)
14
+ shoulda (2.10.3)
15
+ simplecov (0.3.3)
16
+ simplecov-html (>= 0.3.7)
17
+ simplecov-html (0.3.8)
18
+
19
+ PLATFORMS
20
+ ruby
21
+
22
+ DEPENDENCIES
23
+ jeweler
24
+ redirect_follower
25
+ shoulda (= 2.10.3)
26
+ simplecov
@@ -2,6 +2,10 @@
2
2
 
3
3
  Makes finding the very first commit to a GitHub repo very simple:
4
4
 
5
+ gem install first_github_commit
6
+
7
+ Then you can do the following:
8
+
5
9
  require 'first_github_commit'
6
10
  require 'pp'
7
11
  pp FirstGithubCommit.find('thoughtbot', 'shoulda')
@@ -24,13 +28,20 @@ If you also want to know the page number, try this:
24
28
 
25
29
  The page number is being retrieved by first finding the highest non-available page number.
26
30
  Starting from page 100, the limit is being doubled on consecutive requests until the GitHub API
27
- returns a 404. Then, the chunk is split in half and traversed further until the single page is found.
31
+ returns a 404. Then, the chunk is split in half and traversed further until the actual last page is found,
32
+ from which the last commit is being retrieved then.
28
33
 
29
34
  The web request limit is 30 consecutive requests, after which a FirstGithubCommit::TooManyRequests
30
35
  exception will be thrown.
31
36
 
32
37
  Set FirstGithubCommit::DEBUG to true to get some debug output about the requests and the traversal.
33
38
 
39
+ == TODO
40
+
41
+ * Optimize the page retrieval
42
+ * Better error handling
43
+ * Make sure the repo exists before proceeding
44
+
34
45
  == Note on Patches/Pull Requests
35
46
 
36
47
  * Fork the project.
data/Rakefile CHANGED
@@ -11,7 +11,7 @@ begin
11
11
  gem.homepage = "http://github.com/colszowka/first_github_commit"
12
12
  gem.authors = ["Christoph Olszowka"]
13
13
  gem.add_dependency 'redirect_follower', '>= 0.1.1'
14
- gem.add_development_dependency "shoulda", ">= 2.10.2"
14
+ gem.add_development_dependency "shoulda", "2.10.3"
15
15
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
16
  end
17
17
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{first_github_commit}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Christoph Olszowka"]
12
- s.date = %q{2010-06-03}
12
+ s.date = %q{2010-10-12}
13
13
  s.description = %q{Find the first commit for a given github repository and return the API info about it}
14
14
  s.email = %q{christoph at olszowka dot de}
15
15
  s.extra_rdoc_files = [
@@ -17,8 +17,12 @@ Gem::Specification.new do |s|
17
17
  "README.rdoc"
18
18
  ]
19
19
  s.files = [
20
- ".document",
20
+ ".bundle/config",
21
+ ".document",
21
22
  ".gitignore",
23
+ ".rvmrc",
24
+ "Gemfile",
25
+ "Gemfile.lock",
22
26
  "LICENSE",
23
27
  "README.rdoc",
24
28
  "Rakefile",
@@ -33,7 +37,7 @@ Gem::Specification.new do |s|
33
37
  s.homepage = %q{http://github.com/colszowka/first_github_commit}
34
38
  s.rdoc_options = ["--charset=UTF-8"]
35
39
  s.require_paths = ["lib"]
36
- s.rubygems_version = %q{1.3.5}
40
+ s.rubygems_version = %q{1.3.7}
37
41
  s.summary = %q{Find the first commit for a given github repository and return the API info about it}
38
42
  s.test_files = [
39
43
  "test/fast_context.rb",
@@ -46,16 +50,16 @@ Gem::Specification.new do |s|
46
50
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
47
51
  s.specification_version = 3
48
52
 
49
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
53
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
50
54
  s.add_runtime_dependency(%q<redirect_follower>, [">= 0.1.1"])
51
- s.add_development_dependency(%q<shoulda>, [">= 2.10.2"])
55
+ s.add_development_dependency(%q<shoulda>, ["= 2.10.3"])
52
56
  else
53
57
  s.add_dependency(%q<redirect_follower>, [">= 0.1.1"])
54
- s.add_dependency(%q<shoulda>, [">= 2.10.2"])
58
+ s.add_dependency(%q<shoulda>, ["= 2.10.3"])
55
59
  end
56
60
  else
57
61
  s.add_dependency(%q<redirect_follower>, [">= 0.1.1"])
58
- s.add_dependency(%q<shoulda>, [">= 2.10.2"])
62
+ s.add_dependency(%q<shoulda>, ["= 2.10.3"])
59
63
  end
60
64
  end
61
65
 
@@ -1,3 +1,6 @@
1
+ require 'bundler'
2
+ Bundler.setup(:default)
3
+
1
4
  require 'redirect_follower'
2
5
  require 'yaml'
3
6
 
@@ -12,7 +15,7 @@ class FirstGithubCommit
12
15
  def initialize(user, repo)
13
16
  @user, @repo = user, repo
14
17
  @requests_made = 0
15
- @range = (1..100)
18
+ @range = (1..130)
16
19
  find_upper_limit
17
20
  find_page_number
18
21
  end
@@ -1,18 +1,29 @@
1
1
  require 'rubygems'
2
+ require 'bundler'
3
+ Bundler.setup(:default, :development)
4
+ require 'simplecov'
5
+ SimpleCov.start
2
6
  require 'test/unit'
3
7
  require 'shoulda'
8
+ require 'pp'
4
9
 
5
10
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
11
  $LOAD_PATH.unshift(File.dirname(__FILE__))
7
12
  require 'first_github_commit'
8
- require 'test/fast_context'
9
- require 'test/ruby_ext'
13
+ require 'ruby_ext'
14
+
15
+ ResultsCache = {:find => {}, :new => {}}
10
16
 
11
17
  class Test::Unit::TestCase
12
18
 
13
19
  def self.after_finding(user, repo)
14
- fast_context "After finding #{user}/#{repo}" do
15
- setup { @yaml = FirstGithubCommit.find(user, repo) }
20
+ context "After finding #{user}/#{repo}" do
21
+ setup do
22
+ # Be nice, don't fetch results from scratch for every single should...
23
+ unless @yaml = ResultsCache[:find]["#{user}/#{repo}"]
24
+ @yaml = ResultsCache[:find]["#{user}/#{repo}"] = FirstGithubCommit.find(user, repo)
25
+ end
26
+ end
16
27
  subject { @yaml }
17
28
 
18
29
  yield
@@ -20,8 +31,13 @@ class Test::Unit::TestCase
20
31
  end
21
32
 
22
33
  def self.after_initializing_for(user, repo)
23
- fast_context "After initializing for #{user}/#{repo}" do
24
- setup { @commit = FirstGithubCommit.new(user, repo) }
34
+ context "After initializing for #{user}/#{repo}" do
35
+ setup do
36
+ # Be nice, don't fetch results from scratch for every single should...
37
+ unless @commit = ResultsCache[:new]["#{user}/#{repo}"]
38
+ @commit = ResultsCache[:new]["#{user}/#{repo}"] = FirstGithubCommit.new(user, repo)
39
+ end
40
+ end
25
41
  subject { @commit }
26
42
 
27
43
  yield
@@ -1,6 +1,7 @@
1
1
  require 'helper'
2
- require 'pp'
2
+
3
3
  class TestFirstGithubCommit < Test::Unit::TestCase
4
+
4
5
  after_finding 'thoughtbot', 'shoulda' do
5
6
  should_return_a_hash
6
7
  should_have_value 'tsaleh', :at => 'author.name'
@@ -12,7 +13,7 @@ class TestFirstGithubCommit < Test::Unit::TestCase
12
13
  should_return_a_hash
13
14
  should_have_value 'David Heinemeier Hansson', :at => 'author.name'
14
15
  should_have_value 'dhh', :at => "author.login"
15
- should_have_value "2004-11-25T14:07:29-08:00", :at => "committed_date"
16
+ should_have_value "2004-11-23T17:04:44-08:00", :at => "committed_date"
16
17
  end
17
18
 
18
19
  after_finding 'lifo', 'fast_context' do
@@ -29,4 +30,5 @@ class TestFirstGithubCommit < Test::Unit::TestCase
29
30
  assert_equal 'http://github.com/lifo/fast_context/commits/master?page=1', subject.github_url
30
31
  end
31
32
  end
33
+
32
34
  end
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: first_github_commit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 2
9
+ version: 0.1.2
5
10
  platform: ruby
6
11
  authors:
7
12
  - Christoph Olszowka
@@ -9,29 +14,39 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-06-03 00:00:00 +02:00
17
+ date: 2010-10-12 00:00:00 +02:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: redirect_follower
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
20
25
  requirements:
21
26
  - - ">="
22
27
  - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ - 1
31
+ - 1
23
32
  version: 0.1.1
24
- version:
33
+ type: :runtime
34
+ version_requirements: *id001
25
35
  - !ruby/object:Gem::Dependency
26
36
  name: shoulda
27
- type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
30
40
  requirements:
31
- - - ">="
41
+ - - "="
32
42
  - !ruby/object:Gem::Version
33
- version: 2.10.2
34
- version:
43
+ segments:
44
+ - 2
45
+ - 10
46
+ - 3
47
+ version: 2.10.3
48
+ type: :development
49
+ version_requirements: *id002
35
50
  description: Find the first commit for a given github repository and return the API info about it
36
51
  email: christoph at olszowka dot de
37
52
  executables: []
@@ -42,8 +57,12 @@ extra_rdoc_files:
42
57
  - LICENSE
43
58
  - README.rdoc
44
59
  files:
60
+ - .bundle/config
45
61
  - .document
46
62
  - .gitignore
63
+ - .rvmrc
64
+ - Gemfile
65
+ - Gemfile.lock
47
66
  - LICENSE
48
67
  - README.rdoc
49
68
  - Rakefile
@@ -64,21 +83,25 @@ rdoc_options:
64
83
  require_paths:
65
84
  - lib
66
85
  required_ruby_version: !ruby/object:Gem::Requirement
86
+ none: false
67
87
  requirements:
68
88
  - - ">="
69
89
  - !ruby/object:Gem::Version
90
+ segments:
91
+ - 0
70
92
  version: "0"
71
- version:
72
93
  required_rubygems_version: !ruby/object:Gem::Requirement
94
+ none: false
73
95
  requirements:
74
96
  - - ">="
75
97
  - !ruby/object:Gem::Version
98
+ segments:
99
+ - 0
76
100
  version: "0"
77
- version:
78
101
  requirements: []
79
102
 
80
103
  rubyforge_project:
81
- rubygems_version: 1.3.5
104
+ rubygems_version: 1.3.7
82
105
  signing_key:
83
106
  specification_version: 3
84
107
  summary: Find the first commit for a given github repository and return the API info about it