checklister 1.0.1 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9eb47f6a87c7f66d9be921c83dc8529375e055ee
4
- data.tar.gz: 805ba3f312d823ed0c3920512b9ef7cb5057b75d
3
+ metadata.gz: a10ee14552d5f574d9455926522fe4128f5dda87
4
+ data.tar.gz: 41f7a2c18c119757ee426914d1bf3473c0381166
5
5
  SHA512:
6
- metadata.gz: 868c91ec0980ca21975dfe3c10f641af614a3eaab4a5ff80a4bae9543e54d8b176d464106c62dd2111a9aa3fcbcc098abe9485229fd0caab920c3a31864e9230
7
- data.tar.gz: cde6105e16111617a4ff86cf5abaa45ec3c8757a5ea61e6cb09645d44f2caff8dc1dc59a08086169e6bffebe975c5cbf2da83a3dfed70e4ad400a51a75c38293
6
+ metadata.gz: 360e6a6d27a2d1477ded2233a50886fcc5857d64b08ebdc68e479b76cd16cfcb4618a30642cc2a878785fa86e332ea1110bb0edfe8934fa75cc2c1768a83d8fa
7
+ data.tar.gz: 8f364d968c3276914087c4965fec295106a4a1a901c1f5f7ff6a6c3e4e33167fee7bbaa9be118176795f591f831d5b797c1f4bd84f453c653713422f4e7bebaf
data/.gitignore CHANGED
@@ -11,3 +11,4 @@
11
11
  tags
12
12
  gems.tags
13
13
  .DS_Store
14
+ byebug_history
@@ -0,0 +1 @@
1
+ 2.3.1
@@ -1,8 +1,10 @@
1
+ sudo: false
1
2
  language: ruby
2
- cache: bundler
3
3
  rvm:
4
- - 2.0.0
5
- - 2.1.4
6
- - 2.2.2
7
- before_install: gem install bundler -v 1.10.5
8
- script: 'bundle exec rake'
4
+ - 2.2.5
5
+ - 2.3.1
6
+ before_install:
7
+ - gem install bundler
8
+ cache: bundler
9
+
10
+ script: "bundle exec rake"
data/Gemfile CHANGED
@@ -1,4 +1,3 @@
1
- source 'https://rubygems.org'
2
-
1
+ source "https://rubygems.org"
3
2
  # Specify your gem's dependencies in checklister.gemspec
4
3
  gemspec
data/README.md CHANGED
@@ -49,6 +49,15 @@ Source: http://atulgawande.com/book/the-checklist-manifesto/
49
49
  $ gem install checklister
50
50
  ```
51
51
 
52
+ > NOTE: If you use a ruby manager, the gem have to be installed each time you want to use it in a new ruby context.
53
+
54
+ #### PROTIP
55
+
56
+ If you use rbenv as your ruby manager, and want to easily install/update `checklister` across all your rubies:
57
+
58
+ 1. Install [rbenv-each](https://github.com/rbenv/rbenv-each)
59
+ 1. Run `$ rbenv each gem install checklister` everytime there is a new version of the gem
60
+
52
61
  ### Setup Gitlab Authentication
53
62
 
54
63
  ```bash
@@ -1,9 +1,22 @@
1
1
  #!/usr/bin/env ruby
2
+ # CLI Tools
2
3
  require "gli"
4
+ require "highline"
5
+ # Gem logic entrypoint
3
6
  require "checklister"
4
7
 
5
8
  include GLI::App
6
9
 
10
+ # Highline
11
+ ft = HighLine::ColorScheme.new do |cs|
12
+ cs[:question] = [ :bold, :cyan ]
13
+ cs[:info] = [ :bold, :white ]
14
+ cs[:error] = [ :magenta ]
15
+ end
16
+
17
+ HighLine.color_scheme = ft
18
+ bot = HighLine.new
19
+
7
20
  ISSUE_SERVICES = { "1" => "gitlab", "2" => "github" }.freeze
8
21
 
9
22
  program_desc "gives you the power to transform any markdown file or url checklist into an actionable gitlab and github issue."
