tty 0.8.1 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +18 -0
- data/README.md +3 -1
- data/lib/tty.rb +1 -1
- data/lib/tty/cli.rb +0 -1
- data/lib/tty/cmd.rb +0 -1
- data/lib/tty/commands/add.rb +0 -1
- data/lib/tty/commands/new.rb +5 -6
- data/lib/tty/gemspec.rb +0 -1
- data/lib/tty/licenses.rb +0 -1
- data/lib/tty/path_helpers.rb +0 -1
- data/lib/tty/plugins.rb +1 -1
- data/lib/tty/plugins/plugin.rb +1 -1
- data/lib/tty/templater.rb +0 -1
- data/lib/tty/version.rb +2 -2
- data/tty.gemspec +21 -18
- data/tty.manifest +7 -0
- metadata +63 -84
- data/.gitignore +0 -19
- data/.rspec +0 -4
- data/.travis.yml +0 -35
- data/.yardopts +0 -4
- data/CODE_OF_CONDUCT.md +0 -49
- data/Gemfile +0 -17
- data/Rakefile +0 -8
- data/appveyor.yml +0 -22
- data/images/tty.png +0 -0
- data/spec/fixtures/foo-0.0.1.gemspec +0 -17
- data/spec/integration/add_desc_args_spec.rb +0 -341
- data/spec/integration/add_force_spec.rb +0 -98
- data/spec/integration/add_namespaced_spec.rb +0 -291
- data/spec/integration/add_spec.rb +0 -535
- data/spec/integration/add_subcommand_spec.rb +0 -259
- data/spec/integration/new_author_spec.rb +0 -19
- data/spec/integration/new_license_spec.rb +0 -39
- data/spec/integration/new_namespaced_spec.rb +0 -228
- data/spec/integration/new_spec.rb +0 -354
- data/spec/integration/new_test_spec.rb +0 -21
- data/spec/integration/start_spec.rb +0 -21
- data/spec/spec_helper.rb +0 -73
- data/spec/unit/gemspec_spec.rb +0 -17
- data/spec/unit/plugins/activate_spec.rb +0 -13
- data/spec/unit/plugins/load_from_spec.rb +0 -28
- data/spec/unit/plugins/plugin/load_spec.rb +0 -32
- data/spec/unit/plugins/plugin/new_spec.rb +0 -13
- data/spec/unit/tty_spec.rb +0 -14
- data/tasks/console.rake +0 -11
- data/tasks/coverage.rake +0 -11
- data/tasks/spec.rake +0 -29
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
---
|
2
|
-
env:
|
3
|
-
global:
|
4
|
-
- CC_TEST_REPORTER_ID=76c3cb8a84b67e1e18aadacbe5a77861bc723dc1448f044bae995795b261569b
|
5
|
-
language: ruby
|
6
|
-
sudo: false
|
7
|
-
bundler_args: --without yard guard benchmarks
|
8
|
-
before_install: "gem install bundler -v 1.16.0"
|
9
|
-
before_script:
|
10
|
-
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
11
|
-
- chmod +x ./cc-test-reporter
|
12
|
-
- ./cc-test-reporter before-build
|
13
|
-
script: "bundle exec rake ci"
|
14
|
-
after_script:
|
15
|
-
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
16
|
-
rvm:
|
17
|
-
- 2.0.0
|
18
|
-
- 2.1.10
|
19
|
-
- 2.2.8
|
20
|
-
- 2.3.6
|
21
|
-
- 2.4.3
|
22
|
-
- 2.5.1
|
23
|
-
- ruby-head
|
24
|
-
- jruby-9000
|
25
|
-
- jruby-head
|
26
|
-
matrix:
|
27
|
-
allow_failures:
|
28
|
-
- rvm: ruby-head
|
29
|
-
- rvm: jruby-head
|
30
|
-
- rvm: jruby-9000
|
31
|
-
fast_finish: true
|
32
|
-
branches:
|
33
|
-
only: master
|
34
|
-
notifications:
|
35
|
-
email: false
|
data/.yardopts
DELETED
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
# Contributor Code of Conduct
|
2
|
-
|
3
|
-
As contributors and maintainers of this project, and in the interest of
|
4
|
-
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
-
contribute through reporting issues, posting feature requests, updating
|
6
|
-
documentation, submitting pull requests or patches, and other activities.
|
7
|
-
|
8
|
-
We are committed to making participation in this project a harassment-free
|
9
|
-
experience for everyone, regardless of level of experience, gender, gender
|
10
|
-
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
-
body size, race, ethnicity, age, religion, or nationality.
|
12
|
-
|
13
|
-
Examples of unacceptable behavior by participants include:
|
14
|
-
|
15
|
-
* The use of sexualized language or imagery
|
16
|
-
* Personal attacks
|
17
|
-
* Trolling or insulting/derogatory comments
|
18
|
-
* Public or private harassment
|
19
|
-
* Publishing other's private information, such as physical or electronic
|
20
|
-
addresses, without explicit permission
|
21
|
-
* Other unethical or unprofessional conduct
|
22
|
-
|
23
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
-
threatening, offensive, or harmful.
|
28
|
-
|
29
|
-
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
-
fairly and consistently applying these principles to every aspect of managing
|
31
|
-
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
-
Conduct may be permanently removed from the project team.
|
33
|
-
|
34
|
-
This code of conduct applies both within project spaces and in public spaces
|
35
|
-
when an individual is representing the project or its community.
|
36
|
-
|
37
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
-
reported by contacting a project maintainer at [email]. All
|
39
|
-
complaints will be reviewed and investigated and will result in a response that
|
40
|
-
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
-
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
-
incident.
|
43
|
-
|
44
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
-
version 1.3.0, available at
|
46
|
-
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
-
|
48
|
-
[homepage]: http://contributor-covenant.org
|
49
|
-
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
gemspec
|
4
|
-
|
5
|
-
group :development do
|
6
|
-
gem 'yard', '~> 0.9.12'
|
7
|
-
gem 'timecop', '~> 0.9.1'
|
8
|
-
end
|
9
|
-
|
10
|
-
group :metrics do
|
11
|
-
gem 'simplecov', '~> 0.16.1'
|
12
|
-
gem 'yardstick', '~> 0.9.9'
|
13
|
-
end
|
14
|
-
|
15
|
-
group :benchmarks do
|
16
|
-
gem 'benchmark-ips', '~> 2.7.2'
|
17
|
-
end
|
data/Rakefile
DELETED
data/appveyor.yml
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
---
|
2
|
-
install:
|
3
|
-
- SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
|
4
|
-
- ruby --version
|
5
|
-
- gem --version
|
6
|
-
- bundle install
|
7
|
-
build: off
|
8
|
-
test_script:
|
9
|
-
- bundle exec rake ci
|
10
|
-
environment:
|
11
|
-
matrix:
|
12
|
-
- ruby_version: "200"
|
13
|
-
- ruby_version: "200-x64"
|
14
|
-
- ruby_version: "21"
|
15
|
-
- ruby_version: "21-x64"
|
16
|
-
- ruby_version: "22"
|
17
|
-
- ruby_version: "22-x64"
|
18
|
-
- ruby_version: "23"
|
19
|
-
- ruby_version: "23-x64"
|
20
|
-
- ruby_version: "24"
|
21
|
-
- ruby_version: "24-x64"
|
22
|
-
- ruby_version: "25-x64"
|
data/images/tty.png
DELETED
Binary file
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
Gem::Specification.new do |spec|
|
4
|
-
spec.name = 'foo'
|
5
|
-
spec.version = '0.0.1'
|
6
|
-
spec.platform = 'ruby'
|
7
|
-
spec.summary = 'A foo gem'
|
8
|
-
spec.require_paths = ['lib']
|
9
|
-
|
10
|
-
spec.add_dependency 'pastel'
|
11
|
-
spec.add_dependency 'equatable'
|
12
|
-
spec.add_dependency 'tty-command', '~> 0.3.0'
|
13
|
-
spec.add_dependency 'tty-prompt', '~> 0.10.0'
|
14
|
-
spec.add_dependency 'tty-spinner', '~> 0.4.0'
|
15
|
-
|
16
|
-
spec.add_development_dependency 'rake'
|
17
|
-
end
|
@@ -1,341 +0,0 @@
|
|
1
|
-
RSpec.describe "`teletype add --desc --args` command", type: :cli do
|
2
|
-
it "adds command with description and custom arguments" do
|
3
|
-
app_path = tmp_path('newcli')
|
4
|
-
cli_template = <<-EOS
|
5
|
-
require 'thor'
|
6
|
-
|
7
|
-
module Newcli
|
8
|
-
class CLI < Thor
|
9
|
-
end
|
10
|
-
end
|
11
|
-
EOS
|
12
|
-
dir = {
|
13
|
-
app_path => [
|
14
|
-
'lib' => [
|
15
|
-
'newcli' => [
|
16
|
-
['cli.rb', cli_template]
|
17
|
-
]
|
18
|
-
]
|
19
|
-
]
|
20
|
-
}
|
21
|
-
::TTY::File.create_dir(dir, verbose: false)
|
22
|
-
within_dir(app_path) do
|
23
|
-
command = "teletype add config --test rspec --desc='Set and get configuration option' --args=arg1 arg2 --no-color"
|
24
|
-
|
25
|
-
out, err, status = Open3.capture3(command)
|
26
|
-
|
27
|
-
expect(out).to match <<-OUT
|
28
|
-
create spec/integration/config_spec.rb
|
29
|
-
create spec/unit/config_spec.rb
|
30
|
-
create lib/newcli/commands/config.rb
|
31
|
-
create lib/newcli/templates/config/.gitkeep
|
32
|
-
inject lib/newcli/cli.rb
|
33
|
-
OUT
|
34
|
-
expect(err).to eq('')
|
35
|
-
expect(status.exitstatus).to eq(0)
|
36
|
-
|
37
|
-
expect(::File.read('lib/newcli/cli.rb')).to eq <<-EOS
|
38
|
-
require 'thor'
|
39
|
-
|
40
|
-
module Newcli
|
41
|
-
class CLI < Thor
|
42
|
-
|
43
|
-
desc 'config ARG1 ARG2', 'Set and get configuration option'
|
44
|
-
method_option :help, aliases: '-h', type: :boolean,
|
45
|
-
desc: 'Display usage information'
|
46
|
-
def config(arg1, arg2)
|
47
|
-
if options[:help]
|
48
|
-
invoke :help, ['config']
|
49
|
-
else
|
50
|
-
require_relative 'commands/config'
|
51
|
-
Newcli::Commands::Config.new(arg1, arg2, options).execute
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
EOS
|
57
|
-
|
58
|
-
expect(::File.read('lib/newcli/commands/config.rb')).to eq <<-EOS
|
59
|
-
# frozen_string_literal: true
|
60
|
-
|
61
|
-
require_relative '../command'
|
62
|
-
|
63
|
-
module Newcli
|
64
|
-
module Commands
|
65
|
-
class Config < Newcli::Command
|
66
|
-
def initialize(arg1, arg2, options)
|
67
|
-
@arg1 = arg1
|
68
|
-
@arg2 = arg2
|
69
|
-
@options = options
|
70
|
-
end
|
71
|
-
|
72
|
-
def execute(input: $stdin, output: $stdout)
|
73
|
-
# Command logic goes here ...
|
74
|
-
output.puts "OK"
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
EOS
|
80
|
-
|
81
|
-
# test setup
|
82
|
-
#
|
83
|
-
expect(::File.read('spec/integration/config_spec.rb')).to eq <<-EOS
|
84
|
-
RSpec.describe "`newcli config` command", type: :cli do
|
85
|
-
it "executes `newcli help config` command successfully" do
|
86
|
-
output = `newcli help config`
|
87
|
-
expected_output = <<-OUT
|
88
|
-
Usage:
|
89
|
-
newcli config ARG1 ARG2
|
90
|
-
|
91
|
-
Options:
|
92
|
-
-h, [--help], [--no-help] # Display usage information
|
93
|
-
|
94
|
-
Set and get configuration option
|
95
|
-
OUT
|
96
|
-
|
97
|
-
expect(output).to eq(expected_output)
|
98
|
-
end
|
99
|
-
end
|
100
|
-
EOS
|
101
|
-
|
102
|
-
expect(::File.read('spec/unit/config_spec.rb')).to eq <<-EOS
|
103
|
-
require 'newcli/commands/config'
|
104
|
-
|
105
|
-
RSpec.describe Newcli::Commands::Config do
|
106
|
-
it "executes `config` command successfully" do
|
107
|
-
output = StringIO.new
|
108
|
-
arg1 = nil
|
109
|
-
arg2 = nil
|
110
|
-
options = {}
|
111
|
-
command = Newcli::Commands::Config.new(arg1, arg2, options)
|
112
|
-
|
113
|
-
command.execute(output: output)
|
114
|
-
|
115
|
-
expect(output.string).to eq("OK\\n")
|
116
|
-
end
|
117
|
-
end
|
118
|
-
EOS
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
it "adds command with variadic number of arguments" do
|
123
|
-
app_path = tmp_path('newcli')
|
124
|
-
cli_template = <<-EOS
|
125
|
-
require 'thor'
|
126
|
-
|
127
|
-
module Newcli
|
128
|
-
class CLI < Thor
|
129
|
-
end
|
130
|
-
end
|
131
|
-
EOS
|
132
|
-
dir = {
|
133
|
-
app_path => [
|
134
|
-
'lib' => [
|
135
|
-
'newcli' => [
|
136
|
-
['cli.rb', cli_template]
|
137
|
-
]
|
138
|
-
]
|
139
|
-
]
|
140
|
-
}
|
141
|
-
::TTY::File.create_dir(dir, verbose: false)
|
142
|
-
within_dir(app_path) do
|
143
|
-
command = "teletype add config --args=arg1 *names --test=minitest --no-color"
|
144
|
-
|
145
|
-
out, err, status = Open3.capture3(command)
|
146
|
-
|
147
|
-
expect(out).to match <<-OUT
|
148
|
-
create test/integration/config_test.rb
|
149
|
-
create test/unit/config_test.rb
|
150
|
-
create lib/newcli/commands/config.rb
|
151
|
-
create lib/newcli/templates/config/.gitkeep
|
152
|
-
inject lib/newcli/cli.rb
|
153
|
-
OUT
|
154
|
-
expect(err).to eq('')
|
155
|
-
expect(status.exitstatus).to eq(0)
|
156
|
-
|
157
|
-
expect(::File.read('lib/newcli/cli.rb')).to eq <<-EOS
|
158
|
-
require 'thor'
|
159
|
-
|
160
|
-
module Newcli
|
161
|
-
class CLI < Thor
|
162
|
-
|
163
|
-
desc 'config ARG1 NAMES...', 'Command description...'
|
164
|
-
method_option :help, aliases: '-h', type: :boolean,
|
165
|
-
desc: 'Display usage information'
|
166
|
-
def config(arg1, *names)
|
167
|
-
if options[:help]
|
168
|
-
invoke :help, ['config']
|
169
|
-
else
|
170
|
-
require_relative 'commands/config'
|
171
|
-
Newcli::Commands::Config.new(arg1, names, options).execute
|
172
|
-
end
|
173
|
-
end
|
174
|
-
end
|
175
|
-
end
|
176
|
-
EOS
|
177
|
-
|
178
|
-
expect(::File.read('lib/newcli/commands/config.rb')).to eq <<-EOS
|
179
|
-
# frozen_string_literal: true
|
180
|
-
|
181
|
-
require_relative '../command'
|
182
|
-
|
183
|
-
module Newcli
|
184
|
-
module Commands
|
185
|
-
class Config < Newcli::Command
|
186
|
-
def initialize(arg1, names, options)
|
187
|
-
@arg1 = arg1
|
188
|
-
@names = names
|
189
|
-
@options = options
|
190
|
-
end
|
191
|
-
|
192
|
-
def execute(input: $stdin, output: $stdout)
|
193
|
-
# Command logic goes here ...
|
194
|
-
output.puts "OK"
|
195
|
-
end
|
196
|
-
end
|
197
|
-
end
|
198
|
-
end
|
199
|
-
EOS
|
200
|
-
|
201
|
-
# test/integration/config_test.rb
|
202
|
-
#
|
203
|
-
expect(::File.read('test/integration/config_test.rb')).to eq <<-EOS
|
204
|
-
require 'test_helper'
|
205
|
-
require 'newcli/commands/config'
|
206
|
-
|
207
|
-
class Newcli::Commands::ConfigTest < Minitest::Test
|
208
|
-
def test_executes_newcli_help_config_command_successfully
|
209
|
-
output = `newcli help config`
|
210
|
-
expected_output = <<-OUT
|
211
|
-
Usage:
|
212
|
-
newcli config ARG1 NAMES...
|
213
|
-
|
214
|
-
Options:
|
215
|
-
-h, [--help], [--no-help] # Display usage information
|
216
|
-
|
217
|
-
Command description...
|
218
|
-
OUT
|
219
|
-
|
220
|
-
assert_equal expected_output, output
|
221
|
-
end
|
222
|
-
end
|
223
|
-
EOS
|
224
|
-
|
225
|
-
# test/unit/config_test.rb
|
226
|
-
#
|
227
|
-
expect(::File.read('test/unit/config_test.rb')).to eq <<-EOS
|
228
|
-
require 'test_helper'
|
229
|
-
require 'newcli/commands/config'
|
230
|
-
|
231
|
-
class Newcli::Commands::ConfigTest < Minitest::Test
|
232
|
-
def test_executes_config_command_successfully
|
233
|
-
output = StringIO.new
|
234
|
-
arg1 = nil
|
235
|
-
names = nil
|
236
|
-
options = {}
|
237
|
-
command = Newcli::Commands::Config.new(arg1, names, options)
|
238
|
-
|
239
|
-
command.execute(output: output)
|
240
|
-
|
241
|
-
assert_equal "OK\\n", output.string
|
242
|
-
end
|
243
|
-
end
|
244
|
-
EOS
|
245
|
-
end
|
246
|
-
end
|
247
|
-
|
248
|
-
it "adds subcommand with description and custom arguments" do
|
249
|
-
app_path = tmp_path('newcli')
|
250
|
-
cli_template = <<-EOS
|
251
|
-
require 'thor'
|
252
|
-
|
253
|
-
module Newcli
|
254
|
-
class CLI < Thor
|
255
|
-
end
|
256
|
-
end
|
257
|
-
EOS
|
258
|
-
dir = {
|
259
|
-
app_path => [
|
260
|
-
'lib' => [
|
261
|
-
'newcli' => [
|
262
|
-
['cli.rb', cli_template]
|
263
|
-
]
|
264
|
-
]
|
265
|
-
]
|
266
|
-
}
|
267
|
-
::TTY::File.create_dir(dir, verbose: false)
|
268
|
-
within_dir(app_path) do
|
269
|
-
command = "teletype add config set --desc='Set configuration option' --args=name 'value = nil'"
|
270
|
-
|
271
|
-
_, err, status = Open3.capture3(command)
|
272
|
-
|
273
|
-
expect(err).to eq('')
|
274
|
-
expect(status.exitstatus).to eq(0)
|
275
|
-
|
276
|
-
expect(::File.read('lib/newcli/cli.rb')).to eq <<-EOS
|
277
|
-
require 'thor'
|
278
|
-
|
279
|
-
module Newcli
|
280
|
-
class CLI < Thor
|
281
|
-
|
282
|
-
require_relative 'commands/config'
|
283
|
-
register Newcli::Commands::Config, 'config', 'config [SUBCOMMAND]', 'Set configuration option'
|
284
|
-
end
|
285
|
-
end
|
286
|
-
EOS
|
287
|
-
|
288
|
-
expect(::File.read('lib/newcli/commands/config.rb')).to eq <<-EOS
|
289
|
-
# frozen_string_literal: true
|
290
|
-
|
291
|
-
require 'thor'
|
292
|
-
|
293
|
-
module Newcli
|
294
|
-
module Commands
|
295
|
-
class Config < Thor
|
296
|
-
|
297
|
-
namespace :config
|
298
|
-
|
299
|
-
desc 'set NAME [VALUE]', 'Set configuration option'
|
300
|
-
method_option :help, aliases: '-h', type: :boolean,
|
301
|
-
desc: 'Display usage information'
|
302
|
-
def set(name, value = nil)
|
303
|
-
if options[:help]
|
304
|
-
invoke :help, ['set']
|
305
|
-
else
|
306
|
-
require_relative 'config/set'
|
307
|
-
Newcli::Commands::Config::Set.new(name, value, options).execute
|
308
|
-
end
|
309
|
-
end
|
310
|
-
end
|
311
|
-
end
|
312
|
-
end
|
313
|
-
EOS
|
314
|
-
|
315
|
-
expect(::File.read('lib/newcli/commands/config/set.rb')).to eq <<-EOS
|
316
|
-
# frozen_string_literal: true
|
317
|
-
|
318
|
-
require_relative '../../command'
|
319
|
-
|
320
|
-
module Newcli
|
321
|
-
module Commands
|
322
|
-
class Config
|
323
|
-
class Set < Newcli::Command
|
324
|
-
def initialize(name, value, options)
|
325
|
-
@name = name
|
326
|
-
@value = value
|
327
|
-
@options = options
|
328
|
-
end
|
329
|
-
|
330
|
-
def execute(input: $stdin, output: $stdout)
|
331
|
-
# Command logic goes here ...
|
332
|
-
output.puts "OK"
|
333
|
-
end
|
334
|
-
end
|
335
|
-
end
|
336
|
-
end
|
337
|
-
end
|
338
|
-
EOS
|
339
|
-
end
|
340
|
-
end
|
341
|
-
end
|