Skip to content

Commit

Permalink
Added pomo import <user> <project>
Browse files Browse the repository at this point in the history
Imports issues from Github
  • Loading branch information
tj committed Oct 21, 2009
1 parent c29479a commit 607ef85
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 1 deletion.
27 changes: 26 additions & 1 deletion bin/pomo
Expand Up @@ -49,6 +49,31 @@ command :start do |c|
end
end
end

command :import do |c|
c.syntax = 'pomo import <user> <project> [options]'
c.summary = 'Import Github project issues'
c.description = 'Import Github project issues which have not yet been closed'
c.action do |args, options|
begin
require 'octopi'
rescue LoadError
abort 'the octopi gem is required to import issues from Github'
else
user = args.shift or raise('Github <user> is required')
project = args.shift or raise('Github <project> is required')
if repo = Octopi::Repository.find(user, project)
say "Importing items from http://github.com/#{user}/#{project}"
repo.issues.select { |i| not i.closed_at }.each do |issue|
task = Pomo::GithubTask.new issue.title, :username => user, :project => project, :description => issue.body
list << task
say "Added #{task}"
end
list.save
end
end
end
end

command :add do |c|
c.syntax = 'pomo add <task> [options]'
Expand Down Expand Up @@ -148,7 +173,7 @@ command :list do |c|
list.tasks.each_with_index do |task, i|
next if options.complete && !task.complete?
next if options.incomplete && task.complete?
say ' %s %2d. %-35s : %d minutes' % [task.complete? ? '√' : ' ', i, task.to_s, task.length]
say ' %s %2d. %-45s : %d minutes' % [task.complete? ? '√' : ' ', i, task.to_s, task.length]
end
end
end
Expand Down
1 change: 1 addition & 0 deletions lib/pomo.rb
Expand Up @@ -25,4 +25,5 @@
require 'growl'
require 'pomo/list'
require 'pomo/task'
require 'pomo/github_task'
require 'pomo/version'
25 changes: 25 additions & 0 deletions lib/pomo/github_task.rb
@@ -0,0 +1,25 @@

module Pomo
class GithubTask < Task

##
# Username.

attr_reader :username

##
# Project name.

attr_reader :project

##
# Initialize with _name_ and _options_.

def initialize name = nil, options = {}
super
@username = options.delete :username
@project = options.delete :project
end

end
end

0 comments on commit 607ef85

Please sign in to comment.