dogsay 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -0
- data/Gemfile +5 -0
- data/README.md +2 -4
- data/dogsay.gemspec +1 -2
- data/lib/dogsay/text_box.rb +26 -5
- data/lib/dogsay/version.rb +1 -1
- data/spec/spec_helper.rb +2 -0
- metadata +11 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5f97d59133801741f6668d5f83c06a735d10a35
|
4
|
+
data.tar.gz: b15ae7faf18d8e438d3320e24955555dd1efbe88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1b56b67c13ec6e77d4a4ef205d6655390d472471f2d5d6e657b3a01da36449d10b01e45b25e39baf5913804f1ea214e891c2b84f079ef56f30c5c07a1d51520
|
7
|
+
data.tar.gz: 9c399830c211514b9bdddecb6f4ba6a36e22b3c7bd9273e7bd32f2422b36916cab61ba9e00ca8df97caced7f59bcf8cc97462f1d0db150f085833c4b639c4926
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Dogsay
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/dogsay.svg)](http://badge.fury.io/rb/dogsay)
|
3
|
+
[![Build Status](https://travis-ci.org/ffleming/dogsay.svg?branch=master)](https://travis-ci.org/ffleming/dogsay)
|
3
4
|
[![Code Climate](https://codeclimate.com/github/ffleming/dogsay/badges/gpa.svg)](https://codeclimate.com/github/ffleming/dogsay)
|
5
|
+
[![Test Coverage](https://codeclimate.com/github/ffleming/dogsay/badges/coverage.svg)](https://codeclimate.com/github/ffleming/dogsay)
|
4
6
|
|
5
7
|
It's like cowsay, but with a dog.
|
6
8
|
|
@@ -70,10 +72,6 @@ If you're feeling saucy, you can try out `dinosay` as well.
|
|
70
72
|
4. Push to the branch (`git push origin my-new-feature`)
|
71
73
|
5. Create a new Pull Request
|
72
74
|
|
73
|
-
## Todo
|
74
|
-
* More dogs!
|
75
|
-
* Extract chains after `do...end` to their own methods
|
76
|
-
|
77
75
|
##Acknowledgments
|
78
76
|
* `default.dog` by 'dgs' at [Ascii-art.de](http://www.ascii-art.de/ascii/def/dogs.txt)
|
79
77
|
* `small.dog` from [Ascii-art.de](http://www.ascii-art.de/ascii/def/dogs.txt)
|
data/dogsay.gemspec
CHANGED
@@ -18,7 +18,6 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(spec)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_development_dependency 'bundler', '~> 1.
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1', '>= 1.6.5'
|
22
22
|
spec.add_development_dependency 'rspec', '~> 3'
|
23
|
-
spec.add_development_dependency 'simplecov', '~> 0'
|
24
23
|
end
|
data/lib/dogsay/text_box.rb
CHANGED
@@ -2,11 +2,32 @@ class Dogsay::TextBox
|
|
2
2
|
include Dogsay::AsciiArt
|
3
3
|
attr_reader :text_width, :separator, :justify, :raw
|
4
4
|
def initialize(text, opts={})
|
5
|
-
|
6
|
-
@
|
7
|
-
@
|
5
|
+
config = defaults.merge(opts)
|
6
|
+
@text_width = config[:text_width]
|
7
|
+
@separator = config[:strip] ? ' ' : / /
|
8
|
+
@justify = config[:justify]
|
9
|
+
@raw = raw_from(text)
|
10
|
+
@ascii = ascii_from(text)
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def ascii_from(text)
|
16
|
+
text.space_at(text_width - 4, on: separator)
|
17
|
+
.wrap(text_width - 4)
|
18
|
+
.boxed(text_width, justify: justify)
|
19
|
+
end
|
20
|
+
|
21
|
+
def raw_from(text)
|
8
22
|
max_width = text.split("\n").map(&:length).max
|
9
|
-
|
10
|
-
|
23
|
+
text.boxed(max_width + 4, justify: :ljust)
|
24
|
+
end
|
25
|
+
|
26
|
+
def defaults
|
27
|
+
{
|
28
|
+
text_width: 40,
|
29
|
+
strip: false,
|
30
|
+
justify: :center
|
31
|
+
}
|
11
32
|
end
|
12
33
|
end
|
data/lib/dogsay/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -17,7 +17,9 @@
|
|
17
17
|
#
|
18
18
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
19
19
|
require 'simplecov'
|
20
|
+
require 'codeclimate-test-reporter'
|
20
21
|
SimpleCov.start
|
22
|
+
CodeClimate::TestReporter.start
|
21
23
|
require_relative '../lib/dogsay'
|
22
24
|
RSpec.configure do |config|
|
23
25
|
config.expect_with :rspec do |expectations|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dogsay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Forrest Fleming
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1
|
19
|
+
version: '1'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.6.5
|
20
23
|
type: :development
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - "~>"
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1
|
29
|
+
version: '1'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.6.5
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: rspec
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,20 +44,6 @@ dependencies:
|
|
38
44
|
- - "~>"
|
39
45
|
- !ruby/object:Gem::Version
|
40
46
|
version: '3'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: simplecov
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
47
|
description: Prints CLI arguments or STDIN in a speech bubble, said by a dog. Dogs
|
56
48
|
are better than cows, after all.
|
57
49
|
email:
|
@@ -64,6 +56,7 @@ extra_rdoc_files: []
|
|
64
56
|
files:
|
65
57
|
- ".gitignore"
|
66
58
|
- ".rspec"
|
59
|
+
- ".travis.yml"
|
67
60
|
- Gemfile
|
68
61
|
- LICENSE.txt
|
69
62
|
- README.md
|