geet 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cd0635ff3846a704465468c125761bd184c4f028
4
- data.tar.gz: 7090288ba79f44a4029ae3ba7217d89e62246105
3
+ metadata.gz: 8b8ebebddfff4a1580ff80b555e1604ebbbd6844
4
+ data.tar.gz: e14113d4db63b088c94ae74f8c22969b778ffa91
5
5
  SHA512:
6
- metadata.gz: 9ae2941d700748eddf8ae382ca8ee7c53ff1a9fe896b752628ceaf0c244ada04312eadea1da3fc9b4ff571bebe512393a48083dbb47e9477c528043c99a4d155
7
- data.tar.gz: 41ecfe2ea7c10fff999d36403cbccdb9a5b5705b210aadd87f8009d1cc3f7555fe4b9320d9f3fc89a435cb2d101c838e517fb0621fa2ad1e8fe1c7156ce8a898
6
+ metadata.gz: b5b8165f6462cc767cc77d5c3380f825ff7b0c57636d9ae193336a6509a65da2056c66a89bc81e6b5d2b5e7dcba6ee98f2afb055779033330ef64b59b8d9456a
7
+ data.tar.gz: 74f65ee2ed758d85f64647e5c9d69c61069d03b5f96db5c750886e7a364ed3a8feb90417ac6a6e5c193b8fce9105fc9f7700b61e6a17a6c48e9c5746c5bb580f
data/.rubocop.yml CHANGED
@@ -1,17 +1,42 @@
1
1
  inherit_from: .rubocop_todo.yml
2
-
3
2
  AllCops:
4
3
  TargetRubyVersion: 2.3
5
4
 
5
+ Layout/ExtraSpacing:
6
+ Enabled: false
7
+
8
+ Layout/SpaceAroundOperators:
9
+ Enabled: false
10
+
11
+ Metrics/AbcSize:
12
+ Max: 32
13
+
6
14
  Metrics/LineLength:
7
15
  Max: 160
8
16
 
17
+ Metrics/MethodLength:
18
+ Max: 29
19
+
20
+ Metrics/PerceivedComplexity:
21
+ Exclude:
22
+ - 'lib/geet/services/create_issue.rb'
23
+
24
+ Style/Documentation:
25
+ Enabled: false
26
+
9
27
  Style/DoubleNegation:
10
28
  Enabled: false
11
29
 
30
+ Style/GuardClause:
31
+ Exclude:
32
+ - 'lib/geet/git/repository.rb'
33
+
12
34
  Style/NegatedIf:
13
35
  Enabled: false
14
36
 
37
+ Style/Next:
38
+ Enabled: false
39
+
15
40
  Style/TrailingCommaInArguments:
16
41
  Enabled: false
17
42
 
data/.rubocop_todo.yml CHANGED
@@ -1,52 +1,13 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2017-10-17 11:41:36 +0200 using RuboCop version 0.50.0.
3
+ # on 2017-11-02 21:37:33 +0100 using RuboCop version 0.49.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
9
  # Offense count: 1
10
- # Cop supports --auto-correct.
11
- # Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SupportedStylesForEmptyBraces, SpaceBeforeBlockParameters.
12
- # SupportedStyles: space, no_space
13
- # SupportedStylesForEmptyBraces: space, no_space
14
- Layout/SpaceInsideBlockBraces:
15
- Exclude:
16
- - 'Gemfile'
17
-
18
- # Offense count: 3
19
- Metrics/AbcSize:
20
- Max: 31
21
-
22
- # Offense count: 6
23
- # Configuration parameters: CountComments.
24
- Metrics/MethodLength:
25
- Max: 29
26
-
27
- # Offense count: 1
28
- Metrics/PerceivedComplexity:
29
- Max: 8
30
-
31
- # Offense count: 9
32
- Style/Documentation:
33
- Exclude:
34
- - 'spec/**/*'
35
- - 'test/**/*'
36
- - 'lib/geet/git_hub/account.rb'
37
- - 'lib/geet/git_hub/api_helper.rb'
38
- - 'lib/geet/git_hub/issue.rb'
39
- - 'lib/geet/git_hub/pr.rb'
40
- - 'lib/geet/git_hub/remote_repository.rb'
41
- - 'lib/geet/helpers/configuration_helper.rb'
42
- - 'lib/geet/helpers/os_helper.rb'
43
- - 'lib/geet/services/create_issue.rb'
44
- - 'lib/geet/services/create_pr.rb'
45
-
46
- # Offense count: 3
47
- # Cop supports --auto-correct.
48
- # Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
49
- # SupportedStyles: single_quotes, double_quotes
50
- Style/StringLiterals:
51
- Exclude:
52
- - 'Gemfile'
10
+ # Configuration parameters: MinBodyLength.
11
+ # Style/GuardClause:
12
+ # Exclude:
13
+ # - 'lib/geet/git/repository.rb'
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- source "https://rubygems.org"
3
+ source 'https://rubygems.org'
4
4
 