@@ -28,20 +41,22 @@ pre do |global_options,command,options,args|
28
41
  config_options = global_options
29
42
  elsif config_file.exist?
30
43
  saved_services = config_file.services
44
+ choice = 0
31
45
  if saved_services.size > 1
32
- puts "* Which Issue Service would you like to use?"
33
- saved_services.each_with_index do |service, index|
34
- line = []
35
- line << "[#{index+1}] #{service[:endpoint]}"
36
- line << "(#{service[:label]})" if service[:label]
37
- puts line.join(" ")
46
+ bot.say "<%= color('Which Issue Service would you like to use?', :question) %>"
47
+ bot.choose do |menu|
48
+ menu.select_by = :index
49
+ # Options
50
+ saved_services.each_with_index do |service, index|
51
+ label = [service[:endpoint]]
52
+ label << "- #{service[:label]}" if service[:label].to_s != ""
53
+ menu.choice(label.join(" ")) { choice = index }
54
+ end
38
55
  end
39
- choice = STDIN.gets.to_i
40
- raise("You need to select a service.") if choice < 1
41
56
  else
42
- choice = 1
57
+ choice = 0
43
58
  end
44
- service_selected = saved_services[choice-1]
59
+ service_selected = saved_services[choice]
45
60
  config_options = service_selected
46
61
  else
47
62
  config_options = {}
@@ -65,51 +80,65 @@ desc "Save your gitlab or github settings for later"
65
80
  command :setup do |c|
66
81
  c.action do |global_options,options,args|
67
82
  data = {}
83
+ choice = nil
68
84
  config_file = Checklister::ConfigurationFile.new(global_options["config"])
69
85
 
70
86
  if global_options[:service]
71
87
  service_selected = global_options[:service]
72
88
  else
73
- puts "* Which Issue Service would you like to setup?"
74
- ISSUE_SERVICES.each do |index, service|
75
- puts "[#{index}] #{service}"
89
+ bot.say "<%= color('Which Issue Service would you like to setup?', :info) %>"
90
+ bot.choose do |menu|
91
+ menu.select_by = :index
92
+ # Options
93
+ ISSUE_SERVICES.each do |index, service|
94
+ menu.choice(service) { choice = index }
95
+ end
76
96
  end
77
- choice = STDIN.gets.to_i
78
- raise("You need to select a service.") if choice < 1
79
97
  service_selected = ISSUE_SERVICES[choice.to_s]
80
98
  end
81
99
  data["kind"] = service_selected
82
100
 
83
- puts ""
84
- puts "* We are going to help you set up the #{service_selected} service"
101
+ bot.say "<%= color('We are going to help you set up the #{service_selected} service', :info) %>"
85
102
 
86
103
  if service_selected == "gitlab"
87
- puts ""
88
- puts "** What is your gitlab endpoint? (Ex: https://gitlab.com/api/v3)"
89
- choice = STDIN.gets.chomp
90
- raise("You need to type a endpoint.") if choice == ""
91
- data["endpoint"] = choice
104
+ # Get the service url
105
+ data["endpoint"] = bot.ask("<%= color('What is your gitlab endpoint? (Ex: https://gitlab.com/api/v3)', :question) %>") do |q|
106
+ q.validate = /https?:\/\/[\S]+/
107
+ end
108
+
109
+ # Configure tls client certificate, if any
110
+ if bot.agree("<%= color('Does your Gitlab server require a client certificate? [y/n]', :question) %>")
111
+ # Set the private certificate path
112
+ data["client_certificate_path"] = bot.ask("<%= color('Please enter the path to your private certificate (the extension should be .p12)', :question) %>") do |q|
113
+ q.validate = /.*\S.*/
114
+ end
115
+
116
+ # Set the endpoint certificate path
117
+ data["endpoint_certificate_path"] = bot.ask("<%= color('Please enter, if any, the path to your ca certificate (the extension should be .crt)', :question) %>") do |q|
118
+ q.validate = /.*\S.*/
119
+ end
120
+
121
+ # Set the private certificate password (not compulsory)
122
+ data["client_certificate_password"] = bot.ask("<%= color('Please enter, if any, your private certificate password', :question) %>") do |q|
123
+ q.echo = "*"
124
+ end
125
+ end
92
126
  elsif service_selected == "github"
