tty-color 0.5.0 → 0.5.1

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
  SHA256:
3
- metadata.gz: 87b27bf2145b787f7a1b01a6f858f622a57b9c0e5414ca86362838fb54d2a4b0
4
- data.tar.gz: 2f042b82d11b6077b6bd6d77f5a3acc119ce0a2d393098d5af6c820b7bea5128
3
+ metadata.gz: 7c6e945ee8b1d795a7eb4e01edb5a799157f265a6d6b8019038c62df16ebb462
4
+ data.tar.gz: 6dedb67dfc1f2ebb5f11ec4c61fc1e0d7daf2cbf1135a2478ff6499f073772fe
5
5
  SHA512:
6
- metadata.gz: 58caee27992f3daccad7152795cec0edbb963c0ad0b7475d675a3923e0a4c37f2274af7b3318e0f6e08ca55d4cc6b724735526c6c4d1dd82825c359f86bec378
7
- data.tar.gz: 88b3ba6fd56c5eb91e040ddb8fb9db170ea41b000544a9e84d1d3909c6a2b8011bbf5baa3b5be64bf77f61061eaaf9229478d23e50bad463e78e291e92288995
6
+ metadata.gz: 04c8c4e58190b25d27f6706374faea7980df2d90437f910c4e61ace27b707e59279a6596f9bbaeaac52d4874dd1646621374539962b4fedff896c03d339b4695
7
+ data.tar.gz: c0323f675e1580d5c2cae34178f012d259c01ceb7f369e2c9c2afd5bcc67dee388bd7a6dfe1e4a417e600a456b6643575338a53182186d310364bd60bd4964d4
@@ -1,5 +1,10 @@
1
1
  # Change log
2
2
 
3
+ ## [v0.5.1] - 2020-01-22
4
+
5
+ ### Changed
6
+ * Change gemspec to add metadata and remove test artefacts
7
+
3
8
  ## [v0.5.0] - 2019-05-29
4
9
 
5
10
  ### Changed
@@ -59,6 +64,7 @@
59
64
 
60
65
  * Initial implementation and release
61
66
 
67
+ [v0.5.1]: https://github.com/piotrmurach/tty-color/compare/v0.5.0...v0.5.1
62
68
  [v0.5.0]: https://github.com/piotrmurach/tty-color/compare/v0.4.3...v0.5.0
63
69
  [v0.4.3]: https://github.com/piotrmurach/tty-color/compare/v0.4.2...v0.4.3
64
70
  [v0.4.2]: https://github.com/piotrmurach/tty-color/compare/v0.4.1...v0.4.2
data/README.md CHANGED
@@ -80,6 +80,12 @@ And to check color mode:
80
80
  color -m