5
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
6
 
7
- gem "simple_scripting", "~> 0.9.3"
7
+ gem 'simple_scripting', '~> 0.9.3'
data/README.md CHANGED
@@ -8,22 +8,32 @@ This tool is very similar to [Hub](https://github.com/github/hub), but it suppor
8
8
 
9
9
  ## Samples
10
10
 
11
- Basic creation of an issue and a PR (both actions will open the pages with the result in the browser):
11
+ ### Create an issue (with label and assignees)
12
12
 
13
- $ geet issue create 'Issue Title' 'Issue Description'
14
-
15
- $ geet pr create 'PR Title' 'Multi-line
16
- >
13
+ Basic creation of an issue (after creation, will open the page in the browser):
14
+
15
+ $ geet issue create 'Issue title' 'Multi
16
+ > line
17
17
  > description'
18
18
 
19
- More advanced issue/PR creation, with label, reviewers and assignees:
19
+ More advanced issue creation, with labels and assignees:
20
20
 
21
- $ geet issue create 'Issue Title' 'Issue Description' --label-patterns bug,wip --assignee-patterns john
22
-
23
- $ geet pr create 'PR Title' 'Closes #1' --label-patterns "code review" --reviewer-patterns kevin,tom,adrian
21
+ $ geet issue create 'Issue title' 'Issue description' --label-patterns bug,wip --assignee-patterns john
24
22
 
25
23
  patterns are partial matches, so, for example, `johncarmack` will be matched as assignee in the first case.
26
24
 
25
+ ### Create a PR (with label, reviewers, and assigned to self)
26
+
27
+ Basic creation of a PR (after creation, will open the page in the browser):
28
+
29
+ $ geet pr create 'PR title' 'Description'
30
+
31
+ More advanced PR creation, with label and reviewers, assigned to self:
32
+
33
+ $ geet pr create 'PR title' 'Closes #1' --label-patterns "code review" --reviewer-patterns kevin,tom,adrian
34
+
35
+ ### List issues/PRs
36
+
27
37
  List the open issues, in default order (inverse creation date):
28
38
 
29
39
  $ geet issue list
@@ -38,6 +48,24 @@ List the open PRs, in default order (inverse creation date):
38
48
  $ geet pr list
39
49
  > 21. Add PRs listing support (https://github.com/saveriomiroddi/geet/pull/21)
40
50
 
41
- For the help:
51
+ ### Create a gist
52
+
53
+ Create a private gist:
54
+
55
+ $ geet gist create /path/to/myfile
56
+
57
+ Create a public gist, with description:
58
+
59
+ $ geet gist create --public /path/to/myfile 'Gist description'
60
+
61
+ ### Help
62
+
63
+ Display the help:
64
+
65
+ $ geet [command [subcommand]]--help
66
+
67
+ Examples:
42
68
 
43
69
  $ geet --help
70
+ $ geet pr --help
71
+ $ geet pr create --help
data/geet.gemspec CHANGED
@@ -1,25 +1,26 @@
1
1
  # encoding: UTF-8
2
+ # frozen_string_literal: true
2
3
 
3
- $LOAD_PATH << File.expand_path("lib", __dir__)
4
+ $LOAD_PATH << File.expand_path('lib', __dir__)
4
5
 
5
- require "geet/version"
6
+ require 'geet/version'
6
7
 
7
8
  Gem::Specification.new do |s|
8
- s.name = "geet"
9
+ s.name = 'geet'
9
10
  s.version = Geet::VERSION
10
11
  s.platform = Gem::Platform::RUBY
11
12
  s.required_ruby_version = '>= 2.2.0'
12
- s.authors = ["Saverio Miroddi"]
13
- s.date = "2017-10-30"
14
- s.email = ["saverio.pub2@gmail.com"]
15
- s.homepage = "https://github.com/saveriomiroddi/geet"
16
- s.summary = "Commandline interface for performing SCM (eg. GitHub) operations (eg. PR creation)."
17
- s.description = "Commandline interface for performing SCM (eg. GitHub) operations (eg. PR creation)."
18
- s.license = "GPL-3.0"
13
+ s.authors = ['Saverio Miroddi']
14
+ s.date = '2017-11-02'
15
+ s.email = ['saverio.pub2@gmail.com']
16
+ s.homepage = 'https://github.com/saveriomiroddi/geet'
17
+ s.summary = 'Commandline interface for performing SCM (eg. GitHub) operations (eg. PR creation).'
18
+ s.description = 'Commandline interface for performing SCM (eg. GitHub) operations (eg. PR creation).'
19
+ s.license = 'GPL-3.0'
19
20
 
20
- s.add_runtime_dependency "simple_scripting", "~> 0.9.3"
21
+ s.add_runtime_dependency 'simple_scripting', '~> 0.9.3'
21
22
 
22
23
  s.files = `git ls-files`.split("\n")
23
- s.executables << "geet"
24
- s.require_paths = ["lib"]
24
+ s.executables << 'geet'
25
+ s.require_paths = ['lib']
25
26
  end
@@ -25,7 +25,7 @@ module Geet
25
25
  include_issue = \
26
26
  filter.nil? ||
27
27
  filter == :pr && issue_data.key?('pull_request') ||
28
- filter == :issue && ! issue_data.key?('pull_request')
28
+ filter == :issue && !issue_data.key?('pull_request')
29
29
 
30
30
  if include_issue
31
31
  number = issue_data.fetch('number')
@@ -16,7 +16,7 @@ module Geet
16
16
  end
17
17
 
18
18
  def api_base_link
19
- "https://api.github.com"
19
+ 'https://api.github.com'
20
20
  end
21
21
 
22
22
  def api_repo_link
@@ -5,8 +5,9 @@ require_relative 'abstract_issue'
5
5
  module Geet
6
6
  module GitHub
7
7
  class Gist
8
- def self.create(repository, filename, content, api_helper, description: nil, publik: false)
8
+ def self.create(filename, content, api_helper, description: nil, publik: false)
9
9
  request_address = "#{api_helper.api_base_link}/gists"
10
+
10
11
  request_data = prepare_request_data(filename, content, description, publik)
11
12
 
12
13
  response = api_helper.send_request(request_address, data: request_data)
@@ -24,21 +25,23 @@ module Geet
24
25
  "https://gist.github.com/#{@id}"
25
26
  end
26
27
 
27
- private
28
+ class << self
29
+ private
28
30
 
29
- def self.prepare_request_data(filename, content, description, publik)
30
- request_data = {
31
- "public" => publik,
32
- "files" => {
33
- filename => {
34
- "content" => content
31
+ def prepare_request_data(filename, content, description, publik)
32
+ request_data = {
33
+ 'public' => publik,
34
+ 'files' => {
35
+ filename => {
36
+ 'content' => content
37
+ }
35
38
  }
36
39
  }
37
- }
38
40
 
39
- request_data['description'] = description if description
41
+ request_data['description'] = description if description
40
42
 
41
- request_data
43
+ request_data
44
+ end
42
45
  end
43
46
  end
44
47
  end
@@ -5,7 +5,7 @@ require_relative 'abstract_issue'
5
5
  module Geet
6
6
  module GitHub
7
7
  class Issue < AbstractIssue
8
- def self.create(repository, title, description, api_helper)
8
+ def self.create(title, description, api_helper)
9
9
  request_address = "#{api_helper.api_repo_link}/issues"
10
10
  request_data = { title: title, body: description, base: 'master' }
11
11
 
@@ -28,11 +28,11 @@ module Geet
28
28
  end
29
29
 
30
30
  def create_gist(filename, content, description: nil, publik: false)
31
- Geet::GitHub::Gist.create(@local_repository, filename, content, @api_helper, description: description, publik: publik)
31
+ Geet::GitHub::Gist.create(filename, content, @api_helper, description: description, publik: publik)
32
32
  end
33
33
 
34
34
  def create_issue(title, description)
35
- Geet::GitHub::Issue.create(@local_repository, title, description, @api_helper)
35
+ Geet::GitHub::Issue.create(title, description, @api_helper)
36
36
  end
37
37
 
38
38
  def list_issues
@@ -20,7 +20,7 @@ module Geet
20
20
  ['-B', '--no-browse', "Don't open the gist link in the browser after creation"],
21
21
  'filename',
22
22
  '[description]'
23
- ]
23
+ ].freeze
24
24
 
25
25
  ISSUE_CREATE_OPTIONS = [
26
26
  ['-n', '--no-open-issue', "Don't open the issue link in the browser after creation"],
@@ -13,11 +13,12 @@ module Geet
13
13
  # :publik: defaults to false
14
14
  # :no_browse defaults to false
15
15
  #
16
- def execute(repository, filename, description: nil, publik: false, no_browse: false)
17
- content = IO.read(filename)
16
+ def execute(repository, full_filename, description: nil, publik: false, no_browse: false)
17
+ content = IO.read(full_filename)
18
18
 
19
19
  puts 'Creating the gist...'
20
20
 
21
+ filename = File.basename(full_filename)
21
22
  gist = repository.create_gist(filename, content, description: description, publik: publik)
22
23
 
23
24
  if no_browse
data/lib/geet/version.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Geet
2
- VERSION = "0.1.5"
4
+ VERSION = '0.1.6'
3
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saverio Miroddi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-30 00:00:00.000000000 Z
11
+ date: 2017-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simple_scripting
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  version: '0'
79
79
  requirements: []
80
80
  rubyforge_project:
81
- rubygems_version: 2.6.13
81
+ rubygems_version: 2.5.2
82
82
  signing_key:
83
83
  specification_version: 4
84
84
  summary: Commandline interface for performing SCM (eg. GitHub) operations (eg. PR