cli_miami 0.0.9 → 1.0.1.pre

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.
@@ -0,0 +1,81 @@
1
+ describe CliMiami do
2
+ subject { CliMiami }
3
+
4
+ describe '.set_preset' do
5
+ it 'should raise an error if invalid options' do
6
+ expect { subject.set_preset(:foo, :bar) }.to raise_error ArgumentError
7
+ end
8
+
9
+ it 'should set new preset' do
10
+ subject.set_preset :foo,
11
+ bar: :baz
12
+
13
+ expect(subject.class_variable_get(:@@presets)[:foo]).to eq(bar: :baz)
14
+ end
15
+ end
16
+
17
+ describe '.get_options' do
18
+ before do
19
+ subject.set_preset :foo,
20
+ color: 'red',
21
+ bg_color: 'blue'
22
+ end
23
+
24
+ it 'should handle `required`' do
25
+ # should replaced `required` with altered minimum value
26
+ expect(subject.get_options(required: true)).to_not include(:required)
27
+
28
+ # should set min from 0 to 1
29
+ expect(subject.get_options(required: true)).to include(min: 1)
30
+ end
31
+
32
+ context 'when passing a preset symbol' do
33
+ context 'when preset is valid' do
34
+ it 'should return the preset options' do
35
+ expect(subject.get_options(:foo)).to include(
36
+ color: 'red',
37
+ bg_color: 'blue'
38
+ )
39
+ end
40
+ end
41
+
42
+ context 'when preset is invalid' do
43
+ it 'should still return default options' do
44
+ expect(subject.get_options(:bar)).to_not be_empty
45
+ end
46
+ end
47
+ end
48
+
49
+ context 'when passing an options hash' do
50
+ context 'when hash has a valid preset key' do
51
+ it 'should return the preset options' do
52
+ expect(subject.get_options(preset: :foo)).to include(
53
+ color: 'red',
54
+ bg_color: 'blue'
55
+ )
56
+ end
57
+
58
+ it 'should extend preset options with additional passed options' do
59
+ expect(subject.get_options(preset: :foo, style: 'bold')).to include(
60
+ color: 'red',
61
+ bg_color: 'blue',
62
+ style: ['bold']
63
+ )
64
+ end
65
+
66
+ it 'should override preset options with additional passed options' do
67
+ expect(subject.get_options(preset: :foo, bg_color: 'green')).to include(
68
+ color: 'red',
69
+ bg_color: 'green'
70
+ )
71
+ end
72
+ end
73
+
74
+ context 'when hash has an invalid preset key' do
75
+ it 'should still return default options' do
76
+ expect(subject.get_options(preset: :bar)).to_not be_empty
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,83 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+ require 'cli_miami'
4
+ require 'i18n'
5
+
6
+ I18n.load_path += Dir[File.expand_path("#{File.dirname(__FILE__)}/fixtures/i18n.yml")]
7
+
8
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
9
+ RSpec.configure do |config|
10
+ # The settings below are suggested to provide a good initial experience
11
+ # with RSpec, but feel free to customize to your heart's content.
12
+
13
+ # These two settings work together to allow you to limit a spec run
14
+ # to individual examples or groups you care about by tagging them with
15
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
16
+ # get run.
17
+ config.filter_run :focus
18
+ config.run_all_when_everything_filtered = true
19
+
20
+ # Many RSpec users commonly either run the entire suite or an individual
21
+ # file, and it's useful to allow more verbose output when running an
22
+ # individual spec file.
23
+ if config.files_to_run.one?
24
+ # Use the documentation formatter for detailed output,
25
+ # unless a formatter has already been configured
26
+ # (e.g. via a command-line flag).
27
+ config.default_formatter = 'doc'
28
+ end
29
+
30
+ # Print the 10 slowest examples and example groups at the
31
+ # end of the spec run, to help surface which specs are running
32
+ # particularly slow.
33
+ config.profile_examples = 5
34
+
35
+ # Run specs in random order to surface order dependencies. If you find an
36
+ # order dependency and want to debug it, you can fix the order by providing
37
+ # the seed, which is printed after each run.
38
+ # --seed 1234
39
+ config.order = :random
40
+
41
+ # Seed global randomization in this process using the `--seed` CLI option.
42
+ # Setting this allows you to use `--seed` to deterministically reproduce
43
+ # test failures related to randomization by passing the same `--seed` value
44
+ # as the one that triggered the failure.
45
+ Kernel.srand config.seed
46
+
47
+ # rspec-expectations config goes here. You can use an alternate
48
+ # assertion/expectation library such as wrong or the stdlib/minitest
49
+ # assertions if you prefer.
50
+ config.expect_with :rspec do |expectations|
51
+ # Enable only the newer, non-monkey-patching expect syntax.
52
+ # For more details, see:
53
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
54
+ expectations.syntax = :expect
55
+ end
56
+
57
+ # rspec-mocks config goes here. You can use an alternate test double
58
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
59
+ config.mock_with :rspec do |mocks|
60
+ # Enable only the newer, non-monkey-patching expect syntax.
61
+ # For more details, see:
62
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
63
+ mocks.syntax = :expect
64
+
65
+ # Prevents you from mocking or stubbing a method that does not exist on
66
+ # a real object. This is generally recommended.
67
+ mocks.verify_partial_doubles = true
68
+ end
69
+
70
+ config.before do
71
+ allow($stdout).to receive(:print)
72
+ allow($stdout).to receive(:puts)
73
+
74
+ # uncomment the following lines to enable debugging
75
+ # allow($stdout).to receive(:print).and_call_original
76
+ # allow($stdout).to receive(:puts).and_call_original
77
+ end
78
+
79
+ config.after do
80
+ allow($stdout).to receive(:print).and_call_original
81
+ allow($stdout).to receive(:puts).and_call_original
82
+ end
83
+ end
metadata CHANGED
@@ -1,83 +1,167 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cli_miami
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 1.0.1.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Brewster
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-22 00:00:00.000000000 Z
11
+ date: 2016-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '4.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '4.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: i18n
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '0.7'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '0.7'
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: term-ansicolor
15
43
  requirement: !ruby/object:Gem::Requirement
