octaccord 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +62 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +3 -0
  5. data/Gemfile +9 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.org +95 -0
  8. data/Rakefile +7 -0
  9. data/bin/octaccord +311 -0
  10. data/examples/Itr0000-template.md.erb +93 -0
  11. data/examples/octaccord-completion.zsh +11 -0
  12. data/lib/extensions.rb +2 -0
  13. data/lib/extensions/octokit.rb +16 -0
  14. data/lib/octaccord.rb +10 -0
  15. data/lib/octaccord/command.rb +16 -0
  16. data/lib/octaccord/command/add_collaborator.rb +34 -0
  17. data/lib/octaccord/command/comments.rb +50 -0
  18. data/lib/octaccord/command/completions.rb +56 -0
  19. data/lib/octaccord/command/create_iteration.rb +21 -0
  20. data/lib/octaccord/command/get_team_members.rb +18 -0
  21. data/lib/octaccord/command/info.rb +18 -0
  22. data/lib/octaccord/command/label.rb +16 -0
  23. data/lib/octaccord/command/scan.rb +122 -0
  24. data/lib/octaccord/command/show.rb +28 -0
  25. data/lib/octaccord/command/update_issues.rb +28 -0
  26. data/lib/octaccord/errors.rb +2 -0
  27. data/lib/octaccord/formatter.rb +105 -0
  28. data/lib/octaccord/formatter/comment.rb +58 -0
  29. data/lib/octaccord/formatter/debug.rb +17 -0
  30. data/lib/octaccord/formatter/issue.rb +134 -0
  31. data/lib/octaccord/formatter/list.rb +36 -0
  32. data/lib/octaccord/formatter/number.rb +14 -0
  33. data/lib/octaccord/formatter/pbl.rb +23 -0
  34. data/lib/octaccord/formatter/table.rb +17 -0
  35. data/lib/octaccord/formatter/text.rb +14 -0
  36. data/lib/octaccord/formatter/user.rb +42 -0
  37. data/lib/octaccord/iteration.rb +61 -0
  38. data/lib/octaccord/version.rb +3 -0
  39. data/octaccord.gemspec +24 -0
  40. data/spec/octaccord_spec.rb +11 -0
  41. data/spec/spec_helper.rb +2 -0
  42. metadata +130 -0
