jirify 0.2.2 → 0.2.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 07d9648da98d02b0aea77481668a386b9182bdf777ca242ad61c6e5c7e793602
4
- data.tar.gz: 494f816f3e49f388343949ea025fd615065e895f0f8036801b85f120206197d0
3
+ metadata.gz: 0620a5caff8ce1ff95efd9542e4e16e9d8a44e934292cb46bfc8cea1aeb2b1c1
4
+ data.tar.gz: db06a83b292bd626f059265e8ae24a070a3ef12da70f6a296950c97a946e562c
5
5
  SHA512:
6
- metadata.gz: 6bff2d97e9fe24848423aa4b3f4108e53bba6953603a04b3fe703c9aeba4ccec242a0f3d5308d3889b7efae71cecc2a119ba3003c186d78b663ec55a6ec4738a
7
- data.tar.gz: 71c8810f34cd135794a64a492b0510d8a220e7ef9868e3abde4c1a601129c43e66182fbb17a0ad899baabae186a450d3cc11fdb2c43e69fbe91c35de5c2933c9
6
+ metadata.gz: 16578ee5a6a2594cd1ad04bb4ff5fa70197324dd0e30db842705913ba74385188d59e5b5a902769387943648acbe5930028e2894144216575c8c510dea9d47f1
7
+ data.tar.gz: d7c03119e00de00ac4899b11249dadc2dce0662babba1d5de7f053a965f3b4beec222fd3c31fad26eb668281ee49ad9caef0e50270e7a97259db3917690d162c
data/README.md CHANGED
@@ -27,7 +27,8 @@ options:
27
27
  username: <atlassian username (email)>
28
28
  token: <token generated from https://id.atlassian.com>
29
29
  site: <JIRA url>
30
- project: <JIRA project key>
30
+ projects:
31
+ - <JIRA project key>
31
32
  filter_by_labels:
32
33
  - <label to filter by when displaying sprint>
33
34
  verbose: <force jirify to always be verbose>
@@ -28,7 +28,8 @@ _jirify_completions() {
28
28
 
29
29
  top_level_commands="help issues projects setup sprint version"
30
30
  projects_commands="help list"
31
- setup_commands="help init bash_completion verbose"
31
+ setup_commands="help init bash_completion projects verbose"
32
+ sprint_commands="help show"
32
33
  issues_commands="help assignee block close describe mine open review start status take todo transition transitions unassign unblock"
33
34
 
34
35
  _compgen_issue_keys() {
@@ -49,6 +50,10 @@ _jirify_completions() {
49
50
  COMPREPLY=($(compgen -W "${setup_commands}" -- ${current}))
50
51
  }
51
52
 
53
+ _compgen_sprint() {
54
+ COMPREPLY=($(compgen -W "${sprint_commands}" -- ${current}))
55
+ }
56
+
52
57
  _compgen_issues() {
53
58
  COMPREPLY=($(compgen -W "${issues_commands}" -- ${current}))
54
59
  }
@@ -74,6 +79,10 @@ _jirify_completions() {
74
79
  _compgen_setup
75
80
  return 0
76
81
  ;;
82
+ s|sprint)
83
+ _compgen_sprint
84
+ return 0
85
+ ;;
77
86
  i|issues)
78
87
  _compgen_issues
79
88
  return 0
@@ -95,6 +104,10 @@ _jirify_completions() {
95
104
  _compgen_setup
96
105
  return 0
97
106
  ;;
107
+ s|sprint)
108
+ _compgen_sprint
109
+ return 0
110
+ ;;
98
111
  i|issues)
99
112
  _compgen_issues
100
113
  return 0
@@ -38,6 +38,12 @@ module Jirify
38
38
  desc 'setup [SUBCOMMAND]', 'Jirify setup tools'
39
39
  subcommand 'setup', Subcommands::Setup
40
40
 
41
+ desc 's [SUBCOMMAND]', 'Alias for <jira sprint>'
42
+ subcommand 's', Subcommands::Sprint
43
+
44
+ desc 'sprint [SUBCOMMAND]', 'Work with JIRA Sprints'
45
+ subcommand 'sprint', Subcommands::Sprint
46
+
41
47
  desc 'i [SUBCOMMAND]', 'Alias for <jira issues>'