16
44
  requirements:
17
- - - "~>"
45
+ - - ~>
18
46
  - !ruby/object:Gem::Version
19
47
  version: '1.3'
20
48
  type: :runtime
21
49
  prerelease: false
22
50
  version_requirements: !ruby/object:Gem::Requirement
23
51
  requirements:
24
- - - "~>"
52
+ - - ~>
25
53
  - !ruby/object:Gem::Version
26
54
  version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: coveralls
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '0.7'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '0.7'
27
69
  - !ruby/object:Gem::Dependency
28
70
  name: guard
29
71
  requirement: !ruby/object:Gem::Requirement
30
72
  requirements:
31
- - - "~>"
73
+ - - ~>
32
74
  - !ruby/object:Gem::Version
33
75
  version: '2.6'
34
76
  type: :development
35
77
  prerelease: false
36
78
  version_requirements: !ruby/object:Gem::Requirement
37
79
  requirements:
38
- - - "~>"
80
+ - - ~>
39
81
  - !ruby/object:Gem::Version
40
82
  version: '2.6'
83
+ - !ruby/object:Gem::Dependency
84
+ name: guard-bundler
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: '2.1'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: '2.1'
97
+ - !ruby/object:Gem::Dependency
98
+ name: guard-rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: '1.2'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: '1.2'
41
111
  - !ruby/object:Gem::Dependency
42
112
  name: guard-rspec
43
113
  requirement: !ruby/object:Gem::Requirement
44
114
  requirements:
45
- - - "~>"
115
+ - - ~>
46
116
  - !ruby/object:Gem::Version
47
117
  version: '4.3'
48
118
  type: :development
49
119
  prerelease: false
50
120
  version_requirements: !ruby/object:Gem::Requirement
51
121
  requirements:
52
- - - "~>"
122
+ - - ~>
53
123
  - !ruby/object:Gem::Version
54
124
  version: '4.3'
125
+ - !ruby/object:Gem::Dependency
126
+ name: listen
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ~>
130
+ - !ruby/object:Gem::Version
131
+ version: 3.0.6
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ~>
137
+ - !ruby/object:Gem::Version
138
+ version: 3.0.6
55
139
  - !ruby/object:Gem::Dependency
56
140
  name: rspec
57
141
  requirement: !ruby/object:Gem::Requirement
58
142
  requirements:
59
- - - "~>"
143
+ - - ~>
60
144
  - !ruby/object:Gem::Version
61
145
  version: '3.1'
62
146
  type: :development
63
147
  prerelease: false
64
148
  version_requirements: !ruby/object:Gem::Requirement
65
149
  requirements:
66
- - - "~>"
150
+ - - ~>
67
151
  - !ruby/object:Gem::Version
68
152
  version: '3.1'
