jirabas 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cdf1af4f547aa28675a50cc4a286d7976da932db
4
+ data.tar.gz: 8fbdb9864d09074a59b6a5527ea19967ef7a9460
5
+ SHA512:
6
+ metadata.gz: 142f4f9e58d10c4c88d73662ef6a03ed4ed73959230e115b1a564b82c842f6379d2ab5eaa8023fb5d47b9beea98f91158ef895e227d203e1463a9f6b640f7472
7
+ data.tar.gz: 37c6f58b49fda77e7f88224dab7397ebde621eb6853d150335e10ab3569d94159f4cda861a9c0de77eb376c39c4dd676822fcc96a7b635ee74f16e485b836ae3
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in jirabas.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Leo
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # jirabas
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'jirabas'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install jirabas
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it ( http://github.com/<my-github-username>/jirabas/fork )
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/jirabas ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'jirabas'
4
+
5
+ puts Jirabas.run *ARGV
data/jirabas.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 'jirabas/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "jirabas"
8
+ spec.version = Jirabas::VERSION
9
+ spec.authors = ['Proffard', "Leo"]
10
+ spec.email = ["leonid.inbox@gmail.com"]
11
+ spec.summary = %q{This helps you know what you're working on right now}
12
+ spec.description = %q{This helps you know what you're working on right now}
13
+ spec.homepage = ""
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_dependency 'jira-ruby'
22
+ spec.add_dependency 'highline'
23
+ spec.add_dependency 'trollop'
24
+ spec.add_dependency 'activesupport'
25
+ spec.add_dependency 'retryable'
26
+
27
+ spec.add_development_dependency 'bundler', "~> 1.5"
28
+ spec.add_development_dependency 'rake'
29
+ end
@@ -0,0 +1,58 @@
1
+ require 'yaml'
2
+
3
+ class Jirabas::Config
4
+ HomePath = File.expand_path '~/.jirabas'
5
+ LocalPath = File.expand_path './.jirabas'
6
+
7
+ class <<self
8
+ def init
9
+ fetch(:username) {HighLine.new.ask('Please enter your username')}
10
+
11
+ fetch(:password) {HighLine.new.ask('Please enter your password') {|h|
12
+ h.echo = false }}
13
+
14
+ fetch(:site) { HighLine.new.ask('Please enter your JIRA url like this: https://jira.com') }
15
+ end
16
+
17
+ OtherDefaults =
18
+ { context_path: '',
19
+ auth_type: :basic,
20
+ use_ssl: true,
21
+ ssl_verify_mode: false }
22
+
23
+
24
+ def home_config
25
+ YAML.load_file(HomePath ).deep_symbolize_keys rescue {} end
26
+
27
+ def local_config
28
+ YAML.load_file(LocalPath).deep_symbolize_keys rescue {} end
29
+
30
+ def all
31
+ OtherDefaults.merge(home_config).merge(local_config) end
32
+
33
+ def fetch key, &blk
34
+ unless block_given?
35
+ all.fetch key
36
+ else
37
+ all.fetch key do
38
+ value = yield
39
+ write key, value
40
+ value
41
+ end
42
+ end
43
+ end
44
+
45
+ def write key, value
46
+ FileUtils.touch(HomePath) unless File.exists? HomePath
47
+ write_config_file HomePath, home_config.merge({key => value})
48
+ end
49
+
50
+ def write_config_file path, hash
51
+ File.open(HomePath, 'r+') { |f| YAML.dump hash.deep_stringify_keys, f }
52
+ end
53
+
54
+ def method_missing key
55
+ fetch key
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,3 @@
1
+ module Jirabas
2
+ VERSION = "0.0.1"
3
+ end
data/lib/jirabas.rb ADDED
@@ -0,0 +1,47 @@
1
+ require "jirabas/version"
2
+ require "jirabas/config"
3
+
4
+ require 'pry'
5
+ require 'jira' # jira-ruby gem
6
+ require 'active_support/core_ext/hash'
7
+ require 'trollop'
8
+ require 'highline'
9
+ #require 'retryable'
10
+
11
+ module Jirabas
12
+
13
+ def self.client
14
+ Config.init
15
+ @client ||= JIRA::Client.new(Config.all)
16
+ end
17
+
18
+ def self.my_in_progress_issues
19
+ client.Issue.jql("assignee = #{Config.username} AND resolution = Unresolved AND status = 'In Progress' ORDER BY updatedDate DESC")
20
+ end
21
+ def self.issues_i_did_recently
22
+ client.Issue.jql("assignee = #{Config.username} AND resolution != Unresolved AND updatedDate > '-2d' ORDER BY updatedDate DESC")
23
+ end
24
+ def self.assigned_to_me
25
+ client.Issue.jql("assignee = #{Config.username} AND resolution = Unresolved ORDER BY updatedDate DESC")
26
+ .map { |e| "#{e.key}: #{e.summary}"}
27
+ end
28
+
29
+ def self.what_am_i_doing
30
+ my_in_progress_issues.map { |e| "#{e.key}: #{e.summary}"}
31
+ end
32
+ def self.what_did_i_do_recently
33
+ issues_i_did_recently.map { |e| "#{e.key}: #{e.summary}"}
34
+ end
35
+
36
+ def self.run *args
37
+ puts "I'm doing:\n"
38
+ puts what_am_i_doing.join("\n").to_s
39
+
40
+ puts "----------\nI did recently:\n"
41
+ puts what_did_i_do_recently.join("\n").to_s
42
+
43
+ puts "----------\nTo do:\n"
44
+ puts assigned_to_me.join("\n").to_s
45
+ end
46
+
47
+ end
metadata ADDED
@@ -0,0 +1,154 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jirabas
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Proffard
8
+ - Leo
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-04-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: jira-ruby
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: highline
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
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: trollop
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: activesupport
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: retryable
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: bundler
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '1.5'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: '1.5'
98
+ - !ruby/object:Gem::Dependency
99
+ name: rake
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ description: This helps you know what you're working on right now
113
+ email:
114
+ - leonid.inbox@gmail.com
115
+ executables:
116
+ - jirabas
117
+ extensions: []
118
+ extra_rdoc_files: []
119
+ files:
120
+ - ".gitignore"
121
+ - Gemfile
122
+ - LICENSE.txt
123
+ - README.md
124
+ - Rakefile
125
+ - bin/jirabas
126
+ - jirabas.gemspec
127
+ - lib/jirabas.rb
128
+ - lib/jirabas/config.rb
129
+ - lib/jirabas/version.rb
130
+ homepage: ''
131
+ licenses:
132
+ - MIT
133
+ metadata: {}
134
+ post_install_message:
135
+ rdoc_options: []
136
+ require_paths:
137
+ - lib
138
+ required_ruby_version: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
143
+ required_rubygems_version: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ requirements: []
149
+ rubyforge_project:
150
+ rubygems_version: 2.2.2
151
+ signing_key:
152
+ specification_version: 4
153
+ summary: This helps you know what you're working on right now
154
+ test_files: []