pastel-cli 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +23 -2
- data/LICENSE.txt +1 -1
- data/README.md +32 -12
- data/exe/pastel +84 -0
- data/man/pastel.1 +51 -0
- metadata +42 -38
- data/.codeclimate.yml +0 -10
- data/.gitignore +0 -14
- data/.rspec +0 -3
- data/.travis.yml +0 -29
- data/Gemfile +0 -9
- data/Rakefile +0 -8
- data/bin/pastel +0 -65
- data/pastel-cli.gemspec +0 -21
- data/spec/spec_helper.rb +0 -45
- data/spec/unit/pastel_command_spec.rb +0 -44
- data/tasks/coverage.rake +0 -11
- data/tasks/spec.rake +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 55a12ba3005c00dde60de738e495714906689ec1b9de677bcd5b1f354f61c55d
|
4
|
+
data.tar.gz: a7450ef1193ea8da3188098465c5dc6a51637c1b8056315d09d5203737496e1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5062901611869c8f12d353c5c32d5c7e47fcabfb4c7b2bf8b6ac7d124223ab5ae0a5aaed0f755b95efd29afa594fc0b8c5b4ef16a71bb44adec280d12ddcae6
|
7
|
+
data.tar.gz: bdf73feed9d07555d073857613832ea7a1e6a49319cde583e909112ef73f6322869d8d27b7761506dacdd4079ae60559b54da10dfe7d8cb11da01fcaa26b7a5e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,24 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## [v0.4.0] - 2020-08-08
|
4
|
+
|
5
|
+
### Added
|
6
|
+
* Add -d option to specify delimiter character for separating content wrapped with styles
|
7
|
+
* Add --styles/-s option to display all available color names
|
8
|
+
* Add -v/--version to show Pastel dependency version
|
9
|
+
* Add -n option to skip printing the newline character
|
10
|
+
* Add pastel.1 man page
|
11
|
+
|
12
|
+
### Changed
|
13
|
+
* Change to rename --enabled option to --force/-f
|
14
|
+
* Change executable to print newline in terminal
|
15
|
+
* Change executable to stop raising error and exit with a message
|
16
|
+
* Change gemspec to remove test artefacts and restrict Ruby to 2.0.0 or higher
|
17
|
+
* Change to update pastel dependency
|
18
|
+
|
19
|
+
### Fixed
|
20
|
+
* Fix to preserve multi line content when piping
|
21
|
+
|
3
22
|
## [v0.3.0] - 2017-01-01
|
4
23
|
|
5
24
|
### Changed
|
@@ -14,5 +33,7 @@
|
|
14
33
|
|
15
34
|
Initial release
|
16
35
|
|
17
|
-
[v0.
|
18
|
-
[v0.
|
36
|
+
[v0.4.0]: https://github.com/piotrmurach/pastel-cli/compare/v0.3.0...v0.4.0
|
37
|
+
[v0.3.0]: https://github.com/piotrmurach/pastel-cli/compare/v0.2.0...v0.3.0
|
38
|
+
[v0.2.0]: https://github.com/piotrmurach/pastel-cli/compare/v0.1.0...v0.2.0
|
39
|
+
[v0.1.0]: https://github.com/piotrmurach/pastel-cli/compare/v0.1.0
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
# Pastel CLI
|
2
|
+
|
2
3
|
[![Gem Version](https://badge.fury.io/rb/pastel-cli.svg)][gem]
|
3
4
|
[![Build Status](https://secure.travis-ci.org/piotrmurach/pastel-cli.svg?branch=master)][travis]
|
4
|
-
[![
|
5
|
-
[![Coverage Status](https://coveralls.io/repos/github/piotrmurach/pastel-cli/badge.svg)][coverage]
|
5
|
+
[![Build status](https://ci.appveyor.com/api/projects/status/lqhbd9sy4rn8xdr2?svg=true)][appveyor]
|
6
6
|
|
7
7
|
[gem]: http://badge.fury.io/rb/pastel-cli
|
8
8
|
[travis]: http://travis-ci.org/piotrmurach/pastel-cli
|
9
|
-
[
|
10
|
-
[coverage]: https://coveralls.io/github/piotrmurach/pastel-cli
|
9
|
+
[appveyor]: https://ci.appveyor.com/project/piotrmurach/pastel-cli
|
11
10
|
|
12
11
|
> CLI tool for intuitive terminal output styling
|
13
12
|
|
@@ -18,7 +17,7 @@
|
|
18
17
|
Add this line to your application's Gemfile:
|
19
18
|
|
20
19
|
```ruby
|
21
|
-
gem
|
20
|
+
gem "pastel-cli"
|
22
21
|
```
|
23
22
|
|
24
23
|
And then execute:
|
@@ -31,22 +30,39 @@ Or install it yourself as:
|
|
31
30
|
|
32
31
|
## Usage
|
33
32
|
|
34
|
-
To color output in green
|
33
|
+
To color output in green do:
|
34
|
+
|
35
|
+
```bash
|
36
|
+
$ pastel green " ✔ OK "
|
37
|
+
```
|
38
|
+
|
39
|
+
Apart from foreground color, you can also provide background and style like so:
|
35
40
|
|
36
41
|
```bash
|
37
|
-
$ pastel
|
42
|
+
$ pastel black bold on_green " ✔ OK "
|
38
43
|
```
|
39
44
|
|
40
|
-
|
45
|
+
It supports pipping input:
|
41
46
|
|
42
47
|
```bash
|
43
|
-
$
|
48
|
+
$ echo -n " ✔ OK " | pastel black bold on_green
|
44
49
|
```
|
45
50
|
|
46
|
-
|
51
|
+
To see all available styles and color names use `--styles/-s` option:
|
47
52
|
|
48
53
|
```bash
|
49
|
-
$
|
54
|
+
$ pastel --styles
|
55
|
+
```
|
56
|
+
|
57
|
+
This will produce the following in the terminal:
|
58
|
+
|
59
|
+
```bash
|
60
|
+
Swatch Name
|
61
|
+
◼ pastel bold
|
62
|
+
◼ pastel dark
|
63
|
+
◼ pastel dim
|
64
|
+
◼ pastel italic
|
65
|
+
...
|
50
66
|
```
|
51
67
|
|
52
68
|
## Contributing
|
@@ -57,6 +73,10 @@ $ echo 'Unicorns & rainbows!' | pastel green
|
|
57
73
|
4. Push to the branch (`git push origin my-new-feature`)
|
58
74
|
5. Create a new Pull Request
|
59
75
|
|
76
|
+
## Code of Conduct
|
77
|
+
|
78
|
+
Everyone interacting in the Pastel CLI project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/piotrmurach/tty-option/blob/master/CODE_OF_CONDUCT.md).
|
79
|
+
|
60
80
|
## Copyright
|
61
81
|
|
62
|
-
Copyright (c) 2016
|
82
|
+
Copyright (c) 2016 Piotr Murach. See LICENSE for further details.
|
data/exe/pastel
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
Signal.trap("INT") { exit 1 }
|
4
|
+
|
5
|
+
require "pastel"
|
6
|
+
require "optparse"
|
7
|
+
|
8
|
+
# Return an unescaped version of delimiter
|
9
|
+
#
|
10
|
+
# @example
|
11
|
+
# unescape("foo\\nbar") => "foo\nbar"
|
12
|
+
#
|
13
|
+
def unescape(str)
|
14
|
+
escable = {
|
15
|
+
'\n' => "\n",
|
16
|
+
'\r' => "\r",
|
17
|
+
'\t' => "\t",
|
18
|
+
'\f' => "\f",
|
19
|
+
'\v' => "\v"
|
20
|
+
}
|
21
|
+
str.gsub(/\\[nrtfv]/) { |m| escable[m] }
|
22
|
+
end
|
23
|
+
|
24
|
+
options = {}
|
25
|
+
config = { newline: true }
|
26
|
+
|
27
|
+
ARGV << "-h" if ARGV.empty?
|
28
|
+
|
29
|
+
parser = OptionParser.new do |opts|
|
30
|
+
opts.banner = "Usage: pastel [options] style [style ...] [text]"
|
31
|
+
|
32
|
+
opts.on("-d delim", "Specify character to use to split input coloring") do |val|
|
33
|
+
val = val[1..-1] if val.start_with?("=")
|
34
|
+
options[:eachline] = unescape(val)
|
35
|
+
end
|
36
|
+
|
37
|
+
opts.on("-f", "--force", "Force output coloring regardless of terminal support") do
|
38
|
+
options[:enabled] = true
|
39
|
+
end
|
40
|
+
|
41
|
+
opts.on("-n", "Skip printing the trailing newline character") do
|
42
|
+
config[:newline] = false
|
43
|
+
end
|
44
|
+
|
45
|
+
opts.on("-s", "--styles", "Print all available color and style names") do
|
46
|
+
ops = (ARGV.include?("--force") || ARGV.include?("-f")) ? {enabled: true} : {}
|
47
|
+
ops.merge!(options)
|
48
|
+
pastel = Pastel.new(**ops)
|
49
|
+
puts "Swatch Name"
|
50
|
+
pastel.styles.keys.each do |name|
|
51
|
+
next if %i[clear reset].include?(name)
|
52
|
+
puts "%s %s" % [pastel.decorate("◼ pastel", name), name]
|
53
|
+
end
|
54
|
+
exit
|
55
|
+
end
|
56
|
+
|
57
|
+
opts.on("-h", "--help", "Print this message and exit") do
|
58
|
+
puts opts
|
59
|
+
exit
|
60
|
+
end
|
61
|
+
|
62
|
+
opts.on("-v", "--version", "Print version information and exit") do
|
63
|
+
puts "0.4.0 (pastel #{Pastel::VERSION})"
|
64
|
+
exit
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
begin
|
69
|
+
parser.parse!
|
70
|
+
rescue OptionParser::ParseError => error
|
71
|
+
puts error.message
|
72
|
+
exit 1
|
73
|
+
end
|
74
|
+
|
75
|
+
text = STDIN.tty? ? ARGV.pop : $stdin.read
|
76
|
+
|
77
|
+
pastel = Pastel.new(**options)
|
78
|
+
|
79
|
+
begin
|
80
|
+
print pastel.decorate(text, *ARGV.map(&:to_sym)) + (config[:newline] ? "\n" : "")
|
81
|
+
rescue Pastel::InvalidAttributeNameError => error
|
82
|
+
puts error.message
|
83
|
+
exit 1
|
84
|
+
end
|
data/man/pastel.1
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
.\" generated by kramdown
|
2
|
+
.TH "PASTEL" "1"
|
3
|
+
.SH "NAME"
|
4
|
+
\fBpastel\fP \(em color and style text in the terminal
|
5
|
+
.SH "SYNOPSIS"
|
6
|
+
\fBpastel\fP [\(emforce|\-d delim] style [style \.\.\.] [text]
|
7
|
+
.P
|
8
|
+
\fBpastel\fP \(emstyles|\-s
|
9
|
+
.SH "DESCRIPTION"
|
10
|
+
The \fBpastel\fP utility applies colors and style to terminal output\. It accepts as arguments a foreground color and/or background color name and/or style name like bold followed by the text to be styled\. The input can also be piped from another command\.
|
11
|
+
.P
|
12
|
+
The options are as follows:
|
13
|
+
.TP
|
14
|
+
\fB\-d\fP delim
|
15
|
+
Specifies character to use to split string input for coloring\.
|
16
|
+
.TP
|
17
|
+
\fB\-f\fP \fB\-\-force\fP
|
18
|
+
Forces string coloring regardless whether terminal supports ANSI escape color sequences or not\.
|
19
|
+
.TP
|
20
|
+
\fB\-n\fP
|
21
|
+
Skips printing the trailing newline character\.
|
22
|
+
.TP
|
23
|
+
\fB\-s\fP, \fB\-\-styles\fP
|
24
|
+
Prints all available color and style names\.
|
25
|
+
.TP
|
26
|
+
\fB\-v\fP, \fB\-\-version\fP
|
27
|
+
Shows the version of pastel\.
|
28
|
+
.SH "EXAMPLES"
|
29
|
+
Print the \[u2018]foo\[u2019] string to the standard output in green color:
|
30
|
+
.P
|
31
|
+
pastel green foo
|
32
|
+
.P
|
33
|
+
Print the \[u2018]foo\[u2019] string to the standard output in green color and on the red background:
|
34
|
+
.P
|
35
|
+
pastel green on_red foo
|
36
|
+
.P
|
37
|
+
Read the content \[u2018]foo\[u2019] and pipe it to pastel to print to standard output:
|
38
|
+
.sp
|
39
|
+
.RS 4
|
40
|
+
.EX
|
41
|
+
echo foo | pastel green
|
42
|
+
.EE
|
43
|
+
.RE
|
44
|
+
.SH "EXIT STATUS"
|
45
|
+
The \fBpastel\fP utility exits 0 on success, and 1 if an error occurs\.
|
46
|
+
.SH "SEE ALSO"
|
47
|
+
The pastel readme https://github\.com/piotrmurach/pastel
|
48
|
+
.SH "AUTHOR"
|
49
|
+
The \fBpastel\fP utility is written by Piotr Murach <piotr@piotrmurach\.com>
|
50
|
+
.P
|
51
|
+
Website: https://ttytoolkit\.org
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pastel-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Murach
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pastel
|
@@ -16,34 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: '0.8'
|
20
20
|
type: :runtime
|
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.
|
26
|
+
version: '0.8'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: kramdown
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
34
|
-
- - "<"
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: '2.0'
|
33
|
+
version: '1.17'
|
37
34
|
type: :development
|
38
35
|
prerelease: false
|
39
36
|
version_requirements: !ruby/object:Gem::Requirement
|
40
37
|
requirements:
|
41
38
|
- - ">="
|
42
39
|
- !ruby/object:Gem::Version
|
43
|
-
version: 1.
|
44
|
-
- - "<"
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '2.0'
|
40
|
+
version: '1.17'
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
42
|
name: rake
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,33 +52,46 @@ dependencies:
|
|
58
52
|
- - ">="
|
59
53
|
- !ruby/object:Gem::Version
|
60
54
|
version: '0'
|
61
|
-
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
description: A command-line tool for coloring and styling text in the ternimal
|
62
70
|
email:
|
63
|
-
-
|
71
|
+
- piotr@piotrmurach.com
|
64
72
|
executables:
|
65
73
|
- pastel
|
66
74
|
extensions: []
|
67
|
-
extra_rdoc_files:
|
75
|
+
extra_rdoc_files:
|
76
|
+
- README.md
|
77
|
+
- CHANGELOG.md
|
78
|
+
- LICENSE.txt
|
68
79
|
files:
|
69
|
-
- ".codeclimate.yml"
|
70
|
-
- ".gitignore"
|
71
|
-
- ".rspec"
|
72
|
-
- ".travis.yml"
|
73
80
|
- CHANGELOG.md
|
74
|
-
- Gemfile
|
75
81
|
- LICENSE.txt
|
76
82
|
- README.md
|
77
|
-
-
|
78
|
-
-
|
79
|
-
|
80
|
-
- spec/spec_helper.rb
|
81
|
-
- spec/unit/pastel_command_spec.rb
|
82
|
-
- tasks/coverage.rake
|
83
|
-
- tasks/spec.rake
|
84
|
-
homepage: ''
|
83
|
+
- exe/pastel
|
84
|
+
- man/pastel.1
|
85
|
+
homepage: https://ttytoolkit.org
|
85
86
|
licenses:
|
86
87
|
- MIT
|
87
|
-
metadata:
|
88
|
+
metadata:
|
89
|
+
allowed_push_host: https://rubygems.org
|
90
|
+
bug_tracker_uri: https://github.com/piotrmurach/pastel-cli/issues
|
91
|
+
changelog_uri: https://github.com/piotrmurach/pastel-cli/blob/master/CHANGELOG.md
|
92
|
+
documentation_uri: https://www.rubydoc.info/gems/pastel-cli
|
93
|
+
homepage_uri: https://ttytoolkit.org
|
94
|
+
source_code_uri: https://github.com/piotrmurach/pastel-cli
|
88
95
|
post_install_message:
|
89
96
|
rdoc_options: []
|
90
97
|
require_paths:
|
@@ -93,18 +100,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
93
100
|
requirements:
|
94
101
|
- - ">="
|
95
102
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
103
|
+
version: 2.0.0
|
97
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
105
|
requirements:
|
99
106
|
- - ">="
|
100
107
|
- !ruby/object:Gem::Version
|
101
108
|
version: '0'
|
102
109
|
requirements: []
|
103
|
-
|
104
|
-
rubygems_version: 2.5.1
|
110
|
+
rubygems_version: 3.1.2
|
105
111
|
signing_key:
|
106
112
|
specification_version: 4
|
107
|
-
summary:
|
108
|
-
test_files:
|
109
|
-
- spec/spec_helper.rb
|
110
|
-
- spec/unit/pastel_command_spec.rb
|
113
|
+
summary: A command-line tool for coloring and styling text in the terminal
|
114
|
+
test_files: []
|
data/.codeclimate.yml
DELETED
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
---
|
2
|
-
language: ruby
|
3
|
-
sudo: false
|
4
|
-
cache: bundler
|
5
|
-
script: "bundle exec rake ci"
|
6
|
-
rvm:
|
7
|
-
- 2.0.0
|
8
|
-
- 2.1.10
|
9
|
-
- 2.2.6
|
10
|
-
- 2.3.3
|
11
|
-
- 2.4.0
|
12
|
-
- ruby-head
|
13
|
-
- jruby-9000
|
14
|
-
- jruby-head
|
15
|
-
- rbx-3
|
16
|
-
env:
|
17
|
-
global:
|
18
|
-
- JRUBY_OPTS='--dev -J-Xmx1024M'
|
19
|
-
matrix:
|
20
|
-
allow_failures:
|
21
|
-
- rvm: ruby-head
|
22
|
-
- rvm: jruby-head
|
23
|
-
- rvm: jruby-9000
|
24
|
-
- rvm: rbx-3
|
25
|
-
fast_finish: true
|
26
|
-
branches:
|
27
|
-
only: master
|
28
|
-
notifications:
|
29
|
-
email: false
|
data/Gemfile
DELETED
data/Rakefile
DELETED
data/bin/pastel
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
Signal.trap("INT") { exit 1 }
|
4
|
-
|
5
|
-
require 'pastel'
|
6
|
-
|
7
|
-
help = <<-EOS
|
8
|
-
PASTEL(1)
|
9
|
-
|
10
|
-
NAME
|
11
|
-
patel -- color string and print
|
12
|
-
|
13
|
-
SYNOPSIS
|
14
|
-
pastel [--enabled] style [style ...] TEXT
|
15
|
-
|
16
|
-
DESCRIPTION
|
17
|
-
Use this command line tool to apply colors and style to terminal output.
|
18
|
-
|
19
|
-
All the extra parameters can be applied individually or mixed to create
|
20
|
-
desired effect.
|
21
|
-
|
22
|
-
The options:
|
23
|
-
--enabled This option causes pastel to enforce string coloring
|
24
|
-
regardless whether terminal supports ANSI escape color
|
25
|
-
sequences or not.
|
26
|
-
|
27
|
-
EXAMPLES
|
28
|
-
The command:
|
29
|
-
|
30
|
-
pastel green foo
|
31
|
-
|
32
|
-
will print the 'foo' string to the standard output in green color.
|
33
|
-
|
34
|
-
The command:
|
35
|
-
|
36
|
-
pastel green on_red foo
|
37
|
-
|
38
|
-
will print the 'foo' string to the standard output in green color and
|
39
|
-
on the red background.
|
40
|
-
|
41
|
-
The command:
|
42
|
-
|
43
|
-
echo foo | pastel green
|
44
|
-
|
45
|
-
will read the content 'foo' and pipe it to pastel to print to standard
|
46
|
-
output.
|
47
|
-
|
48
|
-
SEE ALSO
|
49
|
-
https://github.com/peter-murach/pastel
|
50
|
-
EOS
|
51
|
-
opts = {}
|
52
|
-
|
53
|
-
if ARGV.empty? || ARGV.any? { |a| %w(--help -h).include?(a) }
|
54
|
-
puts help
|
55
|
-
exit
|
56
|
-
elsif !(index = ARGV.index('--enabled')).nil?
|
57
|
-
ARGV.delete_at(index)
|
58
|
-
opts = {enabled: true}
|
59
|
-
end
|
60
|
-
|
61
|
-
text = STDIN.tty? ? ARGV.pop : $stdin.read.chomp
|
62
|
-
|
63
|
-
pastel = Pastel.new(opts)
|
64
|
-
|
65
|
-
print pastel.decorate(text, *ARGV.map(&:to_sym))
|
data/pastel-cli.gemspec
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
Gem::Specification.new do |spec|
|
4
|
-
spec.name = 'pastel-cli'
|
5
|
-
spec.version = '0.3.0'
|
6
|
-
spec.authors = ['Piotr Murach']
|
7
|
-
spec.email = ['']
|
8
|
-
spec.summary = %q{CLI tool for intuitive terminal output styling}
|
9
|
-
spec.description = %q{CLI tool for intuitive terminal output styling}
|
10
|
-
spec.homepage = ""
|
11
|
-
spec.license = "MIT"
|
12
|
-
|
13
|
-
spec.files = `git ls-files -z`.split("\x0")
|
14
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
15
|
-
spec.test_files = spec.files.grep(%r{^spec/})
|
16
|
-
|
17
|
-
spec.add_dependency 'pastel', '~> 0.7.0'
|
18
|
-
|
19
|
-
spec.add_development_dependency 'bundler', '>= 1.5.0', '< 2.0'
|
20
|
-
spec.add_development_dependency 'rake'
|
21
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
$:.unshift File.expand_path("../../bin", __FILE__)
|
4
|
-
|
5
|
-
if RUBY_VERSION > '1.9' and (ENV['COVERAGE'] || ENV['TRAVIS'])
|
6
|
-
require 'simplecov'
|
7
|
-
require 'coveralls'
|
8
|
-
|
9
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
10
|
-
SimpleCov::Formatter::HTMLFormatter,
|
11
|
-
Coveralls::SimpleCov::Formatter
|
12
|
-
]
|
13
|
-
|
14
|
-
SimpleCov.start do
|
15
|
-
command_name 'spec'
|
16
|
-
add_filter 'spec'
|
17
|
-
end
|
18
|
-
end
|
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,44 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
RSpec.describe 'pastel command' do
|
4
|
-
|
5
|
-
it 'runs without arguments and shows help' do
|
6
|
-
expect(`bin/pastel`).to match(/PASTEL\(1\)/)
|
7
|
-
expect($?.exitstatus).to eq(0)
|
8
|
-
end
|
9
|
-
|
10
|
-
it "runs with --help/-h flags" do
|
11
|
-
expect(`bin/pastel`).to match(/PASTEL\(1\)/)
|
12
|
-
expect($?.exitstatus).to eq(0)
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'runs with text only' do
|
16
|
-
expect(`bin/pastel foo`).to match(/foo/)
|
17
|
-
expect($?.exitstatus).to eq(0)
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'runs with foreground option' do
|
21
|
-
expect(`bin/pastel green foo`).to match(/\e\[32mfoo\e\[0m/)
|
22
|
-
expect($?.exitstatus).to eq(0)
|
23
|
-
end
|
24
|
-
|
25
|
-
it "runs with foreground & background options" do
|
26
|
-
expect(`bin/pastel green on_red foo`).to match(/\e\[32;41mfoo\e\[0m/)
|
27
|
-
expect($?.exitstatus).to eq(0)
|
28
|
-
end
|
29
|
-
|
30
|
-
it "runs with foreground & background & style options" do
|
31
|
-
expect(`bin/pastel green on_red bold foo`).to match(/\e\[32;41;1mfoo\e\[0m/)
|
32
|
-
expect($?.exitstatus).to eq(0)
|
33
|
-
end
|
34
|
-
|
35
|
-
it "runs with piped input" do
|
36
|
-
expect(`echo foo | bin/pastel green`).to match(/\e\[32mfoo\e\[0m/)
|
37
|
-
expect($?.exitstatus).to eq(0)
|
38
|
-
end
|
39
|
-
|
40
|
-
it "runs with --enabled option" do
|
41
|
-
expect(`bin/pastel --enabled green foo`).to match(/\e\[32mfoo\e\[0m/)
|
42
|
-
expect($?.exitstatus).to eq(0)
|
43
|
-
end
|
44
|
-
end
|
data/tasks/coverage.rake
DELETED
data/tasks/spec.rake
DELETED
@@ -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
|