69
153
  - !ruby/object:Gem::Dependency
70
154
  name: terminal-notifier-guard
71
155
  requirement: !ruby/object:Gem::Requirement
72
156
  requirements:
73
- - - "~>"
157
+ - - ~>
74
158
  - !ruby/object:Gem::Version
75
159
  version: '1.5'
76
160
  type: :development
77
161
  prerelease: false
78
162
  version_requirements: !ruby/object:Gem::Requirement
79
163
  requirements:
80
- - - "~>"
164
+ - - ~>
81
165
  - !ruby/object:Gem::Version
82
166
  version: '1.5'
83
167
  description:
@@ -86,21 +170,25 @@ executables: []
86
170
  extensions: []
87
171
  extra_rdoc_files: []
88
172
  files:
89
- - ".gitignore"
90
- - ".rspec"
91
- - ".travis.yml"
92
- - Gemfile
93
- - Gemfile.lock
94
- - Guardfile
95
173
  - README.md
174
+ - i18n/en.yml
96
175
  - lib/cli_miami.rb
97
176
  - lib/cli_miami/ask.rb
177
+ - lib/cli_miami/core.rb
178
+ - lib/cli_miami/error.rb
98
179
  - lib/cli_miami/say.rb
180
+ - lib/cli_miami/validation.rb
99
181
  - lib/namespaced.rb
100
- - yuyi_menu
101
- homepage: https://github.com/brewster1134/cli_miami
182
+ - spec/fixtures/i18n.yml
183
+ - spec/lib/cli_miami/ask_spec.rb
184
+ - spec/lib/cli_miami/error_spec.rb
185
+ - spec/lib/cli_miami/say_spec.rb
186
+ - spec/lib/cli_miami/validation_spec.rb
187
+ - spec/lib/cli_miami_spec.rb
188
+ - spec/spec_helper.rb
189
+ homepage: https://github.com/brewster1134/CLI-Miami
102
190
  licenses:
103
- - MIT
191
+ - WTFPL
104
192
  metadata: {}
105
193
  post_install_message:
106
194
  rdoc_options: []
@@ -108,19 +196,25 @@ require_paths:
108
196
  - lib
109
197
  required_ruby_version: !ruby/object:Gem::Requirement
110
198
  requirements:
111
- - - ">="
199
+ - - '>='
112
200
  - !ruby/object:Gem::Version
113
- version: '1.9'
201
+ version: 2.0.0p247
114
202
  required_rubygems_version: !ruby/object:Gem::Requirement
115
203
  requirements:
116
- - - ">="
204
+ - - '>'
117
205
  - !ruby/object:Gem::Version
118
- version: '0'
206
+ version: 1.3.1
119
207
  requirements: []
120
208
  rubyforge_project:
121
- rubygems_version: 2.4.5
209
+ rubygems_version: 2.6.4
122
210
  signing_key:
123
211
  specification_version: 4
124
212
  summary: A feature rich alternative for `gets` and `puts` for your cli interface