81
81
  ```
82
82
 
83
+ ## Development
84
+
85
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
86
+
87
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
88
+
83
89
  ## Contributing
84
90
 
85
91
  Bug reports and pull requests are welcome on GitHub at https://github.com/piotrmurach/tty-color. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
@@ -90,6 +96,10 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/piotrm
90
96
  4. Push to the branch (`git push origin my-new-feature`)
91
97
  5. Create a new Pull Request
92
98
 
99
+ ## Code of Conduct
100
+
101
+ Everyone interacting in the TTY::Color project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/piotrmurach/tty-color/blob/master/CODE_OF_CONDUCT.md).
102
+
93
103
  ## Copyright
94
104
 
95
105
  Copyright (c) 2016 Piotr Murach. See LICENSE for further details.
@@ -2,6 +2,6 @@
2
2
 
3
3
  module TTY
4
4
  module Color
5
- VERSION = '0.5.0'
5
+ VERSION = "0.5.1"
6
6
  end # Color
7
7
  end # TTY
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tty-color
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Murach
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-29 00:00:00.000000000 Z
11
+ date: 2020-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -54,32 +54,31 @@ dependencies:
54
54
  version: '0'
55
55
  description: Terminal color capabilities detection
56
56
  email:
57
- - me@piotrmurach.com
57
+ - piotr@piotrmurach.com
58
58
  executables: []
59
59
  extensions: []
60
- extra_rdoc_files: []
60
+ extra_rdoc_files:
61
+ - README.md
62
+ - CHANGELOG.md
61
63
  files:
62
64
  - CHANGELOG.md
63
65
  - LICENSE.txt
64
66
  - README.md
65
- - Rakefile
66
67
  - lib/tty-color.rb
67
68
  - lib/tty/color.rb
68
69
  - lib/tty/color/mode.rb
69
70
  - lib/tty/color/support.rb
70
71
  - lib/tty/color/version.rb
71
- - spec/spec_helper.rb
72
- - spec/unit/color_spec.rb
73
- - spec/unit/mode_spec.rb
74
- - spec/unit/support_spec.rb
75
- - tasks/console.rake
76
- - tasks/coverage.rake
77
- - tasks/spec.rake
78
- - tty-color.gemspec
79
- homepage: http://piotrmurach.github.io/tty
72
+ homepage: https://ttytoolkit.org
80
73
  licenses:
81
74
  - MIT
82
- metadata: {}
75
+ metadata:
76
+ allowed_push_host: https://rubygems.org
77
+ bug_tracker_uri: https://github.com/piotrmurach/tty-prompt/issues
78
+ changelog_uri: https://github.com/piotrmurach/tty-prompt/blob/master/CHANGELOG.md
79
+ documentation_uri: https://www.rubydoc.info/gems/tty-prompt
80
+ homepage_uri: https://ttytoolkit.org
81
+ source_code_uri: https://github.com/piotrmurach/tty-prompt
83
82
  post_install_message:
84
83
  rdoc_options: []
85
84
  require_paths:
@@ -95,12 +94,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
94
  - !ruby/object:Gem::Version
96
95
  version: '0'
97
96
  requirements: []
98
- rubygems_version: 3.0.3
97
+ rubygems_version: 3.1.2
99
98
  signing_key:
100
99
  specification_version: 4
101
100
  summary: Terminal color capabilities detection
102
- test_files:
103
- - spec/spec_helper.rb
104
- - spec/unit/color_spec.rb
105
- - spec/unit/mode_spec.rb
106
- - spec/unit/support_spec.rb
101
+ test_files: []
data/Rakefile DELETED
@@ -1,8 +0,0 @@
1
- require "bundler/gem_tasks"
2
-
3
- FileList['tasks/**/*.rake'].each(&method(:import))
4
-
5
- desc 'Run all specs'
6
- task ci: %w[ spec ]
7
-
8
- task default: :spec
@@ -1,45 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- if ENV['COVERAGE'] || ENV['TRAVIS']
4
- require 'simplecov'
5
- require 'coveralls'
6
-
7
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
8
- SimpleCov::Formatter::HTMLFormatter,
9
- Coveralls::SimpleCov::Formatter
10
- ])
11
-
12
- SimpleCov.start do
13
- command_name 'spec'
14
- add_filter 'spec'
15
- end
16
- end
17
-
18
- require 'tty-color'
19
-
20
- RSpec.configure do |config|
21
- config.expect_with :rspec do |expectations|
22
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
23
- end
24
-
25
- config.mock_with :rspec do |mocks|
26
- mocks.verify_partial_doubles = true
27
- end
28
-
29
- # Limits the available syntax to the non-monkey patched syntax that is recommended.
30
- config.disable_monkey_patching!
31
-
32
- # This setting enables warnings. It's recommended, but in some cases may
33
- # be too noisy due to issues in dependencies.
34
- config.warnings = true
35
-
36
- if config.files_to_run.one?
37
- config.default_formatter = 'doc'
38
- end
39
-
40
- config.profile_examples = 2
41
-
42
- config.order = :random
43
-
44
- Kernel.srand config.seed
45
- end
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe TTY::Color, 'integratation' do
4
- it "defaults output to stderr" do
5
- expect(TTY::Color.output).to eq($stderr)
6
- end
7
-
8
- it "defaults verbose mode to false" do
9
- expect(TTY::Color.verbose).to eq(false)
10
- end
11
-
12
- it "accesses color mode" do
13
- mode_instance = spy(:mode)
14
- allow(TTY::Color::Mode).to receive(:new).and_return(mode_instance)
15
-
16
- described_class.mode
17
-
18
- expect(mode_instance).to have_received(:mode)
19
- end
20
-
21
- it "accesses color support" do
22
- support_instance = spy(:support)
23
- allow(TTY::Color::Support).to receive(:new).and_return(support_instance)
24
-
25
- described_class.support?
26
-
27
- expect(support_instance).to have_received(:support?)
28
- end
29
- end
@@ -1,108 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe TTY::Color::Mode, 'detecting mode' do
4
- it "isn't terminal" do
5
- allow(TTY::Color).to receive(:tty?).and_return(false)
6
- mode = described_class.new({})
7
- expect(mode.mode).to eq(0)
8
- end
9
-
10
- it "cannot find from term, tput " do
11
- allow(TTY::Color).to receive(:tty?).and_return(true)
12
- mode = described_class.new({})
13
- allow(mode).to receive(:from_term).and_return(TTY::Color::NoValue)
14
- allow(mode).to receive(:from_tput).and_return(TTY::Color::NoValue)
15
-
16
- expect(mode.mode).to eq(8)
17
- expect(mode).to have_received(:from_term).ordered
18
- expect(mode).to have_received(:from_tput).ordered
19
- end
20
-
21
- it "detects color mode" do
22
- allow(TTY::Color).to receive(:tty?).and_return(true)
23
- mode = described_class.new('TERM' => 'xterm-256color')
24
-
25
- expect(mode.mode).to eq(256)
26
- end
27
-
28
- context '#from_term' do
29
- it 'infers mode for xterm-256color' do
30
- mode = described_class.new('TERM' => 'xterm-256color')
31
- expect(mode.from_term).to eq(256)
32
- end
33
-
34
- it 'infers mode for iTerm.app' do
35
- mode = described_class.new('TERM' => 'iTerm.app')
36
- expect(mode.from_term).to eq(256)
37
- end
38
-
39
- it 'infers mode for iTerm 2.app' do
40
- mode = described_class.new('TERM' => 'iTerm 2.app')
41
- expect(mode.from_term).to eq(256)
42
- end
43
-
44
- it 'infers mode from terminal environment' do
45
- mode = described_class.new('TERM' => 'amiga-8bit')
46
- expect(mode.from_term).to eq(256)
47
- end
48
-
49
- it 'infers mode for wy730' do
50
- mode = described_class.new('TERM' => 'wy370-105k')
51
- expect(mode.from_term).to eq(64)
52
- end
53
-
54
- it 'infers mode for d430-unix-ccc' do
55
- mode = described_class.new('TERM' => 'd430-unix-ccc')
56
- expect(mode.from_term).to eq(52)
57
- end
58
-
59
- it 'infers mode for d430-unix-s-ccc' do
60
- mode = described_class.new('TERM' => 'd430c-unix-s-ccc')
61
- expect(mode.from_term).to eq(52)
62
- end
63
-
64
- it 'infers mode for nsterm-bce' do
65
- mode = described_class.new('TERM' => 'nsterm-bce')
66
- expect(mode.from_term).to eq(16)
67
- end
68
-
69
- it 'infers mode for d430-c' do
70
- mode = described_class.new('TERM' => 'd430c-dg')
71
- expect(mode.from_term).to eq(16)
72
- end
73
-
74
- it 'infers mode for d430-unix-w' do
75
- mode = described_class.new('TERM' => 'd430-unix-w')
76
- expect(mode.from_term).to eq(16)
77
- end
78
-
79
- it 'infers mode for vt100' do
80
- mode = described_class.new('TERM' => 'konsole-vt100')
81
- expect(mode.from_term).to eq(8)
82
- end
83
-
84
- it 'infers mode for xnuppc' do
85
- mode = described_class.new('TERM' => 'xnuppc+basic')
86
- expect(mode.from_term).to eq(8)
87
- end
88
-
89
- it 'infers mode fro dummy terminal' do
90
- mode = described_class.new('TERM' => 'dummy')
91
- expect(mode.from_term).to eq(0)
92
- end
93
-
94
- it "doesn't match any term variable" do
95
- mode = described_class.new({})
96
- expect(mode.from_term).to eq(TTY::Color::NoValue)
97
- end
98
- end
99
-
100
- context '#from_tput' do
101
- it "fails to find tput utilty" do
102
- mode = described_class.new({})
103
- cmd = "tput colors"
104
- allow(TTY::Color).to receive(:command?).with(cmd).and_return(nil)
105
- expect(mode.from_tput).to eq(TTY::Color::NoValue)
106
- end
107
- end
108
- end
@@ -1,129 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe TTY::Color::Support, '#support?' do
4
- it "doesn't check color support for non tty terminal" do
5
- support = described_class.new({})
6
- allow(TTY::Color).to receive(:tty?).and_return(false)
7
- expect(support.support?).to eq(false)
8
- end
9
-
10
- it "fails to find out color support" do
11
- support = described_class.new({})
12
- allow(TTY::Color).to receive(:tty?).and_return(true)
13
-
14
- allow(support).to receive(:from_curses).and_return(TTY::Color::NoValue)
15
- allow(support).to receive(:from_tput).and_return(TTY::Color::NoValue)
16
- allow(support).to receive(:from_term).and_return(TTY::Color::NoValue)
17
- allow(support).to receive(:from_env).and_return(TTY::Color::NoValue)
18
-
19
- expect(support.support?).to eq(false)
20
-
21
- expect(support).to have_received(:from_term).ordered
22
- expect(support).to have_received(:from_tput).ordered
23
- expect(support).to have_received(:from_env).ordered
24
- expect(support).to have_received(:from_curses).ordered
25
- end
26
-
27
- it "detects color support" do
28
- support = described_class.new('TERM' => 'xterm')
29
- allow(TTY::Color).to receive(:tty?).and_return(true)
30
- allow(support).to receive(:from_tput)
31
-
32
- expect(support.support?).to eq(true)
33
- expect(support).to_not have_received(:from_tput)
34
- end
35
-
36
- context '#from_curses' do
37
- it "fails to load curses for color support" do
38
- support = described_class.new({})
39
- allow(TTY::Color).to receive(:windows?).and_return(false)
40
- allow(support).to receive(:require).with('curses').and_raise(LoadError)
41
- allow(support).to receive(:warn)
42
-
43
- expect(support.from_curses).to eq(TTY::Color::NoValue)
44
- expect(support).to_not have_received(:warn)
45
- end
46
-
47
- it "fails to find Curses namespace" do
48
- support = described_class.new({})
49
- allow(TTY::Color).to receive(:windows?).and_return(false)
50
- allow(support).to receive(:require).with('curses')
51
-
52
- expect(support.from_curses).to eq(TTY::Color::NoValue)
53
- end
54
-
55
- it "sets verbose mode on" do
56
- support = described_class.new({}, verbose: true)
57
- allow(TTY::Color).to receive(:windows?).and_return(false)
58
- allow(support).to receive(:require).with('curses').and_raise(LoadError)
59
- allow(support).to receive(:warn)
60
-
61
- support.from_curses
62
-
63
- expect(support).to have_received(:warn).with(/no native curses support/)
64
- end
65
-
66
- it "loads curses for color support" do
67
- support = described_class.new({})
68
- allow(TTY::Color).to receive(:windows?).and_return(false)
69
- allow(support).to receive(:require).with('curses').and_return(true)
70
- stub_const("Curses", Object.new)
71
- curses = double(:curses)
72
- allow(curses).to receive(:init_screen)
73
- allow(curses).to receive(:has_colors?).and_return(true)
74
- allow(curses).to receive(:close_screen)
75
-
76
- expect(support.from_curses(curses)).to eql(true)
77
- expect(curses).to have_received(:has_colors?)
78
- end
79
-
80
- it "doesn't check on windows" do
81
- support = described_class.new({})
82
- allow(TTY::Color).to receive(:windows?).and_return(true)
83
- expect(support.from_curses).to eq(TTY::Color::NoValue)
84
- end
85
- end
86
-
87
- context '#form_term' do
88
- it "fails to find color for dumb terminal" do
89
- support = described_class.new('TERM' => 'dumb')
90
- expect(support.from_term).to eq(false)
91
- end
92
-
93
- it "inspects term variable for color capabilities" do
94
- support = described_class.new('TERM' => 'xterm')
95
- expect(support.from_term).to eq(true)
96
- end
97
-
98
- it "fails to find color capabilities from term variable " do
99
- support = described_class.new('TERM' => 'atari')
100
- expect(support.from_term).to eq(TTY::Color::NoValue)
101
- end
102
- end
103
-
104
- context '#from_tput' do
105
- it "fails to find tput utilty" do
106
- support = described_class.new({})
107
- cmd = "tput colors"
108
- allow(TTY::Color).to receive(:command?).with(cmd).and_return(nil)
109
- expect(support.from_tput).to eq(TTY::Color::NoValue)
110
- end
111
- end
112
-
113
- context '#from_env' do
114
- it "finds color support in colorterm variable" do
115
- support = described_class.new('COLORTERM' => true)
116
- expect(support.from_env).to eq(true)
117
- end
118
-
119
- it "finds ansicon support" do
120
- support = described_class.new('ANSICON' => true)
121
- expect(support.from_env).to eq(true)
122
- end
123
-
124
- it "doesn't find any keys in environment" do
125
- support = described_class.new({})
126
- expect(support.from_env).to eq(TTY::Color::NoValue)
127
- end
128
- end
129
- end
@@ -1,11 +0,0 @@
1
- # encoding: utf-8
2
-
3
- desc 'Load gem inside irb console'
4
- task :console do
5
- require 'irb'
6
- require 'irb/completion'
7
- require File.join(__FILE__, '../../lib/tty-color')
8
- ARGV.clear
9
- IRB.start
10
- end
11
- task c: :console
@@ -1,11 +0,0 @@
1
- # encoding: utf-8
2
-
3
- desc 'Measure code coverage'
4
- task :coverage do
5
- begin
6
- original, ENV['COVERAGE'] = ENV['COVERAGE'], 'true'
7
- Rake::Task['spec'].invoke
8
- ensure
9
- ENV['COVERAGE'] = original
10
- end
11
- end
@@ -1,29 +0,0 @@
1
- # encoding: utf-8
2
-
3
- begin
4
- require 'rspec/core/rake_task'
5
-
6
- desc 'Run all specs'
7
- RSpec::Core::RakeTask.new(:spec) do |task|
8
- task.pattern = 'spec/{unit,integration}{,/*/**}/*_spec.rb'
9
- end
10
-
11
- namespace :spec do
12
- desc 'Run unit specs'
13
- RSpec::Core::RakeTask.new(:unit) do |task|
14
- task.pattern = 'spec/unit{,/*/**}/*_spec.rb'
15
- end
16
-
17
- desc 'Run integration specs'
18
- RSpec::Core::RakeTask.new(:integration) do |task|
19
- task.pattern = 'spec/integration{,/*/**}/*_spec.rb'
20
- end
21
- end
22
-
23
- rescue LoadError
24
- %w[spec spec:unit spec:integration].each do |name|
25
- task name do
26
- $stderr.puts "In order to run #{name}, do `gem install rspec`"
27
- end
28
- end
29
- end
@@ -1,27 +0,0 @@
1
- lib = File.expand_path('../lib', __FILE__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require 'tty/color/version'
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = 'tty-color'
7
- spec.version = TTY::Color::VERSION
8
- spec.authors = ["Piotr Murach"]
9
- spec.email = ["me@piotrmurach.com"]
10
- spec.summary = %q{Terminal color capabilities detection}
11
- spec.description = %q{Terminal color capabilities detection}
12
- spec.homepage = "http://piotrmurach.github.io/tty"
13
- spec.license = "MIT"
14
-
15
- spec.files = Dir['{lib,spec}/**/*.rb']
16
- spec.files += Dir['tasks/*', 'tty-color.gemspec']
17
- spec.files += Dir['README.md', 'CHANGELOG.md', 'LICENSE.txt', 'Rakefile']
18
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
- spec.test_files = spec.files.grep(%r{^spec})
20
- spec.require_paths = ["lib"]
21
-
22
- spec.required_ruby_version = '>= 2.0.0'
23
-
24
- spec.add_development_dependency 'bundler', '>= 1.5.0'
25
- spec.add_development_dependency 'rspec', '~> 3.1'
26
- spec.add_development_dependency 'rake'
27
- end