sleeping-wolf 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +6 -0
- data/README.md +38 -0
- data/Rakefile +3 -0
- data/bin/sleeping-wolf +14 -0
- data/lib/sleeping-wolf.rb +83 -0
- metadata +99 -0
data/LICENSE
ADDED
data/README.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
I like gh-issues, and its ability to allow other users to easily comment on my project. I also like ticgit, and the fact that I have integral parts of my project with me, even if github is unavailable. So, I want to use both!
|
2
|
+
|
3
|
+
Since we'll be making commits on behalf of other users, it won't be perfect. But hey, let's see what we can do.
|
4
|
+
|
5
|
+
# Requirements
|
6
|
+
|
7
|
+
Scott Chacon's ticgit hasn't been updated in some time (and doesn't work with
|
8
|
+
Ruby 1.9), so you'll probably need to install from one of [the forks][1]. I used
|
9
|
+
[jeffWelling][2]'s.
|
10
|
+
|
11
|
+
ticgit currently requires ruby/git, which is deprecated in favor of grit. Until
|
12
|
+
someone fixes that, you'll need a version of ruby/git that works with ruby 1.9.
|
13
|
+
[I'm attempting][4] to maintain one. Be aware that it currently requires jeweler
|
14
|
+
to build the gem, and jeweler requires ruby/git, so you'll be overwriting the
|
15
|
+
version of ruby/git that gets pulled in by gem. *sigh*
|
16
|
+
|
17
|
+
You'll also need [octopi][3]. Until [issue 18][5] gets fixed, you'll want to
|
18
|
+
grab [my fork][6].
|
19
|
+
|
20
|
+
[1]: http://github.com/schacon/ticgit/network
|
21
|
+
[2]: http://github.com/jeffWelling/ticgit/
|
22
|
+
[3]: http://github.com/fcoury/octopi/
|
23
|
+
[4]: http://github.com/xiongchiamiov/ruby-git
|
24
|
+
[5]: http://github.com/fcoury/octopi/issues/#issue/18
|
25
|
+
[6]: http://github.com/xiongchiamiov/octopi
|
26
|
+
|
27
|
+
# On the Name
|
28
|
+
ticgit---gh-issues-synchronizer was just too damn long a name, even if it was descriptive. So, I went looking:
|
29
|
+
|
30
|
+
[Google][10] -> [Wikipedia (Synchronizer)][11] -> [Wikipedia (Synchronization][12] -> [Wikipedia (Data Synchronization)][13] -> [Scholarpedia (Slepian-Wolf coding)][14] -> sleeping wolf
|
31
|
+
|
32
|
+
Plus, I can have an awesomely cute logo, once I find someone to make it!
|
33
|
+
|
34
|
+
[10]: http://www.google.com/search?hl=en&q=synchronizer&aq=f&oq=&aqi=
|
35
|
+
[11]: http://en.wikipedia.org/wiki/Synchronizer
|
36
|
+
[12]: http://en.wikipedia.org/wiki/Synchronization
|
37
|
+
[13]: http://en.wikipedia.org/wiki/Data_synchronization
|
38
|
+
[14]: http://www.scholarpedia.org/article/Slepian-Wolf_coding
|
data/Rakefile
ADDED
data/bin/sleeping-wolf
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby19
|
2
|
+
|
3
|
+
require 'sleeping-wolf'
|
4
|
+
|
5
|
+
user = 'xiongchiamiov'
|
6
|
+
project = 'synchronizer-test'
|
7
|
+
test_repository = '../synchronizer-test'
|
8
|
+
issues = []
|
9
|
+
gh_issues = retrieve_from_gh_issues(user, project)
|
10
|
+
ticgit_issues = retrieve_from_ticgit(test_repository)
|
11
|
+
|
12
|
+
#issues.each { |issue| puts issue }
|
13
|
+
gh_issues.each { |issue| puts issue }
|
14
|
+
ticgit_issues.each { |issue| puts issue }
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'ticgit'
|
2
|
+
require 'octopi'
|
3
|
+
|
4
|
+
class Issue
|
5
|
+
# from ticgit
|
6
|
+
#attr_accessor :id, :name, :title, :state, :milestone, :assigned
|
7
|
+
#attr_accessor :opened, :points
|
8
|
+
#attr_accessor :comments, :tags, :attachments #arrays
|
9
|
+
|
10
|
+
# from octopi
|
11
|
+
#attr_accessor :repository, :user, :updated_at, :votes, :number, :title
|
12
|
+
#attr_accessor :body, :closed_at, :labels, :state, :created_at
|
13
|
+
|
14
|
+
attr_accessor :id # not syncable information
|
15
|
+
attr_accessor :title, :date_opened, :state
|
16
|
+
attr_accessor :comments, :labels # arrays
|
17
|
+
|
18
|
+
def initialize
|
19
|
+
@comments = []
|
20
|
+
@labels = []
|
21
|
+
end
|
22
|
+
|
23
|
+
def to_s
|
24
|
+
s = "#{@title} (#{@state}) -- #{@date_opened.strftime '%Y-%m-%d'}"
|
25
|
+
s << "\n\tlabels: #{@labels.join ', '}"
|
26
|
+
@comments.each {|comment| s << "\n\t#{comment}"}
|
27
|
+
|
28
|
+
return s
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class Comment
|
33
|
+
attr_accessor :text
|
34
|
+
|
35
|
+
def initialize(comment=nil)
|
36
|
+
@text = comment.comment if !comment.nil?
|
37
|
+
end
|
38
|
+
|
39
|
+
def to_s
|
40
|
+
return @text
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def retrieve_from_gh_issues(user, project)
|
45
|
+
issues = []
|
46
|
+
repo = Octopi::Repository.find(:user => user, :name => project)
|
47
|
+
|
48
|
+
repo.all_issues.each do |gh_issue|
|
49
|
+
issue = Issue.new
|
50
|
+
issue.id = gh_issue.number
|
51
|
+
issue.title = gh_issue.title
|
52
|
+
issue.labels = gh_issue.labels
|
53
|
+
issue.date_opened = gh_issue.created_at
|
54
|
+
issue.state = gh_issue.state
|
55
|
+
|
56
|
+
comment = Comment.new
|
57
|
+
comment.text = gh_issue.body
|
58
|
+
issue.comments << comment
|
59
|
+
|
60
|
+
issues << issue
|
61
|
+
end
|
62
|
+
|
63
|
+
return issues
|
64
|
+
end
|
65
|
+
|
66
|
+
def retrieve_from_ticgit(path)
|
67
|
+
issues = []
|
68
|
+
ticgit = TicGit.open(path)
|
69
|
+
|
70
|
+
ticgit.ticket_list.each do |ti_issue|
|
71
|
+
issue = Issue.new
|
72
|
+
issue.id = ti_issue.ticket_id
|
73
|
+
issue.title = ti_issue.title
|
74
|
+
issue.labels = ti_issue.tags
|
75
|
+
issue.date_opened = ti_issue.opened
|
76
|
+
issue.state = ti_issue.state
|
77
|
+
ti_issue.comments.each {|comment| issue.comments << Comment.new(comment)}
|
78
|
+
|
79
|
+
issues << issue
|
80
|
+
end
|
81
|
+
|
82
|
+
return issues
|
83
|
+
end
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sleeping-wolf
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Pearson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-02-12 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: ticgit
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: octopi
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rake
|
37
|
+
type: :development
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "0"
|
44
|
+
version:
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: mg
|
47
|
+
type: :development
|
48
|
+
version_requirement:
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: "0"
|
54
|
+
version:
|
55
|
+
description: A synchronizer for gh-issues and ticgit.
|
56
|
+
email: xiong.chiamiov@gmail.com
|
57
|
+
executables:
|
58
|
+
- sleeping-wolf
|
59
|
+
extensions: []
|
60
|
+
|
61
|
+
extra_rdoc_files:
|
62
|
+
- LICENSE
|
63
|
+
- README.md
|
64
|
+
files:
|
65
|
+
- LICENSE
|
66
|
+
- Rakefile
|
67
|
+
- README.md
|
68
|
+
- bin/sleeping-wolf
|
69
|
+
- lib/sleeping-wolf.rb
|
70
|
+
has_rdoc: "false"
|
71
|
+
homepage: http://github.com/xiongchiamiov/sleeping-wolf/
|
72
|
+
licenses: []
|
73
|
+
|
74
|
+
post_install_message:
|
75
|
+
rdoc_options: []
|
76
|
+
|
77
|
+
require_paths:
|
78
|
+
- lib
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: "0"
|
84
|
+
version:
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: "0"
|
90
|
+
version:
|
91
|
+
requirements: []
|
92
|
+
|
93
|
+
rubyforge_project:
|
94
|
+
rubygems_version: 1.3.5
|
95
|
+
signing_key:
|
96
|
+
specification_version: 3
|
97
|
+
summary: A synchronizer for gh-issues and ticgit.
|
98
|
+
test_files: []
|
99
|
+
|