seed_formatter 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +2 -1
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/DEVELOPER_README.md +12 -2
- data/Gemfile +1 -1
- data/lib/seed_formatter.rb +5 -5
- data/lib/seed_formatter/version.rb +1 -1
- data/seed_formatter.gemspec +1 -1
- data/spec/lib/seed_formatter_spec.rb +17 -17
- metadata +14 -17
- data/.rvmrc +0 -1
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 048f1a149c0993d339372ace73852f028aa20227
|
4
|
+
data.tar.gz: 531a0d2b79cc1637d50825dc706ea5489d0fb23d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ca8d3bc3d18f26f00b0125f94861dcf6dad17c4d7d16f6687218e2f81138ec715879aa0709225a073e2733ee4161a7d8e81a28a2911ce4f277cb58fc0db29b71
|
7
|
+
data.tar.gz: fda8fef7979ab7df7c32d185d1dc6ba7d2f8301c2787a53f80cbd57107dbbc6ccf840e67563273b9ffddb2eedac7dbd55b1c49cc1064e5a768056b311ce592f7
|
data/.rspec
CHANGED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
seed_formatter
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.1.0
|
data/DEVELOPER_README.md
CHANGED
@@ -6,5 +6,15 @@ This is a README for working on SeedFormatter
|
|
6
6
|
|
7
7
|
```
|
8
8
|
gem build seed_formatter.gemspec
|
9
|
-
gem install ./seed_formatter-1.
|
10
|
-
```
|
9
|
+
gem install ./seed_formatter-1.1.0.gem
|
10
|
+
```
|
11
|
+
|
12
|
+
## Running
|
13
|
+
|
14
|
+
Get into `irb`.
|
15
|
+
|
16
|
+
Run `require 'seed_formatter'`
|
17
|
+
|
18
|
+
Now `include SeedFormatter`
|
19
|
+
|
20
|
+
Now you can use the functions in seed_formatter.rb
|
data/Gemfile
CHANGED
data/lib/seed_formatter.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require "seed_formatter/version"
|
2
|
-
require "
|
2
|
+
require "colorize"
|
3
3
|
|
4
4
|
module SeedFormatter
|
5
5
|
|
@@ -14,27 +14,27 @@ module SeedFormatter
|
|
14
14
|
# @example Print out an error message
|
15
15
|
# SeedFormatter.output "Some error", {:prefix => "!!! ", :color => :red}
|
16
16
|
# # outputs "!!! Some error" in red text
|
17
|
-
def output
|
17
|
+
def output(message, options = {})
|
18
18
|
options[:color] ||= :white
|
19
19
|
$stdout.puts "#{options[:prefix]}#{message}#{options[:suffix]}".send(options[:color])
|
20
20
|
end
|
21
21
|
|
22
22
|
# A preset formatter with overridable options
|
23
|
-
def message
|
23
|
+
def message(message, options = {})
|
24
24
|
options[:prefix] ||= "*** "
|
25
25
|
options[:color] ||= :white
|
26
26
|
output message, options
|
27
27
|
end
|
28
28
|
|
29
29
|
# A preset formatter with overridable options
|
30
|
-
def success
|
30
|
+
def success(message, options = {})
|
31
31
|
options[:prefix] ||= " + "
|
32
32
|
options[:color] ||= :green
|
33
33
|
output message, options
|
34
34
|
end
|
35
35
|
|
36
36
|
# A preset formatter with overridable options
|
37
|
-
def error
|
37
|
+
def error(message, options = {})
|
38
38
|
options[:prefix] ||= " - "
|
39
39
|
options[:color] ||= :red
|
40
40
|
output message, options
|
data/seed_formatter.gemspec
CHANGED
@@ -16,28 +16,28 @@ describe SeedFormatter do
|
|
16
16
|
context 'options[:prefix] is provided' do
|
17
17
|
let(:options) { {:prefix => "a prefix "} }
|
18
18
|
it "prefixes the message with options[:prefix]" do
|
19
|
-
$stdout.
|
19
|
+
expect($stdout).to receive(:puts).with(/a prefix message/)
|
20
20
|
subject
|
21
21
|
end
|
22
22
|
end
|
23
23
|
context 'options[:suffix] is provided' do
|
24
24
|
let(:options) { {:suffix => " a suffix"} }
|
25
25
|
it "suffixes the message with options[:suffix]" do
|
26
|
-
$stdout.
|
26
|
+
expect($stdout).to receive(:puts).with(/message a suffix/)
|
27
27
|
subject
|
28
28
|
end
|
29
29
|
end
|
30
30
|
context 'options[:color] is provided' do
|
31
31
|
let(:options) { {:color => :blue} }
|
32
32
|
it "prints the message with the provided color" do
|
33
|
-
$stdout.
|
33
|
+
expect($stdout).to receive(:puts).with("\e[0;34;49mmessage\e[0m")
|
34
34
|
subject
|
35
35
|
end
|
36
36
|
end
|
37
37
|
context 'options[:color] is not provided' do
|
38
38
|
let(:options) { {:color => nil} }
|
39
39
|
it "prints the message in white by default" do
|
40
|
-
$stdout.
|
40
|
+
expect($stdout).to receive(:puts).with("\e[0;37;49mmessage\e[0m")
|
41
41
|
subject
|
42
42
|
end
|
43
43
|
end
|
@@ -52,26 +52,26 @@ describe SeedFormatter do
|
|
52
52
|
context 'options[:prefix] is provided' do
|
53
53
|
let(:prefix) { "a prefix " }
|
54
54
|
it 'passes options[:prefix] to output' do
|
55
|
-
tc.
|
55
|
+
expect(tc).to receive(:output).with(anything, hash_including(:prefix => prefix))
|
56
56
|
subject
|
57
57
|
end
|
58
58
|
end
|
59
59
|
context 'options[:prefix] is not provided' do
|
60
60
|
it 'passes a default prefix through to output' do
|
61
|
-
tc.
|
61
|
+
expect(tc).to receive(:output).with(anything, hash_including(:prefix => "*** "))
|
62
62
|
subject
|
63
63
|
end
|
64
64
|
end
|
65
65
|
context 'options[:color] is provided' do
|
66
66
|
let(:color) { :blue }
|
67
67
|
it 'passes options[:color] to output' do
|
68
|
-
tc.
|
68
|
+
expect(tc).to receive(:output).with(anything, hash_including(:color => color))
|
69
69
|
subject
|
70
70
|
end
|
71
71
|
end
|
72
72
|
context 'options[:color] is not provided' do
|
73
73
|
it 'passes a default color through to output' do
|
74
|
-
tc.
|
74
|
+
expect(tc).to receive(:output).with(anything, hash_including(:color => :white))
|
75
75
|
subject
|
76
76
|
end
|
77
77
|
end
|
@@ -86,26 +86,26 @@ describe SeedFormatter do
|
|
86
86
|
context 'options[:prefix] is provided' do
|
87
87
|
let(:prefix) { "a prefix " }
|
88
88
|
it 'passes options[:prefix] to output' do
|
89
|
-
tc.
|
89
|
+
expect(tc).to receive(:output).with(anything, hash_including(:prefix => prefix))
|
90
90
|
subject
|
91
91
|
end
|
92
92
|
end
|
93
93
|
context 'options[:prefix] is not provided' do
|
94
94
|
it 'passes a default prefix through to output' do
|
95
|
-
tc.
|
95
|
+
expect(tc).to receive(:output).with(anything, hash_including(:prefix => " + "))
|
96
96
|
subject
|
97
97
|
end
|
98
98
|
end
|
99
99
|
context 'options[:color] is provided' do
|
100
100
|
let(:color) { :blue }
|
101
101
|
it 'passes options[:color] to output' do
|
102
|
-
tc.
|
102
|
+
expect(tc).to receive(:output).with(anything, hash_including(:color => color))
|
103
103
|
subject
|
104
104
|
end
|
105
105
|
end
|
106
106
|
context 'options[:color] is not provided' do
|
107
107
|
it 'passes a default color through to output' do
|
108
|
-
tc.
|
108
|
+
expect(tc).to receive(:output).with(anything, hash_including(:color => :green))
|
109
109
|
subject
|
110
110
|
end
|
111
111
|
end
|
@@ -120,26 +120,26 @@ describe SeedFormatter do
|
|
120
120
|
context 'options[:prefix] is provided' do
|
121
121
|
let(:prefix) { "a prefix " }
|
122
122
|
it 'passes options[:prefix] to output' do
|
123
|
-
tc.
|
123
|
+
expect(tc).to receive(:output).with(anything, hash_including(:prefix => prefix))
|
124
124
|
subject
|
125
125
|
end
|
126
126
|
end
|
127
127
|
context 'options[:prefix] is not provided' do
|
128
128
|
it 'passes a default prefix through to output' do
|
129
|
-
tc.
|
129
|
+
expect(tc).to receive(:output).with(anything, hash_including(:prefix => " - "))
|
130
130
|
subject
|
131
131
|
end
|
132
132
|
end
|
133
133
|
context 'options[:color] is provided' do
|
134
134
|
let(:color) { :blue }
|
135
135
|
it 'passes options[:color] to output' do
|
136
|
-
tc.
|
136
|
+
expect(tc).to receive(:output).with(anything, hash_including(:color => color))
|
137
137
|
subject
|
138
138
|
end
|
139
139
|
end
|
140
140
|
context 'options[:color] is not provided' do
|
141
141
|
it 'passes a default color through to output' do
|
142
|
-
tc.
|
142
|
+
expect(tc).to receive(:output).with(anything, hash_including(:color => :red))
|
143
143
|
subject
|
144
144
|
end
|
145
145
|
end
|
@@ -148,7 +148,7 @@ describe SeedFormatter do
|
|
148
148
|
describe '#spacer' do
|
149
149
|
subject { tc.spacer }
|
150
150
|
it 'prints a blank line' do
|
151
|
-
$stdout.
|
151
|
+
expect($stdout).to receive(:puts).with(/^$/)
|
152
152
|
subject
|
153
153
|
end
|
154
154
|
end
|
metadata
CHANGED
@@ -1,30 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seed_formatter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jordan Maguire
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-01-08 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
14
|
+
name: colorize
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
description: Easily format the output of your seeds and parse YAML files
|
@@ -34,9 +31,10 @@ executables: []
|
|
34
31
|
extensions: []
|
35
32
|
extra_rdoc_files: []
|
36
33
|
files:
|
37
|
-
- .gitignore
|
38
|
-
- .rspec
|
39
|
-
- .
|
34
|
+
- ".gitignore"
|
35
|
+
- ".rspec"
|
36
|
+
- ".ruby-gemset"
|
37
|
+
- ".ruby-version"
|
40
38
|
- DEVELOPER_README.md
|
41
39
|
- Gemfile
|
42
40
|
- README.md
|
@@ -49,27 +47,26 @@ files:
|
|
49
47
|
- spec/support/yml/spec.yml
|
50
48
|
homepage: https://github.com/jordanmaguire/seed_formatter
|
51
49
|
licenses: []
|
50
|
+
metadata: {}
|
52
51
|
post_install_message:
|
53
52
|
rdoc_options: []
|
54
53
|
require_paths:
|
55
54
|
- lib
|
56
55
|
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
56
|
requirements:
|
59
|
-
- -
|
57
|
+
- - ">="
|
60
58
|
- !ruby/object:Gem::Version
|
61
59
|
version: '0'
|
62
60
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
-
none: false
|
64
61
|
requirements:
|
65
|
-
- -
|
62
|
+
- - ">="
|
66
63
|
- !ruby/object:Gem::Version
|
67
64
|
version: '0'
|
68
65
|
requirements: []
|
69
66
|
rubyforge_project:
|
70
|
-
rubygems_version:
|
67
|
+
rubygems_version: 2.2.2
|
71
68
|
signing_key:
|
72
|
-
specification_version:
|
69
|
+
specification_version: 4
|
73
70
|
summary: Easily format the output of your seeds and parse YAML files
|
74
71
|
test_files:
|
75
72
|
- spec/lib/seed_formatter_spec.rb
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm use 1.9.3-p392@seed_formatter --create
|