therapist 0.2.0
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/.document +5 -0
- data/.gitignore +5 -0
- data/LICENSE +20 -0
- data/README.rdoc +52 -0
- data/Rakefile +55 -0
- data/VERSION +1 -0
- data/bin/therapist +9 -0
- data/lib/therapist.rb +134 -0
- data/test/test_helper.rb +10 -0
- data/test/therapist_test.rb +7 -0
- data/therapist.gemspec +60 -0
- metadata +97 -0
data/.document
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Josh Nichols
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
= therapist
|
2
|
+
|
3
|
+
A command line tool for dealing with your (GitHub) issues.
|
4
|
+
|
5
|
+
Install it:
|
6
|
+
|
7
|
+
$ sudo gem install technicalpickles-therapist
|
8
|
+
|
9
|
+
|
10
|
+
It works by guessing groking a git repository to figure out the user and repository on GitHub, and then hitting their API to get the issues. The issues get stashed in .git/issues to avoid constantly hitting the API, and for offline convenience.
|
11
|
+
|
12
|
+
Here's how you might use it:
|
13
|
+
|
14
|
+
$ cd jeweler
|
15
|
+
$ therapist list
|
16
|
+
#1 open: Windows Compatibility
|
17
|
+
#2 open: remove jeweler tasks' dependence on rake i.e. to allow thor to use the tasks
|
18
|
+
#6 open: Project creation failing (adding origin remote)
|
19
|
+
#8 open: rubyforge:release failing because no processor_id or release_id configured for
|
20
|
+
#9 open: rake rubyforge:setup creates duplicate packages
|
21
|
+
#13 open: GitHub Pages - RDoc to Branch
|
22
|
+
#16 open: 'rake release' not idempotent after failure
|
23
|
+
#18 open: RDoc rake task looks for VERSION.yml but plaintext is now default
|
24
|
+
#19 open: Jeweler can not read my ~/.gitconfig
|
25
|
+
#20 open: The Umlaut problem: UTF-8 chars get converted to unicode entities
|
26
|
+
#21 open: generating new project double quotes author and e-mail in Rakefile
|
27
|
+
#22 open: no such file to load -- shoulda (LoadError)
|
28
|
+
#23 open: .gitignore files showing up in s.test_files section of gemspec
|
29
|
+
|
30
|
+
Knowing an issue you want to look in, you can show more details:
|
31
|
+
|
32
|
+
|
33
|
+
$ therapist show 22
|
34
|
+
#22 open: no such file to load -- shoulda (LoadError)
|
35
|
+
|
36
|
+
user : thopre
|
37
|
+
created: Sat Jul 04 06:03:35 -0400 2009
|
38
|
+
updated: Sat Jul 04 06:03:35 -0400 2009
|
39
|
+
votes : 0
|
40
|
+
|
41
|
+
I get these errors when i try to do a 'rake test':
|
42
|
+
|
43
|
+
<snipped for brevity>
|
44
|
+
|
45
|
+
== Limitations
|
46
|
+
|
47
|
+
* Issues only ever get fetchd once. They should get stale after a while, or you should be able to force a download
|
48
|
+
* Was built as a 1 hour spike before Railscamp NE, so no tests yet
|
49
|
+
|
50
|
+
== Copyright
|
51
|
+
|
52
|
+
Copyright (c) 2009 Josh Nichols. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
require 'jeweler'
|
5
|
+
Jeweler::Tasks.new do |gem|
|
6
|
+
gem.name = "therapist"
|
7
|
+
gem.summary = %Q{Helps you deal with your (GitHub) issues}
|
8
|
+
gem.description = %Q{Therapist is a command line tool to help you interact with GitHub issues. Also supports offline viewing of said issues.}
|
9
|
+
gem.email = "josh@technicalpickles.com"
|
10
|
+
gem.homepage = "http://github.com/technicalpickles/therapist"
|
11
|
+
gem.authors = ["Josh Nichols"]
|
12
|
+
gem.add_dependency "thor"
|
13
|
+
gem.add_dependency "git"
|
14
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
|
+
end
|
16
|
+
Jeweler::GemcutterTasks.new
|
17
|
+
|
18
|
+
require 'rake/testtask'
|
19
|
+
Rake::TestTask.new(:test) do |test|
|
20
|
+
test.libs << 'lib' << 'test'
|
21
|
+
test.pattern = 'test/**/*_test.rb'
|
22
|
+
test.verbose = true
|
23
|
+
end
|
24
|
+
|
25
|
+
begin
|
26
|
+
require 'rcov/rcovtask'
|
27
|
+
Rcov::RcovTask.new do |test|
|
28
|
+
test.libs << 'test'
|
29
|
+
test.pattern = 'test/**/*_test.rb'
|
30
|
+
test.verbose = true
|
31
|
+
end
|
32
|
+
rescue LoadError
|
33
|
+
task :rcov do
|
34
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
task :default => :test
|
40
|
+
|
41
|
+
require 'rake/rdoctask'
|
42
|
+
Rake::RDocTask.new do |rdoc|
|
43
|
+
if File.exist?('VERSION.yml')
|
44
|
+
config = YAML.load(File.read('VERSION.yml'))
|
45
|
+
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
46
|
+
else
|
47
|
+
version = ""
|
48
|
+
end
|
49
|
+
|
50
|
+
rdoc.rdoc_dir = 'rdoc'
|
51
|
+
rdoc.title = "therapist #{version}"
|
52
|
+
rdoc.rdoc_files.include('README*')
|
53
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
54
|
+
end
|
55
|
+
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.2.0
|
data/bin/therapist
ADDED
data/lib/therapist.rb
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
require 'git'
|
2
|
+
require 'net/http'
|
3
|
+
require 'thor'
|
4
|
+
require 'yaml'
|
5
|
+
require 'pathname'
|
6
|
+
|
7
|
+
class Therapist < Thor
|
8
|
+
no_tasks do
|
9
|
+
attr_accessor :username, :repository
|
10
|
+
end
|
11
|
+
|
12
|
+
def initialize(args = [], options={}, config={})
|
13
|
+
git = Git.open(Dir.pwd)
|
14
|
+
|
15
|
+
origin_url = git.remote('origin').url
|
16
|
+
origin_url =~ /git@github\.com:(.*)\/(.*)\.git/
|
17
|
+
@username = $1
|
18
|
+
@repository = $2
|
19
|
+
|
20
|
+
@out = $stdout
|
21
|
+
|
22
|
+
super
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
desc "list", "Lists issues for the current repository"
|
27
|
+
def list
|
28
|
+
fetch_issues unless File.exist?(open_issues_file)
|
29
|
+
|
30
|
+
open_issues.each do |issue|
|
31
|
+
@out.puts "##{issue['number'].to_s.ljust 3} #{issue['state'].rjust 6}: #{issue['title']}"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
desc "show NUMBER", "Shows a specific issue for the current repository"
|
36
|
+
def show(number)
|
37
|
+
number.gsub!('#', '')
|
38
|
+
fetch_issue(number) unless issue_file(number).exist?
|
39
|
+
|
40
|
+
issue = YAML.load(issue_file(number).read)['issue']
|
41
|
+
|
42
|
+
@out.puts "##{issue['number']} #{issue['state']}: #{issue['title']}"
|
43
|
+
@out.puts
|
44
|
+
@out.puts "user : #{issue['user']}"
|
45
|
+
@out.puts "created: #{issue['created_at']}"
|
46
|
+
@out.puts "updated: #{issue['updated_at']}"
|
47
|
+
@out.puts "votes : #{issue['votes']}"
|
48
|
+
@out.puts "="*80
|
49
|
+
@out.puts issue['body']
|
50
|
+
|
51
|
+
fetch_issue_comments(number) unless issue_comments_file(number).exist?
|
52
|
+
comments = YAML.load(issue_comments_file(number).read)['comments']
|
53
|
+
|
54
|
+
@out.puts
|
55
|
+
@out.puts "Comments:"
|
56
|
+
comments.each do |comment|
|
57
|
+
@out.puts "="*80
|
58
|
+
@out.puts "#{comment['user']} wrote on #{comment['created_at']}"
|
59
|
+
@out.puts "="*80
|
60
|
+
@out.puts comment['body']
|
61
|
+
@out.puts
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
desc "fetch", "Fetches issues for the current repository"
|
67
|
+
def fetch
|
68
|
+
fetch_issues
|
69
|
+
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
def open_issues
|
74
|
+
YAML.load(open_issues_file.read)['issues']
|
75
|
+
end
|
76
|
+
|
77
|
+
def fetch_issues
|
78
|
+
response = Net::HTTP.get(URI.parse(list_issues_url))
|
79
|
+
|
80
|
+
File.open open_issues_file, "w" do |file|
|
81
|
+
file.write response
|
82
|
+
end
|
83
|
+
|
84
|
+
open_issues.each do |issue|
|
85
|
+
fetch_issue(issue['number'])
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def fetch_issue(number)
|
90
|
+
response = Net::HTTP.get(URI.parse(show_issue_url(number)))
|
91
|
+
|
92
|
+
File.open issue_file(number), "w" do |file|
|
93
|
+
file.write response
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def fetch_issue_comments(number)
|
98
|
+
response = Net::HTTP.get(URI.parse(show_issue_comments_url(number)))
|
99
|
+
File.open issue_comments_file(number), "w" do |file|
|
100
|
+
file.write response
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def issues_dir
|
105
|
+
@issues_dir ||= Pathname.new('.git/issues')
|
106
|
+
@issues_dir.mkdir unless @issues_dir.exist?
|
107
|
+
@issues_dir
|
108
|
+
end
|
109
|
+
|
110
|
+
def show_issue_url(number)
|
111
|
+
"http://github.com/api/v2/yaml/issues/show/#{username}/#{repository}/#{number}"
|
112
|
+
end
|
113
|
+
|
114
|
+
def show_issue_comments_url(number)
|
115
|
+
"http://github.com/api/v2/yaml/issues/comments/#{username}/#{repository}/#{number}"
|
116
|
+
end
|
117
|
+
|
118
|
+
def list_issues_url
|
119
|
+
"http://github.com/api/v2/yaml/issues/list/#{username}/#{repository}/open"
|
120
|
+
end
|
121
|
+
|
122
|
+
def open_issues_file
|
123
|
+
@open_issues_file ||= issues_dir.join('open.yml')
|
124
|
+
end
|
125
|
+
|
126
|
+
def issue_file(number)
|
127
|
+
issues_dir.join("#{number}.yml")
|
128
|
+
end
|
129
|
+
|
130
|
+
def issue_comments_file(number)
|
131
|
+
issues_dir.join("#{number}-comments.yml")
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|
data/test/test_helper.rb
ADDED
data/therapist.gemspec
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{therapist}
|
8
|
+
s.version = "0.2.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Josh Nichols"]
|
12
|
+
s.date = %q{2010-03-12}
|
13
|
+
s.default_executable = %q{therapist}
|
14
|
+
s.description = %q{Therapist is a command line tool to help you interact with GitHub issues. Also supports offline viewing of said issues.}
|
15
|
+
s.email = %q{josh@technicalpickles.com}
|
16
|
+
s.executables = ["therapist"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE",
|
19
|
+
"README.rdoc"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".document",
|
23
|
+
".gitignore",
|
24
|
+
"LICENSE",
|
25
|
+
"README.rdoc",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"bin/therapist",
|
29
|
+
"lib/therapist.rb",
|
30
|
+
"test/test_helper.rb",
|
31
|
+
"test/therapist_test.rb",
|
32
|
+
"therapist.gemspec"
|
33
|
+
]
|
34
|
+
s.homepage = %q{http://github.com/technicalpickles/therapist}
|
35
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
36
|
+
s.require_paths = ["lib"]
|
37
|
+
s.rubygems_version = %q{1.3.6}
|
38
|
+
s.summary = %q{Helps you deal with your (GitHub) issues}
|
39
|
+
s.test_files = [
|
40
|
+
"test/test_helper.rb",
|
41
|
+
"test/therapist_test.rb"
|
42
|
+
]
|
43
|
+
|
44
|
+
if s.respond_to? :specification_version then
|
45
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
46
|
+
s.specification_version = 3
|
47
|
+
|
48
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
49
|
+
s.add_runtime_dependency(%q<thor>, [">= 0"])
|
50
|
+
s.add_runtime_dependency(%q<git>, [">= 0"])
|
51
|
+
else
|
52
|
+
s.add_dependency(%q<thor>, [">= 0"])
|
53
|
+
s.add_dependency(%q<git>, [">= 0"])
|
54
|
+
end
|
55
|
+
else
|
56
|
+
s.add_dependency(%q<thor>, [">= 0"])
|
57
|
+
s.add_dependency(%q<git>, [">= 0"])
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: therapist
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
version: 0.2.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Josh Nichols
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-03-12 00:00:00 -05:00
|
18
|
+
default_executable: therapist
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: thor
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
version: "0"
|
30
|
+
type: :runtime
|
31
|
+
version_requirements: *id001
|
32
|
+
- !ruby/object:Gem::Dependency
|
33
|
+
name: git
|
34
|
+
prerelease: false
|
35
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
segments:
|
40
|
+
- 0
|
41
|
+
version: "0"
|
42
|
+
type: :runtime
|
43
|
+
version_requirements: *id002
|
44
|
+
description: Therapist is a command line tool to help you interact with GitHub issues. Also supports offline viewing of said issues.
|
45
|
+
email: josh@technicalpickles.com
|
46
|
+
executables:
|
47
|
+
- therapist
|
48
|
+
extensions: []
|
49
|
+
|
50
|
+
extra_rdoc_files:
|
51
|
+
- LICENSE
|
52
|
+
- README.rdoc
|
53
|
+
files:
|
54
|
+
- .document
|
55
|
+
- .gitignore
|
56
|
+
- LICENSE
|
57
|
+
- README.rdoc
|
58
|
+
- Rakefile
|
59
|
+
- VERSION
|
60
|
+
- bin/therapist
|
61
|
+
- lib/therapist.rb
|
62
|
+
- test/test_helper.rb
|
63
|
+
- test/therapist_test.rb
|
64
|
+
- therapist.gemspec
|
65
|
+
has_rdoc: true
|
66
|
+
homepage: http://github.com/technicalpickles/therapist
|
67
|
+
licenses: []
|
68
|
+
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options:
|
71
|
+
- --charset=UTF-8
|
72
|
+
require_paths:
|
73
|
+
- lib
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
segments:
|
79
|
+
- 0
|
80
|
+
version: "0"
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
segments:
|
86
|
+
- 0
|
87
|
+
version: "0"
|
88
|
+
requirements: []
|
89
|
+
|
90
|
+
rubyforge_project:
|
91
|
+
rubygems_version: 1.3.6
|
92
|
+
signing_key:
|
93
|
+
specification_version: 3
|
94
|
+
summary: Helps you deal with your (GitHub) issues
|
95
|
+
test_files:
|
96
|
+
- test/test_helper.rb
|
97
|
+
- test/therapist_test.rb
|