rummage 0.0.1
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.
- data/.gitignore +3 -0
- data/Gemfile +4 -0
- data/Rakefile +2 -0
- data/lib/rummage.rb +67 -0
- data/lib/rummage/version.rb +3 -0
- data/rummage.gemspec +24 -0
- metadata +100 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
data/lib/rummage.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
module Rummage
|
2
|
+
require 'rubygems'
|
3
|
+
require 'httparty'
|
4
|
+
require 'hashie'
|
5
|
+
require 'uri'
|
6
|
+
|
7
|
+
module Github
|
8
|
+
class Network
|
9
|
+
|
10
|
+
include HTTParty
|
11
|
+
base_uri "github.com"
|
12
|
+
|
13
|
+
# Parsing input string
|
14
|
+
def initialize uri
|
15
|
+
@user, @repo = URI.parse(uri).path.split('/').delete_if(&:empty?)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Get repo network meta
|
19
|
+
# https://github.com/rgrove/sanitize/network_meta
|
20
|
+
def network_meta
|
21
|
+
get( urlize(@user, @repo, "network_meta") )
|
22
|
+
end
|
23
|
+
|
24
|
+
# Get repo network data chunk
|
25
|
+
# https://github.com/rgrove/sanitize/network_data_chunk
|
26
|
+
def network_data_chunk nethash, options = {}
|
27
|
+
get( urlize(@user, @repo, "network_data_chunk"), :query => options.merge(:nethash => nethash) ).commits
|
28
|
+
end
|
29
|
+
|
30
|
+
def draw
|
31
|
+
meta = network_meta
|
32
|
+
users = meta.users
|
33
|
+
commits = network_data_chunk(meta.nethash)
|
34
|
+
|
35
|
+
users.each do |user|
|
36
|
+
user.heads.each do |head|
|
37
|
+
head.commits = []
|
38
|
+
|
39
|
+
commit = commits.select { |e| e.id == head.id }.first
|
40
|
+
|
41
|
+
loop do
|
42
|
+
head.commits.push commit
|
43
|
+
# проверка на head'овость этого коммита в другом своем head'e
|
44
|
+
if !commit.parents.empty? && commit.parents.first[2] == commit.space && !user.heads.map(&:id).include?(commit.parents.first[0])
|
45
|
+
commit = commits.select { |e| e.id == commit.parents.first[0] }.first
|
46
|
+
else
|
47
|
+
break
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
users
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
def urlize *args
|
58
|
+
args.unshift("").join('/')
|
59
|
+
end
|
60
|
+
|
61
|
+
def get path, options = {}
|
62
|
+
Hashie::Mash.new(self.class.get(path, options))
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
data/rummage.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "rummage/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "rummage"
|
7
|
+
s.version = Rummage::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Andrey Ognevsky"]
|
10
|
+
s.email = ["a.ognevsky@gmail.com"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{Explore Github forks with pleasure}
|
13
|
+
s.description = %q{Allows to search commits in different forks on Github}
|
14
|
+
|
15
|
+
s.rubyforge_project = "rummage"
|
16
|
+
|
17
|
+
s.add_dependency('httparty')
|
18
|
+
s.add_dependency('hashie')
|
19
|
+
|
20
|
+
s.files = `git ls-files`.split("\n")
|
21
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
22
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
23
|
+
s.require_paths = ["lib"]
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rummage
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Andrey Ognevsky
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-01-24 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: httparty
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: hashie
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id002
|
49
|
+
description: Allows to search commits in different forks on Github
|
50
|
+
email:
|
51
|
+
- a.ognevsky@gmail.com
|
52
|
+
executables: []
|
53
|
+
|
54
|
+
extensions: []
|
55
|
+
|
56
|
+
extra_rdoc_files: []
|
57
|
+
|
58
|
+
files:
|
59
|
+
- .gitignore
|
60
|
+
- Gemfile
|
61
|
+
- Rakefile
|
62
|
+
- lib/rummage.rb
|
63
|
+
- lib/rummage/version.rb
|
64
|
+
- rummage.gemspec
|
65
|
+
has_rdoc: true
|
66
|
+
homepage: ""
|
67
|
+
licenses: []
|
68
|
+
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
|
72
|
+
require_paths:
|
73
|
+
- lib
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
hash: 3
|
80
|
+
segments:
|
81
|
+
- 0
|
82
|
+
version: "0"
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
hash: 3
|
89
|
+
segments:
|
90
|
+
- 0
|
91
|
+
version: "0"
|
92
|
+
requirements: []
|
93
|
+
|
94
|
+
rubyforge_project: rummage
|
95
|
+
rubygems_version: 1.4.1
|
96
|
+
signing_key:
|
97
|
+
specification_version: 3
|
98
|
+
summary: Explore Github forks with pleasure
|
99
|
+
test_files: []
|
100
|
+
|