93
127
  data["endpoint"] = "https://api.github.com"
94
128
  end
95
129
 
96
- puts ""
97
- puts "** What is your private token with the #{service_selected} service?"
98
- choice = STDIN.gets.chomp
99
- raise("You need to type a private token.") if choice == ""
100
- data["private_token"] = choice
101
-
102
- puts ""
103
- puts "** You can give a label to #{data["endpoint"]} (you can leave it blank too)"
104
- choice = STDIN.gets.chomp
105
- if choice != ""
106
- data["label"] = choice
130
+ # Private token
131
+ data["private_token"] = bot.ask("<%= color('What is your private token with the #{service_selected} service?', :question) %>") do |q|
132
+ q.validate = /.*\S.*/
107
133
  end
108
134
 
135
+ # Label
136
+ data["label"] = bot.ask("<%= color('You can give a label to #{data["endpoint"]} (you can leave it blank too)', :question) %>")
137
+
138
+ # Persist the configuration to file
109
139
  config_file.add_service data
110
140
  config_file.persist
111
- puts ""
112
- puts "* Your configuration data has been saved at #{global_options[:config]}"
141
+ bot.say "<%= color('Your configuration data has been saved at #{global_options[:config]}', :info) %>"
113
142
  end
114
143
  end
115
144
 
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
2
+ lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'checklister/version'
4
+ require "checklister/version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "checklister"
@@ -14,25 +14,27 @@ Gem::Specification.new do |spec|
14
14
  spec.homepage = "https://github.com/benichu/checklister"
15
15
  spec.license = "MIT"
16
16
 
17
- spec.required_ruby_version = '>= 2.0'
18
- spec.required_rubygems_version = '>= 1.9'
17
+ spec.required_rubygems_version = ">= 1.9"
19
18
 
20
19
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
20
  spec.bindir = "bin"
22
21
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
23
22
  spec.require_paths = ["lib"]
24
23
 
25
- spec.add_dependency "gitlab" , "~> 3.4.0"
26
- spec.add_dependency "gli" , "~> 2.13"
27
- spec.add_dependency "octokit" , "~> 4.0"
24
+ spec.add_dependency "gitlab" , "~> 3.4.0"
25
+ spec.add_dependency "gli" , "~> 2.13"
26
+ spec.add_dependency "octokit" , "~> 4.0"
27
+ spec.add_dependency "highline" , "~> 1.7"
28
28
 
29
29
  spec.add_development_dependency "bundler" , "~> 1.10"
30
+ spec.add_development_dependency "byebug" , "~> 8.2.1"
30
31
  spec.add_development_dependency "coveralls" , "~> 0.8.2"
31
32
  spec.add_development_dependency "guard" , "~> 2.13"
32
33
  spec.add_development_dependency "guard-rspec" , "~> 4.6"
33
34
  spec.add_development_dependency "guard-ctags-bundler"
34
35
  spec.add_development_dependency "rake" , "~> 10.4"
35
36
  spec.add_development_dependency "rspec" , "~> 3.3"
37
+ spec.add_development_dependency "ruby_dep" , "~> 1.4"
36
38
  spec.add_development_dependency "yard" , "~> 0.8"
37
39
  spec.add_development_dependency "webmock" , "~> 1.21"
38
40
  end
@@ -29,5 +29,9 @@ module Checklister
29
29
  def configure(attributes = {})
30
30
  config.apply attributes
31
31
  end
32
+
33
+ def root
34
+ File.expand_path('../..',__FILE__)
35
+ end
32
36
  end
33
37
  end
@@ -71,6 +71,7 @@ module Checklister
71
71
  end
72
72
 
73
73
  def prepare_options_for_kind(options, kind)
74
+ httparty_options = {}
74
75
  if kind == "github"
75
76
  # Octokit uses ENV for overide
76
77
  # See: https://github.com/octokit/octokit.rb/blob/a98979107a4bf9741a05a1f751405f8a29f29b38/lib/octokit/default.rb#L136-L138