42
48
  subcommand 'i', Subcommands::Issues
43
49
 
@@ -15,17 +15,23 @@ module Jirify
15
15
  username = ask 'Enter username:'
16
16
  token = ask 'Enter token (generate from https://id.atlassian.com):'
17
17
  site = ask 'Enter JIRA url:'
18
- project = ask 'Enter JIRA Project key:'
18
+ project = ask 'Enter a comma-separated list of JIRA Project keys to filter by every time (1 required):'
19
19
  filter_labels = ask 'Enter a comma-separated list of labels to filter by every time (optional):'
20
20
 
21
21
  labels = filter_labels.split ', ' if filter_labels
22
+ projects = project.split ', ' if project
23
+
24
+ if projects.nil? or projects.empty?
25
+ say "You must enter at least one project key!".red
26
+ exit(0)
27
+ end
22
28
 
23
29
  options = {
24
30
  'options' => {
25
31
  'username' => username,
26
32
  'token' => token,
27
33
  'site' => site,
28
- 'project' => project
34
+ 'projects' => projects
29
35
  }
30
36
  }
31
37
 
@@ -50,6 +56,25 @@ module Jirify
50
56
 
51
57
  say 'Done! You have to source the file again or open a new shell! :)'.green
52
58
  end
59
+
60
+ desc 'projects', 'Set projects to query'
61
+ method_option :set, type: :array, aliases: '-s', desc: 'List of projects'
62
+ def projects
63
+ if options[:set].nil? || options[:set].empty?
64
+ say 'Pass a list of projects to set with -s. Run "jira setup help projects" for more information.'.red
65
+ exit(0)
66
+ end
67
+
68
+ Config.projects = options[:set]
69
+ end
70
+
71
+ desc 'bash_completion', 'Update your bash_completion file when a new version comes out'
72
+ def bash_completion
73
+ say "Updating #{Config.config_folder}/jirify.bash_completion.sh ...".blue
74
+ Config.copy_bash_completion!
75
+
76
+ say 'Done! You have to source the file again or open a new shell! :)'.green
77
+ end
53
78
  end
54
79
  end
55
80
  end
@@ -1,26 +1,30 @@
1
1
  module Jirify
2
- class CLI < Thor
3
- desc 'sprint', 'Show the current sprint table'
4
- method_option :mine, type: :boolean, aliases: '-m', desc: 'Show only issues assigned to me'
5
- method_option :all_columns, type: :boolean, aliases: '-c', default: true, desc: 'Show all columns'
6
- method_option :assignee, type: :boolean, aliases: '-a', desc: 'Show issue assignee'
7
- method_option :summary, type: :boolean, aliases: '-s', desc: 'Show issue summary'
8
- method_option :url, type: :boolean, aliases: '-u', desc: 'Show issue url'
9
- def sprint
10
- verbose = Config.always_verbose || options[:verbose]
11
- issues = Models::Sprint.issues_in_current_sprint(options[:mine])
2
+ module Subcommands
3
+ class Sprint < Thor
4
+ default_task :show
12
5
 
13
- modified_options = options.dup
14
- if verbose
15
- modified_options[:assignee] = true
16
- modified_options[:url] = true
17
- modified_options[:summary] = true
18
- end
6
+ desc 'show', 'Show the current sprint table'
7
+ method_option :mine, type: :boolean, aliases: '-m', desc: 'Show only issues assigned to me'
8
+ method_option :all_columns, type: :boolean, aliases: '-c', default: true, desc: 'Show all columns'
9
+ method_option :assignee, type: :boolean, aliases: '-a', desc: 'Show issue assignee'
10
+ method_option :summary, type: :boolean, aliases: '-s', desc: 'Show issue summary'
11
+ method_option :url, type: :boolean, aliases: '-u', desc: 'Show issue url'
12
+ def show
13
+ verbose = Config.always_verbose || options[:verbose]
14
+ issues = Models::Sprint.issues_in_current_sprint(options[:mine])
15
+
16
+ modified_options = options.dup
17
+ if verbose
18
+ modified_options[:assignee] = true
19
+ modified_options[:url] = true
20
+ modified_options[:summary] = true
21
+ end
19
22
 
