suppository 0.0.3 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Guardfile +2 -2
- data/README.md +1 -1
- data/Rakefile +7 -7
- data/bin/suppository +4 -8
- data/lib/suppository/add_command.rb +14 -5
- data/lib/suppository/release.rb +2 -2
- data/lib/suppository/repository.rb +2 -2
- data/lib/suppository/version.rb +1 -1
- data/spec/spec_helper.rb +11 -16
- data/spec/suppository/add_command_spec.rb +37 -41
- data/spec/suppository/cli_spec.rb +19 -22
- data/spec/suppository/command_runner_spec.rb +5 -10
- data/spec/suppository/create_command_spec.rb +22 -27
- data/spec/suppository/dpkg_deb_line_spec.rb +10 -13
- data/spec/suppository/dpkg_deb_spec.rb +25 -29
- data/spec/suppository/gzip_spec.rb.rb +4 -6
- data/spec/suppository/help_command_spec.rb +2 -5
- data/spec/suppository/help_spec.rb +1 -4
- data/spec/suppository/logger_spec.rb +17 -27
- data/spec/suppository/master_deb_spec.rb +30 -39
- data/spec/suppository/package_spec.rb +32 -37
- data/spec/suppository/release_spec.rb +1 -0
- data/spec/suppository/repository_spec.rb +20 -25
- data/spec/suppository/tty_spec.rb +24 -39
- data/spec/suppository/version_command_spec.rb +2 -5
- data/spec/suppository/version_spec.rb +1 -5
- data/spec/suppository_spec.rb +23 -31
- data/suppository.gemspec +17 -18
- metadata +2 -2
@@ -3,63 +3,59 @@ require 'spec_helper'
|
|
3
3
|
require 'suppository/dpkg_deb'
|
4
4
|
|
5
5
|
describe Suppository::DpkgDeb do
|
6
|
-
|
7
6
|
before(:each) do
|
8
7
|
@instance = Suppository::DpkgDeb.new deb_file
|
9
8
|
end
|
10
|
-
|
11
|
-
it
|
9
|
+
|
10
|
+
it 'package' do
|
12
11
|
expect(@instance.attibutes['Package']).to eql 'curl'
|
13
12
|
end
|
14
|
-
|
15
|
-
it
|
13
|
+
|
14
|
+
it 'version' do
|
16
15
|
expect(@instance.attibutes['Version']).to eql '7.22.0-3ubuntu4.11'
|
17
16
|
end
|
18
|
-
|
19
|
-
it
|
17
|
+
|
18
|
+
it 'architecture' do
|
20
19
|
expect(@instance.attibutes['Architecture']).to eql 'amd64'
|
21
20
|
end
|
22
|
-
|
23
|
-
it
|
21
|
+
|
22
|
+
it 'maintainer' do
|
24
23
|
expect(@instance.attibutes['Maintainer']).to eql 'Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>'
|
25
24
|
end
|
26
|
-
|
27
|
-
it
|
25
|
+
|
26
|
+
it 'installed size' do
|
28
27
|
expect(@instance.attibutes['Installed-Size']).to eql '345'
|
29
28
|
end
|
30
|
-
|
31
|
-
it
|
29
|
+
|
30
|
+
it 'depends' do
|
32
31
|
expect(@instance.attibutes['Depends']).to eql 'libc6 (>= 2.14), libcurl3 (>= 7.16.2-1), zlib1g (>= 1:1.1.4)'
|
33
32
|
end
|
34
|
-
|
35
|
-
it
|
33
|
+
|
34
|
+
it 'replaces' do
|
36
35
|
expect(@instance.attibutes['Replaces']).to eql 'curl-ssl'
|
37
36
|
end
|
38
|
-
|
39
|
-
it
|
37
|
+
|
38
|
+
it 'provides' do
|
40
39
|
expect(@instance.attibutes['Provides']).to eql 'curl-ssl'
|
41
40
|
end
|
42
|
-
|
43
|
-
it
|
41
|
+
|
42
|
+
it 'section' do
|
44
43
|
expect(@instance.attibutes['Section']).to eql 'web'
|
45
44
|
end
|
46
45
|
|
47
|
-
it
|
46
|
+
it 'priority' do
|
48
47
|
expect(@instance.attibutes['Priority']).to eql 'optional'
|
49
48
|
end
|
50
|
-
|
51
|
-
it
|
49
|
+
|
50
|
+
it 'homepage' do
|
52
51
|
expect(@instance.attibutes['Homepage']).to eql 'http://curl.haxx.se'
|
53
52
|
end
|
54
|
-
|
55
|
-
it
|
53
|
+
|
54
|
+
it 'description' do
|
56
55
|
expect(@instance.attibutes['Description']).to eql "Get a file from an HTTP, HTTPS or FTP server curl is a client to get files from servers using any of the supported\n protocols. The command is designed to work without user interaction\n or any kind of interactivity.\n .\n curl offers a busload of useful tricks like proxy support, user\n authentication, FTP upload, HTTP post, file transfer resume and more.\n"
|
57
56
|
end
|
58
|
-
|
59
|
-
it
|
57
|
+
|
58
|
+
it 'original_maintainer' do
|
60
59
|
expect(@instance.attibutes['Original-Maintainer']).to eql 'Ramakrishnan Muthukrishnan <rkrishnan@debian.org>'
|
61
60
|
end
|
62
|
-
|
63
|
-
|
64
61
|
end
|
65
|
-
|
@@ -3,20 +3,18 @@ require 'spec_helper'
|
|
3
3
|
require 'suppository/gzip'
|
4
4
|
|
5
5
|
describe Suppository::Gzip do
|
6
|
-
|
7
6
|
before(:each) do
|
8
7
|
@file = "/tmp/gzip_test_#{Time.now.to_f}.txt"
|
9
8
|
@file_gz = "#{@file}.gz"
|
10
9
|
end
|
11
|
-
|
10
|
+
|
12
11
|
after(:each) do
|
13
12
|
FileUtils.rm @file if File.exist? @file
|
14
13
|
FileUtils.rm @file_gz if File.exist? @file_gz
|
15
14
|
end
|
16
|
-
|
17
|
-
it
|
15
|
+
|
16
|
+
it 'compress' do
|
18
17
|
Suppository::Gzip.compress @file
|
19
18
|
expect(Zlib::GzipReader.open(@file_gz)).to be_truthy
|
20
19
|
end
|
21
|
-
|
22
|
-
end
|
20
|
+
end
|
@@ -3,11 +3,8 @@ require 'spec_helper'
|
|
3
3
|
require 'suppository/help_command'
|
4
4
|
|
5
5
|
describe Suppository::HelpCommand do
|
6
|
-
|
7
|
-
it "shows help" do
|
6
|
+
it 'shows help' do
|
8
7
|
command = Suppository::HelpCommand.new([])
|
9
|
-
expect{command.run}.to output(Suppository.help).to_stdout
|
8
|
+
expect { command.run }.to output(Suppository.help).to_stdout
|
10
9
|
end
|
11
|
-
|
12
10
|
end
|
13
|
-
|
@@ -3,10 +3,7 @@ require 'spec_helper'
|
|
3
3
|
require 'suppository/help'
|
4
4
|
|
5
5
|
describe Suppository do
|
6
|
-
|
7
|
-
it "has usage string" do
|
6
|
+
it 'has usage string' do
|
8
7
|
expect(Suppository.help).to eql("Example usage:\n\n suppository help\n - Display this Help message\n\n suppository version\n - Display version\n\n suppository create <REPOSITORY_PATH>\n - Create new empty repository in REPOSITORY_PATH\n\n suppository add <REPOSITORY_PATH> <DIST> <COMPONENT> <DEB_FILE> [--unsigned]\n - Add DEB_FILE to DIST and COMPONENT of repository at REPOSITORY_PATH\n\n")
|
9
8
|
end
|
10
9
|
end
|
11
|
-
|
12
|
-
|
@@ -3,62 +3,52 @@ require 'spec_helper'
|
|
3
3
|
require 'suppository/logger'
|
4
4
|
|
5
5
|
describe Suppository::Logger do
|
6
|
-
|
7
6
|
describe 'log_error' do
|
8
|
-
|
9
|
-
it "decorated output tty? true" do
|
7
|
+
it 'decorated output tty? true' do
|
10
8
|
expect($stdout).to receive(:tty?).twice.and_return(true)
|
11
9
|
expect($stderr).to receive(:puts).with("\e[4;31mError\e[0m: Boom")
|
12
|
-
Suppository::Logger.log_error
|
10
|
+
Suppository::Logger.log_error 'Boom'
|
13
11
|
end
|
14
|
-
|
15
|
-
it
|
12
|
+
|
13
|
+
it 'simple output if tty? false' do
|
16
14
|
expect($stdout).to receive(:tty?).twice.and_return(false)
|
17
|
-
expect($stderr).to receive(:puts).with(
|
18
|
-
Suppository::Logger.log_error
|
15
|
+
expect($stderr).to receive(:puts).with('Error: Boom')
|
16
|
+
Suppository::Logger.log_error 'Boom'
|
19
17
|
end
|
20
|
-
|
21
18
|
end
|
22
|
-
|
19
|
+
|
23
20
|
describe 'log_error' do
|
24
|
-
|
25
|
-
it "print to standard out" do
|
21
|
+
it 'print to standard out' do
|
26
22
|
expect(Suppository::Logger).to receive(:puts).with('Info Message')
|
27
23
|
Suppository::Logger.log_info 'Info Message'
|
28
24
|
end
|
29
|
-
|
30
25
|
end
|
31
|
-
|
26
|
+
|
32
27
|
describe 'log_verbose' do
|
33
|
-
|
34
|
-
it "decorated output tty? true" do
|
28
|
+
it 'decorated output tty? true' do
|
35
29
|
expect($stdout).to receive(:tty?).twice.and_return(true)
|
36
30
|
expect(Suppository::Logger).to receive(:puts).with("\e[1;30mVerbose Message\e[0m")
|
37
31
|
Suppository::Logger.log_verbose 'Verbose Message'
|
38
32
|
end
|
39
|
-
|
40
|
-
it
|
33
|
+
|
34
|
+
it 'simple output if tty? false' do
|
41
35
|
expect($stdout).to receive(:tty?).twice.and_return(false)
|
42
36
|
expect(Suppository::Logger).to receive(:puts).with('Verbose Message')
|
43
37
|
Suppository::Logger.log_verbose 'Verbose Message'
|
44
38
|
end
|
45
|
-
|
46
39
|
end
|
47
|
-
|
40
|
+
|
48
41
|
describe 'log_success' do
|
49
|
-
|
50
|
-
it "decorated output tty? true" do
|
42
|
+
it 'decorated output tty? true' do
|
51
43
|
expect($stdout).to receive(:tty?).exactly(3).times.and_return(true)
|
52
44
|
expect(Suppository::Logger).to receive(:puts).with("\e[1;32m==>\e[1;39m Success Message\e[0m")
|
53
45
|
Suppository::Logger.log_success 'Success Message'
|
54
46
|
end
|
55
|
-
|
56
|
-
it
|
47
|
+
|
48
|
+
it 'simple output if tty? false' do
|
57
49
|
expect($stdout).to receive(:tty?).exactly(3).times.and_return(false)
|
58
50
|
expect(Suppository::Logger).to receive(:puts).with('==> Success Message')
|
59
51
|
Suppository::Logger.log_success 'Success Message'
|
60
52
|
end
|
61
|
-
|
62
53
|
end
|
63
|
-
|
64
|
-
end
|
54
|
+
end
|
@@ -5,80 +5,71 @@ require 'suppository/dpkg_deb'
|
|
5
5
|
require 'suppository/repository'
|
6
6
|
|
7
7
|
describe Suppository::MasterDeb do
|
8
|
-
|
9
8
|
before(:all) do
|
10
9
|
@valid_file_name = 'e5ca0a9797acda4bfe8404524f0976b3_b37ce9b17405d93c323c0b8bbe167c6f2dccfe02_5a315c56bc34f1ffed365f9aa50bbb36916e5a8fae8614f00d952983d4316555.deb'
|
11
10
|
end
|
12
|
-
|
11
|
+
|
13
12
|
before(:each) do
|
14
|
-
@repository = Suppository::Repository.new "/tmp/
|
13
|
+
@repository = Suppository::Repository.new "/tmp/suppository_test_#{Time.now.to_f}"
|
15
14
|
master_deb_file = "#{@repository.suppository}/#{@valid_file_name}"
|
16
15
|
FileUtils.mkdir_p @repository.suppository
|
17
|
-
FileUtils.cp deb_file, master_deb_file
|
16
|
+
FileUtils.cp deb_file, master_deb_file
|
18
17
|
@instance = Suppository::MasterDeb.new(master_deb_file)
|
19
18
|
end
|
20
|
-
|
21
|
-
|
19
|
+
|
22
20
|
after(:each) do
|
23
|
-
|
21
|
+
FileUtils.rm_r @repository.path
|
24
22
|
end
|
25
|
-
|
26
|
-
describe 'valid file' do
|
27
|
-
|
28
|
-
it "md5sum" do
|
23
|
+
|
24
|
+
describe 'valid file' do
|
25
|
+
it 'md5sum' do
|
29
26
|
expect(@instance.md5sum).to eql 'e5ca0a9797acda4bfe8404524f0976b3'
|
30
27
|
end
|
31
|
-
|
32
|
-
it
|
28
|
+
|
29
|
+
it 'sha1' do
|
33
30
|
expect(@instance.sha1).to eql 'b37ce9b17405d93c323c0b8bbe167c6f2dccfe02'
|
34
31
|
end
|
35
|
-
|
36
|
-
it
|
32
|
+
|
33
|
+
it 'sha256' do
|
37
34
|
expect(@instance.sha256).to eql '5a315c56bc34f1ffed365f9aa50bbb36916e5a8fae8614f00d952983d4316555'
|
38
35
|
end
|
39
36
|
|
40
|
-
it
|
41
|
-
expect(@instance.size).to eql
|
37
|
+
it 'size' do
|
38
|
+
expect(@instance.size).to eql 137_640
|
42
39
|
end
|
43
40
|
end
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
it "checks file is in correct folder" do
|
41
|
+
|
42
|
+
describe 'invalid file' do
|
43
|
+
it 'checks file is in correct folder' do
|
49
44
|
master_deb_file = "/tmp/repo123/#{@valid_file_name}"
|
50
45
|
exception = nil
|
51
46
|
begin
|
52
|
-
|
53
|
-
|
54
|
-
|
47
|
+
Suppository::MasterDeb.new(master_deb_file)
|
48
|
+
rescue InvalidMasterDeb => e
|
49
|
+
exception = e
|
55
50
|
end
|
56
|
-
|
51
|
+
|
57
52
|
expect(exception.message).to be_eql 'Master deb must be in the .suppository folder'
|
58
53
|
end
|
59
|
-
|
60
|
-
it
|
54
|
+
|
55
|
+
it 'checks file has correct name' do
|
61
56
|
master_deb_file = '/tmp/repo123/.suppository/123456_78910.deb'
|
62
57
|
exception = nil
|
63
58
|
begin
|
64
|
-
|
65
|
-
|
66
|
-
|
59
|
+
Suppository::MasterDeb.new(master_deb_file)
|
60
|
+
rescue InvalidMasterDeb => e
|
61
|
+
exception = e
|
67
62
|
end
|
68
|
-
|
63
|
+
|
69
64
|
expect(exception.message).to be_eql 'Master deb must have the following name {md5}_{sha1}_{sha256}.deb'
|
70
65
|
end
|
71
|
-
|
72
66
|
end
|
73
67
|
|
74
|
-
it
|
68
|
+
it 'gets attribute' do
|
75
69
|
expect(@instance.full_attr['Package']).to eql 'curl'
|
76
70
|
end
|
77
|
-
|
78
|
-
it
|
71
|
+
|
72
|
+
it 'filename' do
|
79
73
|
expect(@instance.filename).to eql 'curl_7.22.0-3ubuntu4.11_amd64.deb'
|
80
74
|
end
|
81
|
-
|
82
75
|
end
|
83
|
-
|
84
|
-
|
@@ -4,8 +4,7 @@ require 'suppository/package'
|
|
4
4
|
require 'suppository/master_deb'
|
5
5
|
|
6
6
|
describe Suppository::Package do
|
7
|
-
|
8
|
-
EXPECTED_DESCRIPTION = <<-EOS
|
7
|
+
EXPECTED_DESCRIPTION = <<-EOS
|
9
8
|
Description: Get a file from an HTTP, HTTPS or FTP server curl is a client to get files from servers using any of the supported
|
10
9
|
protocols. The command is designed to work without user interaction
|
11
10
|
or any kind of interactivity.
|
@@ -14,50 +13,46 @@ Description: Get a file from an HTTP, HTTPS or FTP server curl is a client to ge
|
|
14
13
|
authentication, FTP upload, HTTP post, file transfer resume and more.
|
15
14
|
|
16
15
|
EOS
|
17
|
-
package_info = {
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
16
|
+
package_info = {
|
17
|
+
'Package' => 'curl',
|
18
|
+
'Version' => '7.22.0-3ubuntu4.11',
|
19
|
+
'Architecture' => 'amd64',
|
20
|
+
'Maintainer' => 'Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>',
|
21
|
+
'Installed-Size' => '3450',
|
22
|
+
'MD5sum' => 'e5ca0a9797acda4bfe8404524f0976b3',
|
23
|
+
'SHA1' => 'b37ce9b17405d93c323c0b8bbe167c6f2dccfe02',
|
24
|
+
'SHA256' => '5a315c56bc34f1ffed365f9aa50bbb36916e5a8fae8614f00d952983d4316555',
|
25
|
+
'Section' => 'web',
|
26
|
+
'Priority' => 'optional',
|
27
|
+
'Homepage' => 'http://www.test.com/',
|
28
|
+
'Description' => "Get a file from an HTTP, HTTPS or FTP server curl is a client to get files from servers using any of the supported\n protocols. The command is designed to work without user interaction\n or any kind of interactivity.\n .\n curl offers a busload of useful tricks like proxy support, user\n authentication, FTP upload, HTTP post, file transfer resume and more.",
|
29
|
+
'Size' => '345'
|
30
|
+
}
|
32
31
|
|
33
32
|
before(:each) do
|
34
33
|
deb = double(Suppository::MasterDeb)
|
35
|
-
@instance = Suppository::Package.new('dists/trusty/internal/binary-amd64',deb)
|
36
|
-
|
34
|
+
@instance = Suppository::Package.new('dists/trusty/internal/binary-amd64', deb)
|
35
|
+
expect(deb).to receive(:filename) { 'curl_7.22.0-3ubuntu4.11_amd64.deb' }
|
37
36
|
expect(deb).to receive(:full_attr) { package_info }
|
38
37
|
end
|
39
|
-
|
40
38
|
|
41
|
-
it
|
42
|
-
|
43
|
-
|
44
|
-
|
39
|
+
it 'Outputs the Package' do
|
40
|
+
desc = ''
|
41
|
+
in_desc = false
|
42
|
+
@instance.content.split("\n").each do |line|
|
45
43
|
k, v = line.split(': ')
|
46
44
|
if k == 'Description' || in_desc
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
45
|
+
in_desc = true
|
46
|
+
elsif k == 'Filename'
|
47
|
+
expect(v).to eql 'dists/trusty/internal/binary-amd64/curl_7.22.0-3ubuntu4.11_amd64.deb'
|
48
|
+
else
|
49
|
+
expect(package_info.key?(k)).to be_truthy
|
50
|
+
expect(package_info.value?(v)).to be_truthy
|
51
|
+
end
|
54
52
|
|
55
|
-
|
56
|
-
|
57
|
-
|
53
|
+
desc += line << "\n" if in_desc
|
54
|
+
end
|
55
|
+
desc << "\n"
|
58
56
|
expect(desc).to eql EXPECTED_DESCRIPTION
|
59
57
|
end
|
60
|
-
|
61
58
|
end
|
62
|
-
|
63
|
-
|
@@ -3,51 +3,46 @@ require 'spec_helper'
|
|
3
3
|
require 'suppository/repository'
|
4
4
|
|
5
5
|
describe Suppository::Repository do
|
6
|
-
|
7
6
|
before(:each) do
|
8
|
-
@repository = Suppository::Repository.new(
|
9
|
-
@dists = %w(natty lucid precise saucy trusty)
|
10
|
-
@archs = %w(amd64 i386)
|
11
|
-
@suppository =
|
7
|
+
@repository = Suppository::Repository.new('/tmp/repo123')
|
8
|
+
@dists = %w(natty lucid precise saucy trusty).sort
|
9
|
+
@archs = %w(amd64 i386).sort
|
10
|
+
@suppository = '/tmp/repo123/.suppository'
|
12
11
|
end
|
13
|
-
|
12
|
+
|
14
13
|
after(:each) do
|
15
14
|
FileUtils.rm_r @repository.path if File.exist? @repository.path
|
16
15
|
end
|
17
16
|
|
18
|
-
it
|
19
|
-
expect(@repository.path).to eql
|
17
|
+
it 'has a path' do
|
18
|
+
expect(@repository.path).to eql '/tmp/repo123'
|
20
19
|
end
|
21
|
-
|
22
|
-
it
|
23
|
-
repository = Suppository::Repository.new(
|
20
|
+
|
21
|
+
it 'converts relative path to absolute' do
|
22
|
+
repository = Suppository::Repository.new('./repo123')
|
24
23
|
expect(repository.path).to eql File.expand_path('./repo123')
|
25
24
|
end
|
26
|
-
|
27
|
-
it
|
25
|
+
|
26
|
+
it 'has a dists' do
|
28
27
|
expect(@repository.dists).to eql @dists
|
29
28
|
end
|
30
|
-
|
31
|
-
it
|
29
|
+
|
30
|
+
it 'has a archs' do
|
32
31
|
expect(@repository.archs).to eql @archs
|
33
32
|
end
|
34
|
-
|
35
|
-
it
|
33
|
+
|
34
|
+
it 'has a suppository' do
|
36
35
|
expect(@repository.suppository).to eql @suppository
|
37
36
|
end
|
38
|
-
|
37
|
+
|
39
38
|
describe 'exist?' do
|
40
|
-
|
41
|
-
it "false" do
|
39
|
+
it 'false' do
|
42
40
|
expect(@repository.exist?).to be_falsy
|
43
41
|
end
|
44
|
-
|
45
|
-
it
|
42
|
+
|
43
|
+
it 'true' do
|
46
44
|
FileUtils.mkdir_p @suppository
|
47
45
|
expect(@repository.exist?).to be_truthy
|
48
46
|
end
|
49
47
|
end
|
50
|
-
|
51
|
-
|
52
48
|
end
|
53
|
-
|
@@ -3,90 +3,75 @@ require 'spec_helper'
|
|
3
3
|
require 'suppository/tty'
|
4
4
|
|
5
5
|
describe Suppository::Tty do
|
6
|
-
|
7
6
|
describe 'gray' do
|
8
|
-
|
9
|
-
it "Outputs returns nothing if not running in tty" do
|
7
|
+
it 'Outputs returns nothing if not running in tty' do
|
10
8
|
expect($stdout).to receive(:tty?).and_return(false)
|
11
9
|
expect(Suppository::Tty.gray).to be_nil
|
12
10
|
end
|
13
|
-
|
14
|
-
it
|
11
|
+
|
12
|
+
it 'Returns if running in tty' do
|
15
13
|
expect($stdout).to receive(:tty?).and_return(true)
|
16
14
|
expect(Suppository::Tty.gray).to eql "\e[1;30m"
|
17
15
|
end
|
18
|
-
|
19
16
|
end
|
20
|
-
|
17
|
+
|
21
18
|
describe 'white' do
|
22
|
-
|
23
|
-
it "Outputs returns nothing if not running in tty" do
|
19
|
+
it 'Outputs returns nothing if not running in tty' do
|
24
20
|
expect($stdout).to receive(:tty?).and_return(false)
|
25
21
|
expect(Suppository::Tty.white).to be_nil
|
26
22
|
end
|
27
|
-
|
28
|
-
it
|
23
|
+
|
24
|
+
it 'Returns if running in tty' do
|
29
25
|
expect($stdout).to receive(:tty?).and_return(true)
|
30
26
|
expect(Suppository::Tty.white).to eql "\e[1;39m"
|
31
27
|
end
|
32
|
-
|
33
28
|
end
|
34
|
-
|
29
|
+
|
35
30
|
describe 'red' do
|
36
|
-
|
37
|
-
it "Outputs returns nothing if not running in tty" do
|
31
|
+
it 'Outputs returns nothing if not running in tty' do
|
38
32
|
expect($stdout).to receive(:tty?).and_return(false)
|
39
33
|
expect(Suppository::Tty.red).to be_nil
|
40
34
|
end
|
41
|
-
|
42
|
-
it
|
35
|
+
|
36
|
+
it 'Returns if running in tty' do
|
43
37
|
expect($stdout).to receive(:tty?).and_return(true)
|
44
38
|
expect(Suppository::Tty.red).to eql "\e[4;31m"
|
45
39
|
end
|
46
|
-
|
47
40
|
end
|
48
|
-
|
41
|
+
|
49
42
|
describe 'reset' do
|
50
|
-
|
51
|
-
it "Outputs returns nothing if not running in tty" do
|
43
|
+
it 'Outputs returns nothing if not running in tty' do
|
52
44
|
expect($stdout).to receive(:tty?).and_return(false)
|
53
45
|
expect(Suppository::Tty.reset).to be_nil
|
54
46
|
end
|
55
|
-
|
56
|
-
it
|
47
|
+
|
48
|
+
it 'Returns if running in tty' do
|
57
49
|
expect($stdout).to receive(:tty?).and_return(true)
|
58
50
|
expect(Suppository::Tty.reset).to eql "\e[0m"
|
59
51
|
end
|
60
|
-
|
61
52
|
end
|
62
|
-
|
53
|
+
|
63
54
|
describe 'green' do
|
64
|
-
|
65
|
-
it "Outputs returns nothing if not running in tty" do
|
55
|
+
it 'Outputs returns nothing if not running in tty' do
|
66
56
|
expect($stdout).to receive(:tty?).and_return(false)
|
67
57
|
expect(Suppository::Tty.green).to be_nil
|
68
58
|
end
|
69
|
-
|
70
|
-
it
|
59
|
+
|
60
|
+
it 'Returns if running in tty' do
|
71
61
|
expect($stdout).to receive(:tty?).and_return(true)
|
72
62
|
expect(Suppository::Tty.green).to eql "\e[1;32m"
|
73
63
|
end
|
74
|
-
|
75
64
|
end
|
76
|
-
|
65
|
+
|
77
66
|
describe 'em' do
|
78
|
-
|
79
|
-
it "Outputs returns nothing if not running in tty" do
|
67
|
+
it 'Outputs returns nothing if not running in tty' do
|
80
68
|
expect($stdout).to receive(:tty?).and_return(false)
|
81
69
|
expect(Suppository::Tty.em).to be_nil
|
82
70
|
end
|
83
|
-
|
84
|
-
it
|
71
|
+
|
72
|
+
it 'Returns if running in tty' do
|
85
73
|
expect($stdout).to receive(:tty?).and_return(true)
|
86
74
|
expect(Suppository::Tty.em).to eql "\e[4;39m"
|
87
75
|
end
|
88
|
-
|
89
|
-
end
|
76
|
+
end
|
90
77
|
end
|
91
|
-
|
92
|
-
|
@@ -3,11 +3,8 @@ require 'spec_helper'
|
|
3
3
|
require 'suppository/version_command'
|
4
4
|
|
5
5
|
describe Suppository::VersionCommand do
|
6
|
-
|
7
|
-
it "shows version number" do
|
6
|
+
it 'shows version number' do
|
8
7
|
command = Suppository::VersionCommand.new([])
|
9
|
-
expect{command.run}.to output("Suppository Version #{Suppository::VERSION}\n").to_stdout
|
8
|
+
expect { command.run }.to output("Suppository Version #{Suppository::VERSION}\n").to_stdout
|
10
9
|
end
|
11
|
-
|
12
10
|
end
|
13
|
-
|