octopando 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/exe/octopando +5 -0
- data/lib/octopando/cli.rb +48 -0
- data/lib/octopando/jira_client.rb +35 -0
- data/lib/octopando/version.rb +3 -0
- data/lib/octopando.rb +38 -0
- data/octopando.gemspec +29 -0
- metadata +157 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f9a557f77b31d8280c7eb8f437dfdf057f3a117e
|
4
|
+
data.tar.gz: 11417495310b5a280213cee77d22e702b3dc1c19
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 913d9e7645afcb9d1c1cd3a1a6113ed87596f9d55ed9c718a89064e0653801d63e67673696890954e9f02d369a0761e3ace4ea7de5cf1e02501bf05510b95648
|
7
|
+
data.tar.gz: 22fcf8b8df705a717a9db36802799757a7cd12a8fb96cb8777f49ed57f451ae85811c949c099c9195c142c43dd35fa1dd281bfb6c5da16a9d707664e8598bc60
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 defektive
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Octopando
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/octopando`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'octopando'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install octopando
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake false` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. Run `bundle exec octopando` to use the gem in this directory, ignoring other installed copies of this gem.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/octopando.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "octopando"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/exe/octopando
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
module Octopando
|
2
|
+
class CLI < Thor
|
3
|
+
package_name "Octopando"
|
4
|
+
|
5
|
+
desc "start", "Start some work"
|
6
|
+
def start
|
7
|
+
Octopando.jira.my_issues.each_with_index do |issue, index|
|
8
|
+
puts %Q{#{index+1} #{issue.key} - #{issue.summary}}
|
9
|
+
end
|
10
|
+
|
11
|
+
ticket_item = ask ("Select a ticket") { |q| q.echo = true }
|
12
|
+
Octopando.jira.my_issues[ticket_item.to_i - 1].checkout
|
13
|
+
end
|
14
|
+
|
15
|
+
desc "prepare_commit_msg", "used for git hook"
|
16
|
+
def prepare_commit_msg(message_file)
|
17
|
+
temp_message_file = "#{message_file}.tmp"
|
18
|
+
|
19
|
+
git_branch = `git rev-parse --abbrev-ref HEAD`
|
20
|
+
parsed_branch = git_branch.match /(?<type>[^\/]+)\/?(?<ticket>[A-Z]+-[0-9]+)/
|
21
|
+
return unless parsed_branch
|
22
|
+
commit_type = parsed_branch[:type]
|
23
|
+
ticket_number = parsed_branch[:ticket]
|
24
|
+
|
25
|
+
issue = Octopando.jira.Issue.find(ticket_number)
|
26
|
+
|
27
|
+
message_template = []
|
28
|
+
|
29
|
+
message_template << issue.summary if commit_type == 'issue'
|
30
|
+
message_template << ''
|
31
|
+
message_template << WordWrap.ww(issue.description, 72)
|
32
|
+
message_template << ''
|
33
|
+
message_template << "Ref: #{ticket_number}"
|
34
|
+
message_template << "# <https://instructure.atlassian.net/browse/#{ticket_number}>"
|
35
|
+
message_template << ''
|
36
|
+
message_template << 'Test Plan: '
|
37
|
+
message_template << 'You do have a test plan, right?'
|
38
|
+
|
39
|
+
File.open(temp_message_file, 'w') do |file|
|
40
|
+
file << message_template.join("\n")
|
41
|
+
file << "\n"
|
42
|
+
file << File.read(message_file)
|
43
|
+
end
|
44
|
+
|
45
|
+
File.rename(temp_message_file, message_file)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Octopando
|
2
|
+
class JiraClient < JIRA::Client
|
3
|
+
DOMAIN = 'instructure.atlassian.net'
|
4
|
+
|
5
|
+
def inspect
|
6
|
+
"<Octopando::Jira::Client site: #{options[:site]}>"
|
7
|
+
end
|
8
|
+
|
9
|
+
def my_issues
|
10
|
+
@my_issues ||= (
|
11
|
+
my_issues_jql = "assignee = currentUser() AND resolution = Unresolved ORDER BY updatedDate DESC"
|
12
|
+
issues = JIRA::Resource::Issue.jql(self, my_issues_jql)
|
13
|
+
issues
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.from_keychain
|
18
|
+
@keychain_client ||= (
|
19
|
+
keychain_item = Keychain.default.internet_passwords.where(server: DOMAIN).first
|
20
|
+
self.from_keychain_item(keychain_item)
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.from_keychain_item(keychain_item)
|
25
|
+
options = {
|
26
|
+
:username => keychain_item.account,
|
27
|
+
:password => keychain_item.password,
|
28
|
+
:site => "https://#{DOMAIN}",
|
29
|
+
:context_path => '',
|
30
|
+
:auth_type => :basic
|
31
|
+
}
|
32
|
+
self.new(options)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/octopando.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require "octopando/version"
|
2
|
+
require 'git'
|
3
|
+
require 'jira'
|
4
|
+
require 'keychain'
|
5
|
+
require 'thor'
|
6
|
+
require 'word_wrap'
|
7
|
+
|
8
|
+
module Octopando
|
9
|
+
|
10
|
+
def self.git
|
11
|
+
@git ||= Git.open(Dir.pwd)
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.jira
|
15
|
+
@jira ||= JiraClient.from_keychain
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
require "octopando/cli"
|
20
|
+
require "octopando/jira_client"
|
21
|
+
|
22
|
+
|
23
|
+
JIRA::Resource::Issue.class_eval do
|
24
|
+
|
25
|
+
def has_branch?
|
26
|
+
branch != nil
|
27
|
+
end
|
28
|
+
|
29
|
+
def branch
|
30
|
+
Octopando.git.branches.local.select do |git_branch|
|
31
|
+
git_branch.name[/#{self.key}$/]
|
32
|
+
end.first
|
33
|
+
end
|
34
|
+
|
35
|
+
def checkout(type='issue')
|
36
|
+
Octopando.git.branch("#{type}/#{self.key}").checkout
|
37
|
+
end
|
38
|
+
end
|
data/octopando.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'octopando/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "octopando"
|
8
|
+
spec.version = Octopando::VERSION
|
9
|
+
spec.authors = ["defektive"]
|
10
|
+
spec.email = ["sirbradleyd@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Makes your life easier}
|
13
|
+
spec.homepage = "https://github.com/defektive/octopando"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "git", "~> 1.2"
|
22
|
+
spec.add_dependency "jira-ruby", "~> 0.1"
|
23
|
+
spec.add_dependency "ruby-keychain", "~> 0.2"
|
24
|
+
spec.add_dependency "thor", "~> 0.19"
|
25
|
+
spec.add_dependency "word_wrap", "~> 1.0"
|
26
|
+
|
27
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
28
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,157 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: octopando
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- defektive
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-06-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: git
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: jira-ruby
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: ruby-keychain
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.2'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: thor
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.19'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.19'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: word_wrap
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: bundler
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.10'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.10'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '10.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '10.0'
|
111
|
+
description:
|
112
|
+
email:
|
113
|
+
- sirbradleyd@gmail.com
|
114
|
+
executables:
|
115
|
+
- octopando
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- ".gitignore"
|
120
|
+
- ".travis.yml"
|
121
|
+
- Gemfile
|
122
|
+
- LICENSE.txt
|
123
|
+
- README.md
|
124
|
+
- Rakefile
|
125
|
+
- bin/console
|
126
|
+
- bin/setup
|
127
|
+
- exe/octopando
|
128
|
+
- lib/octopando.rb
|
129
|
+
- lib/octopando/cli.rb
|
130
|
+
- lib/octopando/jira_client.rb
|
131
|
+
- lib/octopando/version.rb
|
132
|
+
- octopando.gemspec
|
133
|
+
homepage: https://github.com/defektive/octopando
|
134
|
+
licenses:
|
135
|
+
- MIT
|
136
|
+
metadata: {}
|
137
|
+
post_install_message:
|
138
|
+
rdoc_options: []
|
139
|
+
require_paths:
|
140
|
+
- lib
|
141
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - ">="
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '0'
|
151
|
+
requirements: []
|
152
|
+
rubyforge_project:
|
153
|
+
rubygems_version: 2.2.2
|
154
|
+
signing_key:
|
155
|
+
specification_version: 4
|
156
|
+
summary: Makes your life easier
|
157
|
+
test_files: []
|