20
- say UI::SprintTable.new(issues).to_table(modified_options)
21
- rescue UI::WindowTooNarrow
22
- say ColorizedString['ERROR: Your terminal window is too narrow to print the sprint table!']
23
- .white.on_red.bold
23
+ say UI::SprintTable.new(issues).to_table(modified_options)
24
+ rescue UI::WindowTooNarrow
25
+ say ColorizedString['ERROR: Your terminal window is too narrow to print the sprint table!']
26
+ .white.on_red.bold
27
+ end
24
28
  end
25
29
  end
26
30
  end
@@ -38,6 +38,17 @@ module Jirify
38
38
  File.write(config_file, config.to_yaml)
39
39
  end
40
40
 
41
+ def projects=(value)
42
+ unless initialized?
43
+ puts ColorizedString['ERROR: You must initialize Jirify first!'].white.on_red.bold
44
+ exit(0)
45
+ end
46
+
47
+ config = YAML.load_file(config_file)
48
+ config['options']['projects'] = value
49
+ write(config)
50
+ end
51
+
41
52
  def verbose=(value)
42
53
  unless initialized?
43
54
  puts ColorizedString['ERROR: You must initialize Jirify first!'].white.on_red.bold
@@ -70,6 +81,10 @@ module Jirify
70
81
  options['username']
71
82
  end
72
83
 
84
+ def projects
85
+ options['projects']
86
+ end
87
+
73
88
  def issue_browse_url
74
89
  "#{atlassian_url}/browse/"
75
90
  end
@@ -21,10 +21,6 @@ module Jirify
21
21
  def client
22
22
  @client ||= JIRA::Client.new(Config.client_options)
23
23
  end
24
-
25
- def project
26
- @project ||= Config.options['project']
27
- end
28
24
  end
29
25
  end
30
26
  end
@@ -86,8 +86,9 @@ module Jirify
86
86
  protected
87
87
 
88
88
  def my_issues_jql(all_issues)
89
+ project_clause = "project in (#{Config.projects.join(', ')})"
89
90
  all_clause = 'AND sprint in openSprints()' unless all_issues
90
- "project='#{project}' #{all_clause} AND assignee='#{Config.username}'"
91
+ "#{project_clause} #{all_clause} AND assignee='#{Config.username}'"
91
92
  end
92
93
  end
93
94
  end
@@ -12,12 +12,14 @@ module Jirify
12
12
  def current_sprint_jql(only_mine)
13
13
  labels = Config.options['filter_by_labels']
14
14
  labels = labels.join(', ') if labels
15
+ projects = Config.projects.join(', ')
15
16
 
17
+ projects_clause = "project in (#{projects})"
16
18
  labels_clause = "AND labels in (#{labels})" if labels
17
19
  mine_clause = "AND assignee='#{Config.username}'" if only_mine
18
20
  sprint_clause = 'AND sprint in openSprints()'
19
21
 
20
- "project='#{project}' #{sprint_clause} #{labels_clause} #{mine_clause}"
22
+ "#{projects_clause} #{sprint_clause} #{labels_clause} #{mine_clause}"
21
23
  end
22
24
  end
23
25
  end
@@ -1,3 +1,3 @@
1
1
  module Jirify
2
- VERSION = '0.2.2'.freeze
2
+ VERSION = '0.2.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jirify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Georgi Gardev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-09 00:00:00.000000000 Z
11
+ date: 2019-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -284,7 +284,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
284
284
  version: '0'
285
285
  requirements: []
286
286
  rubyforge_project:
287
- rubygems_version: 2.6.14
287
+ rubygems_version: 3.0.0.beta1
288
288
  signing_key:
289
289
  specification_version: 4
290
290
  summary: JIRA CLI