125
- test_files: []
126
- has_rdoc:
213
+ test_files:
214
+ - spec/fixtures/i18n.yml
215
+ - spec/lib/cli_miami/ask_spec.rb
216
+ - spec/lib/cli_miami/error_spec.rb
217
+ - spec/lib/cli_miami/say_spec.rb
218
+ - spec/lib/cli_miami/validation_spec.rb
219
+ - spec/lib/cli_miami_spec.rb
220
+ - spec/spec_helper.rb
data/.gitignore DELETED
@@ -1,2 +0,0 @@
1
- *.gem
2
- coverage
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --color
2
- --format documentation
3
- --require spec_helper
data/.travis.yml DELETED
@@ -1,6 +0,0 @@
1
- language: ruby
2
- install: bundle install --without development
3
- script: bundle exec rspec
4
- rvm:
5
- - 1.9.3-p551
6
- - 2.1.5
data/Gemfile DELETED
@@ -1,11 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'term-ansicolor', '~> 1.3'
4
-
5
- group :test do
6
- gem 'coveralls', :require => false
7
- gem 'guard', '~> 2.6'
8
- gem 'guard-rspec', '~> 4.3', :require => false
9
- gem 'rspec', '~> 3.1'
10
- gem 'terminal-notifier-guard', '~> 1.5'
11
- end
data/Gemfile.lock DELETED
@@ -1,100 +0,0 @@
1
- GEM
2
- remote: https://rubygems.org/
3
- specs:
4
- celluloid (0.16.0)
5
- timers (~> 4.0.0)
6
- coderay (1.1.0)
7
- coveralls (0.8.0)
8
- multi_json (~> 1.10)
9
- rest-client (>= 1.6.8, < 2)
10
- simplecov (~> 0.9.1)
11
- term-ansicolor (~> 1.3)
12
- thor (~> 0.19.1)
13
- diff-lcs (1.2.5)
14
- docile (1.1.5)
15
- domain_name (0.5.23)
16
- unf (>= 0.0.5, < 1.0.0)
17
- ffi (1.9.8)
18
- formatador (0.2.5)
19
- guard (2.12.5)
20
- formatador (>= 0.2.4)
21
- listen (~> 2.7)
22
- lumberjack (~> 1.0)
23
- nenv (~> 0.1)
24
- notiffany (~> 0.0)
25
- pry (>= 0.9.12)
26
- shellany (~> 0.0)
27
- thor (>= 0.18.1)
28
- guard-compat (1.2.1)
29
- guard-rspec (4.5.0)
30
- guard (~> 2.1)
31
- guard-compat (~> 1.1)
32
- rspec (>= 2.99.0, < 4.0)
33
- hitimes (1.2.2)
34
- http-cookie (1.0.2)
35
- domain_name (~> 0.5)
36
- listen (2.10.0)
37
- celluloid (~> 0.16.0)
38
- rb-fsevent (>= 0.9.3)
39
- rb-inotify (>= 0.9)
40
- lumberjack (1.0.9)
41
- method_source (0.8.2)
42
- mime-types (2.4.3)
43
- multi_json (1.11.0)
44
- nenv (0.2.0)
45
- netrc (0.10.3)
46
- notiffany (0.0.6)
47
- nenv (~> 0.1)
48
- shellany (~> 0.0)
49
- pry (0.10.1)
50
- coderay (~> 1.1.0)
51
- method_source (~> 0.8.1)
52
- slop (~> 3.4)
53
- rb-fsevent (0.9.4)
54
- rb-inotify (0.9.5)
55
- ffi (>= 0.5.0)
56
- rest-client (1.8.0)
57
- http-cookie (>= 1.0.2, < 2.0)
58
- mime-types (>= 1.16, < 3.0)
59
- netrc (~> 0.7)
60
- rspec (3.2.0)
61
- rspec-core (~> 3.2.0)
62
- rspec-expectations (~> 3.2.0)
63
- rspec-mocks (~> 3.2.0)
64
- rspec-core (3.2.3)
65
- rspec-support (~> 3.2.0)
66
- rspec-expectations (3.2.1)
67
- diff-lcs (>= 1.2.0, < 2.0)
68
- rspec-support (~> 3.2.0)
69
- rspec-mocks (3.2.1)
70
- diff-lcs (>= 1.2.0, < 2.0)
71
- rspec-support (~> 3.2.0)
72
- rspec-support (3.2.2)
73
- shellany (0.0.1)
74
- simplecov (0.9.2)
75
- docile (~> 1.1.0)
76
- multi_json (~> 1.0)
77
- simplecov-html (~> 0.9.0)
78
- simplecov-html (0.9.0)
79
- slop (3.6.0)
80
- term-ansicolor (1.3.0)
81
- tins (~> 1.0)
82
- terminal-notifier-guard (1.6.4)
83
- thor (0.19.1)
84
- timers (4.0.1)
85
- hitimes
86
- tins (1.3.5)
87
- unf (0.1.4)
88
- unf_ext
89
- unf_ext (0.0.6)
90
-
91
- PLATFORMS
92
- ruby
93
-
94
- DEPENDENCIES
95
- coveralls
96
- guard (~> 2.6)
97
- guard-rspec (~> 4.3)
98
- rspec (~> 3.1)
99
- term-ansicolor (~> 1.3)
100
- terminal-notifier-guard (~> 1.5)
data/Guardfile DELETED
@@ -1,5 +0,0 @@
1
- guard :rspec, cmd: 'bundle exec rspec' do
2
- watch(%r{^spec/lib/.+_spec\.rb$})
3
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
4
- watch('spec/spec_helper.rb') { 'spec' }
5
- end
data/yuyi_menu DELETED
@@ -1,8 +0,0 @@
1
- sources:
2
- yuyi: https://github.com/brewster1134/Yuyi-Rolls/archive/master.zip
3
- rolls:
4
- bundler:
5
- ruby:
6
- versions:
7
- - 2.1.2
8
- ruby_gems: