userinput 0.0.2 → 1.0.0

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: 1c1149e9754ddf19bb5d121000a9022a88464096
4
- data.tar.gz: 6dae20c6c1bcd14207c548311c82da96a78eacf0
3
+ metadata.gz: 2703a01f7bc5d319b7c41edd4d8d3a56692afd46
4
+ data.tar.gz: dd3c9fb388e87dfa20f58bbf513377fbc0f03d1c
5
5
  SHA512:
6
- metadata.gz: 160c87160ef2843da4bdc7813ae1f827d20b6b85875400953c537cfd56a2672a8ea54da40c93d67739de8f69ca8815b9b7930e8c7beac92879d905c99dd7ab96
7
- data.tar.gz: 55c032fbcc1daea95606db9389485c88661eec605c8c186c02f25fdc17bec0d261ff342bc3251d60748d4cf2e441a519730535b7ea8b5d9b3d8a9616f528b777
6
+ metadata.gz: cf6e415b42beef180b7f6f458e2060442c42a8e38b2081a28fe48a17b0d98f1db28e2a050b4c02f4328f66fe112f87ff525e8698a9489a722e28c8be03a1f1d0
7
+ data.tar.gz: c9ab8b806ff243e3f6f7ef4624d6f0b7a597cbe41c2f49281f783b00124106ce2be67ca31152759268154ead51fb3f9008ba1e35fec4776163d9a805ba6736f0
@@ -1,13 +1,15 @@
1
1
  language: ruby
2
2
  cache: bundler
3
+ sudo: false
3
4
  rvm:
4
- - 2.1.0
5
- - 2.0.0
6
- - 1.9.3
5
+ - 2.2.0
6
+ - 2.1.5
7
+ - 2.0.0-p598
8
+ - 1.9.3-p551
7
9
  notifications:
8
10
  email: false
9
11
  irc:
10
12
  template:
11
13
  - '%{repository}/%{branch}/%{build_number}: %{message} -- %{build_url}'
12
14
  channels:
13
- secure: OkVku3yPBdazEJyXtmrAZCNiR2ceuvFGwz1ap6vQDA/In/d5W4Nt58zxrSp8mCP2rDXjju4N+toZNt6nPA4RU7OiKlo6o4Wo5ARqNPDBPRui2cafBWGldW68gI6yAArcyMCt2iRiSy+GCGk5GwCDxKhQ1b3vR/MLopQUUYc3c9U=
15
+ - irc.oftc.net#akerl
@@ -0,0 +1,4 @@
1
+ # 1.0.0 / 2015-01-19
2
+
3
+ * [ENHANCEMENT] Stabilized API
4
+
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ desc 'Run tests'
6
6
  RSpec::Core::RakeTask.new(:spec)
7
7
 
8
8
  desc 'Run Rubocop on the gem'
9
- Rubocop::RakeTask.new(:rubocop) do |task|
9
+ RuboCop::RakeTask.new(:rubocop) do |task|
10
10
  task.patterns = ['lib/**/*.rb', 'spec/**/*.rb']
11
11
  task.fail_on_error = true
12
12
  end
@@ -38,6 +38,8 @@ module UserInput
38
38
  enable_echo if @secret
39
39
  end
40
40
 
41
+ private
42
+
41
43
  ##
42
44
  # Validate user input
43
45
  def valid(input)
@@ -53,13 +55,11 @@ module UserInput
53
55
  end
54
56
  end
55
57
 
56
- private
57
-
58
58
  ##
59
59
  # Parse user input
60
60
  def _ask
61
61
  input = STDIN.gets.chomp
62
- input = @default if input.empty? && !@default.nil?
62
+ input = @default if input.empty? && @default
63
63
  puts if @secret
64
64
  input
65
65
  end
@@ -67,10 +67,9 @@ module UserInput
67
67
  ##
68
68
  # Track attempt counter
69
69
  def check_counter
