gissuel 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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 86dc4ddf433f59719b39b7e7d81dd558268760e0
4
+ data.tar.gz: ee232b65e1eb79b9321d1155e19b300ab0077403
5
+ SHA512:
6
+ metadata.gz: 33fa8aa53d6081f8398d199fef6b0d22b40547ad2f85e199e03f73646068486c9a2e727661b511792f10f6a51774567d2f8b6107bab620cc2d2b966967a91a64
7
+ data.tar.gz: 7360b877ca3493b113b464aaf84eeaf489317f10c8b2db8f0c920f9a4fc724baf0f37322b7acac94f39abc79143e50758ac8f82d5c8e1e075c2cb0a9c54d48b1
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ *.swp
2
+ **.gem
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in gissuel.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,51 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ gissuel (0.1.0)
5
+ octokit (~> 4.0)
6
+ require_all (~> 2.0)
7
+ thor (~> 0.20)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ addressable (2.5.2)
13
+ public_suffix (>= 2.0.2, < 4.0)
14
+ diff-lcs (1.3)
15
+ faraday (0.15.3)
16
+ multipart-post (>= 1.2, < 3)
17
+ multipart-post (2.0.0)
18
+ octokit (4.13.0)
19
+ sawyer (~> 0.8.0, >= 0.5.3)
20
+ public_suffix (3.0.3)
21
+ rake (10.5.0)
22
+ require_all (2.0.0)
23
+ rspec (3.8.0)
24
+ rspec-core (~> 3.8.0)
25
+ rspec-expectations (~> 3.8.0)
26
+ rspec-mocks (~> 3.8.0)
27
+ rspec-core (3.8.0)
28
+ rspec-support (~> 3.8.0)
29
+ rspec-expectations (3.8.2)
30
+ diff-lcs (>= 1.2.0, < 2.0)
31
+ rspec-support (~> 3.8.0)
32
+ rspec-mocks (3.8.0)
33
+ diff-lcs (>= 1.2.0, < 2.0)
34
+ rspec-support (~> 3.8.0)
35
+ rspec-support (3.8.0)
36
+ sawyer (0.8.1)
37
+ addressable (>= 2.3.5, < 2.6)
38
+ faraday (~> 0.8, < 1.0)
39
+ thor (0.20.3)
40
+
41
+ PLATFORMS
42
+ ruby
43
+
44
+ DEPENDENCIES
45
+ bundler (~> 1.16)
46
+ gissuel!
47
+ rake (~> 10.0)
48
+ rspec (~> 3.0)
49
+
50
+ BUNDLED WITH
51
+ 1.16.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Milana
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,21 @@
1
+ Gissuel
2
+ -----
3
+
4
+ ## Setup
5
+
6
+ - `gem install gissuel`
7
+ - Create GH token with `repo` access
8
+ `Settings` > `Developer settings` > `Personal access tokens`
9
+ - Export `GITHUB_TOKEN` token to environment
10
+
11
+ ## Usage
12
+
13
+ - Run `gissuel get --label [label] --repo [repo-name]`
14
+
15
+ For example, I added lines similar to the following to my `.zshrc` file
16
+
17
+ ```
18
+ export GITHUB_TOKEN="XXXXXXXXXXXXX"
19
+ gissuel planned semaphoreci/semaphore
20
+ ```
21
+ - Options `--label` and `--repo` are optional
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "gissuel"
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(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/exe/gissuel ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- coding: utf-8 -*-
3
+
4
+ require "thor"
5
+ require "require_all"
6
+ require "octokit"
7
+ require_rel "/../lib"
8
+
9
+ Gissuel::CLI.start(ARGV)
data/gissuel.gemspec ADDED
@@ -0,0 +1,40 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "gissuel/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "gissuel"
8
+ spec.version = Gissuel::VERSION
9
+ spec.authors = ["Milana"]
10
+ spec.email = ["milana.stojadinov@gmail.com"]
11
+
12
+ spec.summary = %q{ #issues #label #repo #me }
13
+ spec.description = %q{ Delivering issues to your terminal }
14
+ spec.homepage = "https://github.com/mimimalizam/gissuel"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against " \
23
+ "public gem pushes."
24
+ end
25
+
26
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
+ f.match(%r{^(test|spec|features)/})
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ spec.add_development_dependency "bundler", "~> 1.16"
34
+ spec.add_development_dependency "rake", "~> 10.0"
35
+ spec.add_development_dependency "rspec", "~> 3.0"
36
+
37
+ spec.add_dependency "octokit", "~> 4.0"
38
+ spec.add_dependency "thor", "~> 0.20"
39
+ spec.add_dependency "require_all", "~> 2.0"
40
+ end
@@ -0,0 +1,35 @@
1
+ module Gissuel
2
+
3
+ class CLI < Thor
4
+ attr_reader :label, :repo
5
+
6
+ desc "get", "will print out list of issues assigned to you"
7
+
8
+ long_desc <<-LONGDESC
9
+ Searches for issues assigned to you.
10
+ It respects --label and --repo when specified
11
+ Prints these in your terminal.
12
+ Make sure to export GITHUB_TOKEN variable to environment.\n
13
+
14
+ Example: \n
15
+ > $ gissuel get --label planned --repo semaphoreci/semaphore
16
+ LONGDESC
17
+
18
+ option :label
19
+ option :repo
20
+ def get
21
+ @label = options[:label]
22
+ @repo = options[:repo]
23
+
24
+ Gissuel::Issues.new(label, repo).publish
25
+ end
26
+
27
+ desc "version", "Prints the haskii version info"
28
+ def version
29
+ puts "Gissuel version #{Gissuel::VERSION}"
30
+ end
31
+ map %w(-v --version) => :version
32
+
33
+ end
34
+
35
+ end
@@ -0,0 +1,65 @@
1
+ module Gissuel
2
+ class Issues
3
+
4
+ TOKEN = ENV["GITHUB_TOKEN"]
5
+
6
+ def initialize(label, repo)
7
+ @label = label
8
+ @repo = repo
9
+ @state = "open"
10
+ end
11
+
12
+ def publish
13
+ handle_gh_response(assigned_issues)
14
+ end
15
+
16
+ private
17
+
18
+ def client
19
+ @connection ||= Octokit::Client.new(:access_token => TOKEN,
20
+ :auto_paginate => true)
21
+ end
22
+
23
+ def my_login
24
+ client.user.login
25
+ end
26
+
27
+ def assigned_issues
28
+ client.list_issues(
29
+ @repo,
30
+ options = {
31
+ :assignee => my_login,
32
+ :labels => @label,
33
+ :state => @state
34
+ }
35
+ )
36
+ end
37
+
38
+ def handle_gh_response(issues)
39
+ case issues.count
40
+ when 0
41
+ Gissuel::Log.new("\nGissuel: 👋 ☕ ☺️").grey
42
+ when 1
43
+ Gissuel::Log.new("👋 there is one issue on your 🍽️.").red
44
+ Gissuel::Log.new("☕ here is quick look at it:\n").grey
45
+
46
+ report_issue(issues[0])
47
+ else
48
+ Gissuel::Log.new("👋 there are #{issues.count} issues on your 🍽️.").red
49
+ Gissuel::Log.new("☕ here is quick look at these:\n").grey
50
+
51
+ issues.each do |i|
52
+ report_issue(i)
53
+ end
54
+ end
55
+ end
56
+
57
+ def report_issue(issue)
58
+ Gissuel::Log.new("TITLE: #{issue.title}").yellow
59
+ Gissuel::Log.new("URL: #{issue.html_url}").blue
60
+ Gissuel::Log.new("BODY: #{issue.body}").grey
61
+ Gissuel::Log.new("No of comments: #{issue.comments} | Updated at: #{issue.updated_at}\n").green
62
+ end
63
+
64
+ end
65
+ end
@@ -0,0 +1,33 @@
1
+ module Gissuel
2
+ class Log
3
+
4
+ def initialize(text)
5
+ @text = text
6
+ end
7
+
8
+ def colourize(colour_code)
9
+ "\e[#{colour_code}m#{@text}\e[0m"
10
+ end
11
+
12
+ def red
13
+ puts colourize(31)
14
+ end
15
+
16
+ def green
17
+ puts colourize(32)
18
+ end
19
+
20
+ def yellow
21
+ puts colourize(33)
22
+ end
23
+
24
+ def grey
25
+ puts colourize(37)
26
+ end
27
+
28
+ def blue
29
+ puts colourize(34)
30
+ end
31
+
32
+ end
33
+ end
@@ -0,0 +1,3 @@
1
+ module Gissuel
2
+ VERSION = "0.1.0"
3
+ end
data/lib/gissuel.rb ADDED
@@ -0,0 +1,2 @@
1
+ module Gissuel
2
+ end
Binary file
metadata ADDED
@@ -0,0 +1,146 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gissuel
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Milana
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-11-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: octokit
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '4.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '4.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: thor
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.20'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.20'
83
+ - !ruby/object:Gem::Dependency
84
+ name: require_all
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2.0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '2.0'
97
+ description: " Delivering issues to your terminal "
98
+ email:
99
+ - milana.stojadinov@gmail.com
100
+ executables:
101
+ - gissuel
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - ".gitignore"
106
+ - Gemfile
107
+ - Gemfile.lock
108
+ - LICENSE.txt
109
+ - README.md
110
+ - Rakefile
111
+ - bin/console
112
+ - bin/setup
113
+ - exe/gissuel
114
+ - gissuel.gemspec
115
+ - lib/gissuel.rb
116
+ - lib/gissuel/cli.rb
117
+ - lib/gissuel/issues.rb
118
+ - lib/gissuel/log.rb
119
+ - lib/gissuel/version.rb
120
+ - pkg/gissuel-0.1.0.gem
121
+ homepage: https://github.com/mimimalizam/gissuel
122
+ licenses:
123
+ - MIT
124
+ metadata:
125
+ allowed_push_host: https://rubygems.org
126
+ post_install_message:
127
+ rdoc_options: []
128
+ require_paths:
129
+ - lib
130
+ required_ruby_version: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ required_rubygems_version: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ requirements: []
141
+ rubyforge_project:
142
+ rubygems_version: 2.5.1
143
+ signing_key:
144
+ specification_version: 4
145
+ summary: "#issues #label #repo #me"
146
+ test_files: []