@@ -0,0 +1,17 @@
1
+ module Octaccord
2
+ module Formatter
3
+ class Table < Base
4
+ private
5
+
6
+ def format_header
7
+ "| No. | Status | Title |\n" +
8
+ "| :---- | :------- | :---- |\n"
9
+ end
10
+
11
+ def format_item(issue)
12
+ headline = "|#{issue.link} |#{issue.status} |#{issue.title}|"
13
+ end
14
+
15
+ end # class Table
16
+ end # module Formatter
17
+ end # module Octaccord
@@ -0,0 +1,14 @@
1
+ module Octaccord
2
+ module Formatter
3
+ class Text < Base
4
+ private
5
+
6
+ def format_frame_header ; ""; end
7
+ def format_frame_footer ; ""; end
8
+
9
+ def format_item(issue)
10
+ "* " + issue.summary
11
+ end
12
+ end # class Text
13
+ end # module Formatter
14
+ end # module Octaccord
@@ -0,0 +1,42 @@
1
+ module Octaccord
2
+ module Formatter
3
+ class User
4
+ def initialize(user)
5
+ @resource = user
6
+ end
7
+
8
+ def login
9
+ @resource.login
10
+ end
11
+
12
+ def id
13
+ @resource.id
14
+ end
15
+
16
+ def url
17
+ @resource.html_url
18
+ end
19
+
20
+ def type
21
+ @resource.type
22
+ end
23
+
24
+ def site_admin?
25
+ @resource.site_admin
26
+ end
27
+
28
+ def avatar
29
+ return "![#{@resource.login}](#{@resource.avatar_url}s=20 \"#{@resource.login}\")"
30
+ end
31
+
32
+ def references
33
+ @resource.body.scan(/#(\d+)/).map{|d| d.first.to_i}
34
+ end
35
+
36
+ def link(text: @resource.login)
37
+ return "![#{@resource.login}](#{@resource.html_url})"
38
+ end
39
+
40
+ end # class User
41
+ end # module Formatter
42
+ end # module Octaccord
@@ -0,0 +1,61 @@
1
+ require "time"
2
+
3
+ module Octaccord
4
+ class Iteration
5
+ attr_accessor :name, :start, :due, :manager, :repository
6
+
7
+ def initialize(client: client, name: name, manager: manager, start: start, due: due, team: team, repository: repository)
8
+ if /([^\d]+)(\d+)/ =~ name
9
+ @prefix, @number = $1, $2.to_i
10
+ end
11
+ @manager = manager
12
+ @team = team
13
+ @repository = repository
14
+ @client = client
15
+ self.start = start
16
+ self.due = due
17
+ end
18
+
19
+ def members
20
+ org, team_name = @team.split('/')
21
+ team_id = @client.organization_teams(org).select{|t| t.name == team_name}.first.id
22
+ @client.team_members(team_id).map(&:login)
23
+ end
24
+
25
+ def name(offset = 0)
26
+ @prefix + format("%04d", @number + offset)
27
+ end
28
+
29
+ def start=(time)
30
+ @start = Time.parse(time.to_s)
31
+ end
32
+
33
+ def due=(time)
34
+ @due = Time.parse(time.to_s)
35
+ end
36
+
37
+ # def start_date
38
+ # @start.strftime("%Y-%m-%d")
39
+ # end
40
+
41
+ # def due_date
42
+ # @due.strftime("%Y-%m-%d")
43
+ # end
44
+
45
+ def start
46
+ @start
47
+ end
48
+
49
+ def due
50
+ @due
51
+ end
52
+
53
+ def prev
54
+ self.class.new(name: name(-1), manager: @manager, start: @start, due: @due)
55
+ end
56
+
57
+ def next
58
+ self.class.new(name: name(+1), manager: @manager, start: @start, due: @due)
59
+ end
60
+ end # class Iteration
61
+ end # module Octaccord
@@ -0,0 +1,3 @@
1
+ module Octaccord
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'octaccord/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "octaccord"
8
+ spec.version = Octaccord::VERSION
9
+ spec.authors = ["Nomura Laboratory", "Yoshinari Nomura"]
10
+ spec.email = ["nom@quickhack.net"]
11
+ spec.summary = %q{Issue-manipulation tool for the GitHub.}
12
+ spec.description = %q{Octaccord is a small issue-manipulation tool for GitHub.}
13
+ spec.homepage = "https://github.com/nomlab/octaccord"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec"
24
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe Octaccord do
4
+ it 'has a version number' do
5
+ expect(Octaccord::VERSION).not_to be nil
6
+ end
7
+
8
+ it 'does something useful' do
9
+ expect(false).to eq(true)
10
+ end
11
+ end
@@ -0,0 +1,2 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'octaccord'
metadata ADDED
@@ -0,0 +1,130 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: octaccord
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Nomura Laboratory
8
+ - Yoshinari Nomura
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-07-26 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '1.6'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '1.6'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rake
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rspec
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ description: Octaccord is a small issue-manipulation tool for GitHub.
57
+ email:
58
+ - nom@quickhack.net
59
+ executables:
60
+ - octaccord
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - ".gitignore"
65
+ - ".rspec"
66
+ - ".travis.yml"
67
+ - Gemfile
68
+ - LICENSE.txt
69
+ - README.org
70
+ - Rakefile
71
+ - bin/octaccord
72
+ - examples/Itr0000-template.md.erb
73
+ - examples/octaccord-completion.zsh
74
+ - lib/extensions.rb
75
+ - lib/extensions/octokit.rb
76
+ - lib/octaccord.rb
77
+ - lib/octaccord/command.rb
78
+ - lib/octaccord/command/add_collaborator.rb
79
+ - lib/octaccord/command/comments.rb
80
+ - lib/octaccord/command/completions.rb
81
+ - lib/octaccord/command/create_iteration.rb
82
+ - lib/octaccord/command/get_team_members.rb
83
+ - lib/octaccord/command/info.rb
84
+ - lib/octaccord/command/label.rb
85
+ - lib/octaccord/command/scan.rb
86
+ - lib/octaccord/command/show.rb
87
+ - lib/octaccord/command/update_issues.rb
88
+ - lib/octaccord/errors.rb
89
+ - lib/octaccord/formatter.rb
90
+ - lib/octaccord/formatter/comment.rb
91
+ - lib/octaccord/formatter/debug.rb
92
+ - lib/octaccord/formatter/issue.rb
93
+ - lib/octaccord/formatter/list.rb
94
+ - lib/octaccord/formatter/number.rb
95
+ - lib/octaccord/formatter/pbl.rb
96
+ - lib/octaccord/formatter/table.rb
97
+ - lib/octaccord/formatter/text.rb
98
+ - lib/octaccord/formatter/user.rb
99
+ - lib/octaccord/iteration.rb
100
+ - lib/octaccord/version.rb
101
+ - octaccord.gemspec
102
+ - spec/octaccord_spec.rb
103
+ - spec/spec_helper.rb
104
+ homepage: https://github.com/nomlab/octaccord
105
+ licenses:
106
+ - MIT
107
+ metadata: {}
108
+ post_install_message:
109
+ rdoc_options: []
110
+ require_paths:
111
+ - lib
112
+ required_ruby_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ required_rubygems_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ requirements: []
123
+ rubyforge_project:
124
+ rubygems_version: 2.2.2
125
+ signing_key:
126
+ specification_version: 4
127
+ summary: Issue-manipulation tool for the GitHub.
128
+ test_files:
129
+ - spec/octaccord_spec.rb
130
+ - spec/spec_helper.rb