@@ -80,7 +81,10 @@ module Checklister
80
81
  # :private_token is called :access_token
81
82
  options[:access_token] = options.delete(:private_token)
82
83
  elsif kind == "gitlab"
83
- options.merge!(httparty: { verify: false }) # FIXME
84
+ httparty_options[:ssl_ca_file] = options[:endpoint_certificate_path] unless options[:endpoint_certificate_path].to_s == ""
85
+ httparty_options[:p12] = File.read(options[:client_certificate_path]) unless options[:client_certificate_path].to_s == ""
86
+ httparty_options[:p12_password] = options[:client_certificate_password] unless options[:client_certificate_password].to_s == ""
87
+ options.merge!(httparty: httparty_options)
84
88
  end
85
89
  options
86
90
  end
@@ -71,9 +71,9 @@ module Checklister
71
71
  #
72
72
  class Configuration
73
73
  # List of all the configuration attributes stored for use within the gem
74
- ATTRIBUTES = [:endpoint, :private_token, :label, :kind]
74
+ ATTRIBUTES = [:endpoint, :private_token, :label, :kind, :client_certificate_path, :client_certificate_password, :endpoint_certificate_path]
75
75
 
76
- attr_accessor :endpoint, :private_token, :kind
76
+ attr_accessor :endpoint, :private_token, :kind, :client_certificate_path, :client_certificate_password, :endpoint_certificate_path
77
77
  attr_writer :label
78
78
 
79
79
  # Apply a configuration hash to a configuration instance
@@ -1,3 +1,3 @@
1
1
  module Checklister
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: checklister
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Thouret
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-11-06 00:00:00.000000000 Z
12
+ date: 2016-08-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gitlab
@@ -53,6 +53,20 @@ dependencies:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: '4.0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: highline
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '1.7'
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '1.7'
56
70
  - !ruby/object:Gem::Dependency
57
71
  name: bundler
58
72
  requirement: !ruby/object:Gem::Requirement
@@ -67,6 +81,20 @@ dependencies:
67
81
  - - "~>"
68
82
  - !ruby/object:Gem::Version
69
83
  version: '1.10'
84
+ - !ruby/object:Gem::Dependency
85
+ name: byebug
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: 8.2.1
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: 8.2.1
70
98
  - !ruby/object:Gem::Dependency
71
99
  name: coveralls
72
100
  requirement: !ruby/object:Gem::Requirement
@@ -151,6 +179,20 @@ dependencies:
151
179
  - - "~>"
152
180
  - !ruby/object:Gem::Version
153
181
  version: '3.3'
182
+ - !ruby/object:Gem::Dependency
183
+ name: ruby_dep
184
+ requirement: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - "~>"
187
+ - !ruby/object:Gem::Version
188
+ version: '1.4'
189
+ type: :development
190
+ prerelease: false
191
+ version_requirements: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - "~>"
194
+ - !ruby/object:Gem::Version
195
+ version: '1.4'
154
196
  - !ruby/object:Gem::Dependency
155
197
  name: yard
156
198
  requirement: !ruby/object:Gem::Requirement
@@ -192,6 +234,7 @@ files:
192
234
  - ".gitignore"
193
235
  - ".hound.yml"
194
236
  - ".rspec"
237
+ - ".ruby-version"
195
238
  - ".travis.yml"
196
239
  - ".yardopts"
197
240
  - CHANGELOG.md
@@ -236,7 +279,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
236
279
  requirements:
237
280
  - - ">="
238
281
  - !ruby/object:Gem::Version
239
- version: '2.0'
282
+ version: '0'
240
283
  required_rubygems_version: !ruby/object:Gem::Requirement
241
284
  requirements:
242
285
  - - ">="
@@ -244,7 +287,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
287
  version: '1.9'
245
288
  requirements: []
246
289
  rubyforge_project:
247
- rubygems_version: 2.4.5
290
+ rubygems_version: 2.5.1
248
291
  signing_key:
249
292
  specification_version: 4
250
293
  summary: Markdown checklists to gitlab or github issue.