technicalpickles-therapist 0.1.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.
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
@@ -0,0 +1,5 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ rdoc
5
+ pkg
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.
@@ -0,0 +1,48 @@
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
+
46
+ == Copyright
47
+
48
+ Copyright (c) 2009 Josh Nichols. See LICENSE for details.
@@ -0,0 +1,60 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "therapist"
8
+ gem.summary = %Q{Helps you deal with your (GitHub) issues}
9
+ gem.description = %Q{Therapist is a command line tool to help you interact with GitHub issues. Also supports offline viewing of said issues.}
10
+ gem.email = "josh@technicalpickles.com"
11
+ gem.homepage = "http://github.com/technicalpickles/therapist"
12
+ gem.authors = ["Josh Nichols"]
13
+ gem.add_dependency "nakajima-nakajima"
14
+ gem.add_dependency "nakajima-optimus-prime"
15
+ gem.add_dependency "git"
16
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
17
+ end
18
+
19
+ rescue LoadError
20
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
21
+ end
22
+
23
+ require 'rake/testtask'
24
+ Rake::TestTask.new(:test) do |test|
25
+ test.libs << 'lib' << 'test'
26
+ test.pattern = 'test/**/*_test.rb'
27
+ test.verbose = true
28
+ end
29
+
30
+ begin
31
+ require 'rcov/rcovtask'
32
+ Rcov::RcovTask.new do |test|
33
+ test.libs << 'test'
34
+ test.pattern = 'test/**/*_test.rb'
35
+ test.verbose = true
36
+ end
37
+ rescue LoadError
38
+ task :rcov do
39
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
40
+ end
41
+ end
42
+
43
+
44
+ task :default => :test
45
+
46
+ require 'rake/rdoctask'
47
+ Rake::RDocTask.new do |rdoc|
48
+ if File.exist?('VERSION.yml')
49
+ config = YAML.load(File.read('VERSION.yml'))
50
+ version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
51
+ else
52
+ version = ""
53
+ end
54
+
55
+ rdoc.rdoc_dir = 'rdoc'
56
+ rdoc.title = "therapist #{version}"
57
+ rdoc.rdoc_files.include('README*')
58
+ rdoc.rdoc_files.include('lib/**/*.rb')
59
+ end
60
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
4
+ require 'therapist'
5
+ require 'optimus_prime'
6
+
7
+ class Therapist::Commands
8
+ include OptimusPrime
9
+
10
+ command :list do
11
+ # Lists issues for the current repository
12
+ #
13
+ # USAGE
14
+ #
15
+ # $ cd path/to/git/repo
16
+ # $ therapist list
17
+ Therapist.new.list
18
+ end
19
+
20
+ command :show do |number|
21
+ # Shows a specific issue for the current repository
22
+ #
23
+ # USAGE
24
+ #
25
+ # $ cd path/to/git/repo
26
+ # $ therapist show <number>
27
+ number.gsub!('#', '')
28
+ Therapist.new.show(number)
29
+ end
30
+ end
31
+
32
+ Therapist::Commands.new
@@ -0,0 +1,90 @@
1
+ require 'git'
2
+ require 'net/http'
3
+
4
+ class Therapist
5
+ attr_accessor :username, :repository
6
+ def initialize()
7
+ git = Git.open(Dir.pwd)
8
+
9
+ origin_url = git.remote('origin').url
10
+ origin_url =~ /git@github\.com:(.*)\/(.*)\.git/
11
+ @username = $1
12
+ @repository = $2
13
+
14
+ @out = $stdout
15
+ end
16
+
17
+
18
+ def list
19
+ fetch_issues unless File.exist?(open_issues_file)
20
+
21
+ open_issues.each do |issue|
22
+ @out.puts "##{issue['number'].to_s.ljust 3} #{issue['state'].rjust 6}: #{issue['title']}"
23
+ end
24
+ end
25
+
26
+ def show(number)
27
+ fetch_issue(number) unless File.exist?(issue_file(number))
28
+
29
+ issue = YAML.load(File.read(issue_file(number)))['issue']
30
+
31
+ @out.puts "##{issue['number']} #{issue['state']}: #{issue['title']}"
32
+ @out.puts
33
+ @out.puts "user : #{issue['user']}"
34
+ @out.puts "created: #{issue['created_at']}"
35
+ @out.puts "updated: #{issue['updated_at']}"
36
+ @out.puts "votes : #{issue['votes']}"
37
+ @out.puts
38
+ @out.puts issue['body']
39
+ end
40
+
41
+ def open_issues
42
+ YAML.load(File.read(open_issues_file))['issues']
43
+ end
44
+
45
+ private
46
+
47
+ def fetch_issues
48
+ FileUtils.mkdir_p(issues_dir)
49
+
50
+ response = Net::HTTP.get(URI.parse(list_issues_url))
51
+
52
+ File.open open_issues_file, "w" do |file|
53
+ file.write response
54
+ end
55
+
56
+ open_issues.each do |issue|
57
+ fetch_issue(issue['issue'])
58
+ end
59
+ end
60
+
61
+ def fetch_issue(number)
62
+ FileUtils.mkdir_p(issues_dir)
63
+ response = Net::HTTP.get(URI.parse(show_issues_url(number)))
64
+
65
+ File.open issue_file(number), "w" do |file|
66
+ file.write response
67
+ end
68
+ end
69
+
70
+ def issues_dir
71
+ '.git/issues'
72
+ end
73
+
74
+ def show_issues_url(number)
75
+ "http://github.com/api/v2/yaml/issues/show/#{username}/#{repository}/#{number}"
76
+ end
77
+
78
+ def list_issues_url
79
+ "http://github.com/api/v2/yaml/issues/list/#{username}/#{repository}/open"
80
+ end
81
+
82
+ def open_issues_file
83
+ "#{issues_dir}/open.yml"
84
+ end
85
+
86
+ def issue_file(number)
87
+ "#{issues_dir}/#{number}.yml"
88
+ end
89
+
90
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'therapist'
8
+
9
+ class Test::Unit::TestCase
10
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class TherapistTest < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: technicalpickles-therapist
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Josh Nichols
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-07-16 00:00:00 -07:00
13
+ default_executable: therapist
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: nakajima-nakajima
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: nakajima-optimus-prime
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: git
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0"
44
+ version:
45
+ description: Therapist is a command line tool to help you interact with GitHub issues. Also supports offline viewing of said issues.
46
+ email: josh@technicalpickles.com
47
+ executables:
48
+ - therapist
49
+ extensions: []
50
+
51
+ extra_rdoc_files:
52
+ - LICENSE
53
+ - README.rdoc
54
+ files:
55
+ - .document
56
+ - .gitignore
57
+ - LICENSE
58
+ - README.rdoc
59
+ - Rakefile
60
+ - VERSION
61
+ - bin/therapist
62
+ - lib/therapist.rb
63
+ - test/test_helper.rb
64
+ - test/therapist_test.rb
65
+ has_rdoc: false
66
+ homepage: http://github.com/technicalpickles/therapist
67
+ post_install_message:
68
+ rdoc_options:
69
+ - --charset=UTF-8
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: "0"
77
+ version:
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: "0"
83
+ version:
84
+ requirements: []
85
+
86
+ rubyforge_project:
87
+ rubygems_version: 1.2.0
88
+ signing_key:
89
+ specification_version: 3
90
+ summary: Helps you deal with your (GitHub) issues
91
+ test_files:
92
+ - test/test_helper.rb
93
+ - test/therapist_test.rb