70
- unless @attempts.nil?
71
- @attempts -= 1
72
- fail ArgumentError, 'No valid input provided' if @attempts == 0
73
- end
70
+ return if @attempts.nil?
71
+ @attempts -= 1
72
+ fail ArgumentError, 'No valid input provided' if @attempts == 0
74
73
  end
75
74
 
76
75
  ##
@@ -64,7 +64,7 @@ describe UserInput do
64
64
  end
65
65
 
66
66
  it 'raises an error if max attempts is reached' do
67
- prompt = UserInput::Prompt.new(attempts: 2) { |x| false }
67
+ prompt = UserInput::Prompt.new(attempts: 2) { false }
68
68
  allow(STDIN).to receive(:gets).and_return("_str\n", "_foo\n")
69
69
  expect(prompt).to receive(:print).with('? ').twice
70
70
  expect { prompt.ask }.to raise_error ArgumentError
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'userinput'
3
- s.version = '0.0.2'
3
+ s.version = '1.0.0'
4
4
  s.date = Time.now.strftime("%Y-%m-%d")
5
5
 
6
6
  s.summary = 'Simple user input library'
@@ -13,9 +13,9 @@ Gem::Specification.new do |s|
13
13
  s.files = `git ls-files`.split
14
14
  s.test_files = `git ls-files spec/*`.split
15
15
 
16
- s.add_development_dependency 'rubocop', '~> 0.19.0'
17
- s.add_development_dependency 'rake', '~> 10.2.1'
18
- s.add_development_dependency 'coveralls', '~> 0.7.0'
19
- s.add_development_dependency 'rspec', '~> 2.14.1'
20
- s.add_development_dependency 'fuubar', '~> 1.3.2'
16
+ s.add_development_dependency 'rubocop', '~> 0.28.0'
17
+ s.add_development_dependency 'rake', '~> 10.4.0'
18
+ s.add_development_dependency 'coveralls', '~> 0.7.1'
19
+ s.add_development_dependency 'rspec', '~> 3.1.0'
20
+ s.add_development_dependency 'fuubar', '~> 2.0.0'
21
21
  end
metadata CHANGED
@@ -1,95 +1,96 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: userinput
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Les Aker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-30 00:00:00.000000000 Z
11
+ date: 2015-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.19.0
19
+ version: 0.28.0
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.19.0
26
+ version: 0.28.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 10.2.1
33
+ version: 10.4.0
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 10.2.1
40
+ version: 10.4.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: coveralls
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.7.0
47
+ version: 0.7.1
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.7.0
54
+ version: 0.7.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 2.14.1
61
+ version: 3.1.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 2.14.1
68
+ version: 3.1.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: fuubar
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.3.2
75
+ version: 2.0.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.3.2
82
+ version: 2.0.0
83
83
  description: Provides a prompt object for requesting user input
84
84
  email: me@lesaker.org
85
85
  executables: []
86
86
  extensions: []
87
87
  extra_rdoc_files: []
88
88
  files:
89
- - .gitignore
90
- - .rspec
91
- - .rubocop.yml
92
- - .travis.yml
89
+ - ".gitignore"
90
+ - ".rspec"
91
+ - ".rubocop.yml"
92
+ - ".travis.yml"
93
+ - CHANGELOG.md
93
94
  - Gemfile
94
95
  - LICENSE
95
96
  - README.md
@@ -108,17 +109,17 @@ require_paths:
108
109
  - lib
109
110
  required_ruby_version: !ruby/object:Gem::Requirement
110
111
  requirements:
111
- - - '>='
112
+ - - ">="
112
113
  - !ruby/object:Gem::Version
113
114
  version: '0'
114
115
  required_rubygems_version: !ruby/object:Gem::Requirement
115
116
  requirements:
116
- - - '>='
117
+ - - ">="
117
118
  - !ruby/object:Gem::Version
118
119
  version: '0'
119
120
  requirements: []
120
121
  rubyforge_project:
121
- rubygems_version: 2.0.14
122
+ rubygems_version: 2.4.5
122
123
  signing_key:
123
124
  specification_version: 4
124
125
  summary: Simple user input library