peter_pan 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +2 -0
- data/.travis.yml +10 -0
- data/Gemfile +1 -0
- data/Guardfile +44 -0
- data/README.md +14 -5
- data/Rakefile +11 -0
- data/lib/peter_pan.rb +11 -6
- data/peter_pan.gemspec +3 -2
- data/spec/lib/peter_pan_spec.rb +24 -0
- data/spec/spec_helper.rb +96 -0
- metadata +27 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7af280d2399f0a47856d1bae570e0c98176d7369
|
4
|
+
data.tar.gz: c405a19e53f81ea1721d606602536e2a633885dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dda7045e56251553a8f2b9c2d25fde495f92da5fd03517f127ec1e63c62937438c3a2eaa8c580c3be4e969acf81f91edb61ffa7e9976e8844b1f5a55e65831f5
|
7
|
+
data.tar.gz: 17ccf499dfb2360f770bfdbec8e65bd799c2637075ccdf7ef5a002005ac57e98e86b57673b1a39ee646a474874b96dad81651fa63204c732a45aa31e10fd9585
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/Guardfile
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
2
|
+
require "guard/rspec/dsl"
|
3
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
4
|
+
|
5
|
+
# Feel free to open issues for suggestions and improvements
|
6
|
+
|
7
|
+
# RSpec files
|
8
|
+
rspec = dsl.rspec
|
9
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
10
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
11
|
+
watch(rspec.spec_files)
|
12
|
+
|
13
|
+
# Ruby files
|
14
|
+
ruby = dsl.ruby
|
15
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
16
|
+
|
17
|
+
# Rails files
|
18
|
+
rails = dsl.rails(view_extensions: %w(erb haml slim))
|
19
|
+
dsl.watch_spec_files_for(rails.app_files)
|
20
|
+
dsl.watch_spec_files_for(rails.views)
|
21
|
+
|
22
|
+
watch(rails.controllers) do |m|
|
23
|
+
[
|
24
|
+
rspec.spec.("routing/#{m[1]}_routing"),
|
25
|
+
rspec.spec.("controllers/#{m[1]}_controller"),
|
26
|
+
rspec.spec.("acceptance/#{m[1]}")
|
27
|
+
]
|
28
|
+
end
|
29
|
+
|
30
|
+
# Rails config changes
|
31
|
+
watch(rails.spec_helper) { rspec.spec_dir }
|
32
|
+
watch(rails.routes) { "#{rspec.spec_dir}/routing" }
|
33
|
+
watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
|
34
|
+
|
35
|
+
# Capybara features specs
|
36
|
+
watch(rails.view_dirs) { |m| rspec.spec.("features/#{m[1]}") }
|
37
|
+
watch(rails.layouts) { |m| rspec.spec.("features/#{m[1]}") }
|
38
|
+
|
39
|
+
# Turnip features and steps
|
40
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
41
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
42
|
+
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
|
43
|
+
end
|
44
|
+
end
|
data/README.md
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/peter_pan.svg)](http://badge.fury.io/rb/peter_pan)
|
1
2
|
### Peter Pan - a Ruby gem providing a virtual screen buffer with viewport panning. For the Dream Cheeky LED sign and others, also works just fine with computer screen.
|
2
3
|
|
3
4
|
Peter Pan gives you a large, virtual text frame buffer and a virtual
|
@@ -165,6 +166,17 @@ how to animate the movement of the viewport over the buffer.
|
|
165
166
|
|
166
167
|
Detailed docs available [at rubydoc.org](http://rubydoc.org/github/xunker/peter_pan/master/frames)
|
167
168
|
|
169
|
+
## Changes
|
170
|
+
|
171
|
+
### 1.1.0 July 16, 2015
|
172
|
+
`#write` will remove characters that are not in the included font.
|
173
|
+
|
174
|
+
### 1.0.1 July 15, 2015
|
175
|
+
Fixed issue with loading font file.
|
176
|
+
|
177
|
+
### 1.0.0
|
178
|
+
Initial Release
|
179
|
+
|
168
180
|
|
169
181
|
## Source
|
170
182
|
|
@@ -172,13 +184,10 @@ Source lives on Github: [xunker/peter_pan](https://github.com/xunker/peter_pan).
|
|
172
184
|
|
173
185
|
## Contributing
|
174
186
|
|
175
|
-
You'll notice there are no tests in this repo, and that's my fault. That means
|
176
|
-
that if you'd like to make some changes or fix some bug, you don't need to
|
177
|
-
write tests if you don't want to! Yay!
|
178
|
-
|
179
187
|
Here's the process if you'd like to contribute:
|
180
188
|
|
181
189
|
* Fork the repo.
|
182
190
|
* Make your changes. If you can, please make your changes in a topic branch, not master.
|
183
|
-
*
|
191
|
+
* Make sure the existing tests pass.
|
192
|
+
* Write tests for your feature/fix.
|
184
193
|
* Make a pull request.
|
data/Rakefile
CHANGED
data/lib/peter_pan.rb
CHANGED
@@ -11,7 +11,7 @@ require 'yaml'
|
|
11
11
|
class PeterPan
|
12
12
|
attr_reader :viewport_width, :viewport_height, :empty_point_character
|
13
13
|
|
14
|
-
VERSION = "1.0
|
14
|
+
VERSION = "1.1.0"
|
15
15
|
|
16
16
|
# Possible Options:
|
17
17
|
#
|
@@ -128,7 +128,7 @@ class PeterPan
|
|
128
128
|
end
|
129
129
|
|
130
130
|
# Same as #path_viewport, but with an ascii-art border around each frame.
|
131
|
-
def
|
131
|
+
def pretty_path_viewport(*coordinates)
|
132
132
|
path_viewport(coordinates).map{|vp| wrap_frame_with_border(vp) }
|
133
133
|
end
|
134
134
|
|
@@ -143,11 +143,10 @@ class PeterPan
|
|
143
143
|
end
|
144
144
|
|
145
145
|
# Write a string to the buffer at the given coordinates.
|
146
|
-
def write(
|
147
|
-
letter_x = x
|
146
|
+
def write(letter_x, letter_y, message)
|
148
147
|
message.split('').each do |c|
|
149
|
-
char =
|
150
|
-
plot_sprite(char, letter_x,
|
148
|
+
char = font_character(c)
|
149
|
+
plot_sprite(char, letter_x, letter_y)
|
151
150
|
letter_x = letter_x + font['width'] + 1
|
152
151
|
end
|
153
152
|
end
|
@@ -176,6 +175,12 @@ class PeterPan
|
|
176
175
|
|
177
176
|
private
|
178
177
|
|
178
|
+
# return the font character for a given character. If no character exists,
|
179
|
+
# return '?' instead.
|
180
|
+
def font_character(char)
|
181
|
+
(font['characters'][char] || font['characters']['?']).map{|l|l.gsub('.', @empty_point_character)}
|
182
|
+
end
|
183
|
+
|
179
184
|
def buffer_changed!(val = true)
|
180
185
|
@buffer_changed = val
|
181
186
|
end
|
data/peter_pan.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = PeterPan::VERSION
|
9
9
|
spec.authors = ["Matthew Nielsen"]
|
10
10
|
spec.email = ["xunker@pyxidis.org"]
|
11
|
-
spec.description = %q{A virtual screen buffer with viewport panning. For the Dream Cheeky LED sign
|
12
|
-
spec.summary = %q{A virtual screen buffer with viewport panning. For the Dream Cheeky LED sign
|
11
|
+
spec.description = %q{A virtual screen buffer with viewport panning. For the Dream Cheeky LED sign, but also works with a plain old computer screen.}
|
12
|
+
spec.summary = %q{A virtual screen buffer with viewport panning. For the Dream Cheeky LED sign, but also works with a plain old computer screen.}
|
13
13
|
spec.homepage = "https://github.com/xunker/peter_pan"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
@@ -20,4 +20,5 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
22
|
spec.add_development_dependency "rake", "~> 0"
|
23
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
23
24
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe PeterPan do
|
4
|
+
describe '#write' do
|
5
|
+
let(:letter_x) { 0 }
|
6
|
+
let(:letter_y) { 1 }
|
7
|
+
it 'writes all characters in the string to the buffer' do
|
8
|
+
chars = 'ABC'
|
9
|
+
chars.split('').each do |char|
|
10
|
+
expected_character = subject.send(:font_character, char)
|
11
|
+
expect(subject).to receive(:plot_sprite).with(expected_character, letter_x, letter_y)
|
12
|
+
subject.write(letter_x, letter_y, char)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
context 'font does not have a character' do
|
16
|
+
let(:char) { 'あ' }
|
17
|
+
it 'prints ? instead' do
|
18
|
+
ques_character = subject.send(:font_character, '?')
|
19
|
+
expect(subject).to receive(:plot_sprite).with(ques_character, letter_x, letter_y)
|
20
|
+
subject.write(letter_x, letter_y, char)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
4
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
5
|
+
# files.
|
6
|
+
#
|
7
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
8
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
9
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
10
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
11
|
+
# a separate helper file that requires the additional dependencies and performs
|
12
|
+
# the additional setup, and require it from the spec files that actually need
|
13
|
+
# it.
|
14
|
+
#
|
15
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
16
|
+
# users commonly want.
|
17
|
+
#
|
18
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
19
|
+
RSpec.configure do |config|
|
20
|
+
# rspec-expectations config goes here. You can use an alternate
|
21
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
22
|
+
# assertions if you prefer.
|
23
|
+
config.expect_with :rspec do |expectations|
|
24
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
25
|
+
# and `failure_message` of custom matchers include text for helper methods
|
26
|
+
# defined using `chain`, e.g.:
|
27
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
28
|
+
# # => "be bigger than 2 and smaller than 4"
|
29
|
+
# ...rather than:
|
30
|
+
# # => "be bigger than 2"
|
31
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
32
|
+
end
|
33
|
+
|
34
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
35
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
36
|
+
config.mock_with :rspec do |mocks|
|
37
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
38
|
+
# a real object. This is generally recommended, and will default to
|
39
|
+
# `true` in RSpec 4.
|
40
|
+
mocks.verify_partial_doubles = true
|
41
|
+
end
|
42
|
+
|
43
|
+
# The settings below are suggested to provide a good initial experience
|
44
|
+
# with RSpec, but feel free to customize to your heart's content.
|
45
|
+
=begin
|
46
|
+
# These two settings work together to allow you to limit a spec run
|
47
|
+
# to individual examples or groups you care about by tagging them with
|
48
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
49
|
+
# get run.
|
50
|
+
config.filter_run :focus
|
51
|
+
config.run_all_when_everything_filtered = true
|
52
|
+
|
53
|
+
# Allows RSpec to persist some state between runs in order to support
|
54
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
55
|
+
# you configure your source control system to ignore this file.
|
56
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
57
|
+
|
58
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
59
|
+
# recommended. For more details, see:
|
60
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
61
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
62
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
63
|
+
config.disable_monkey_patching!
|
64
|
+
|
65
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
66
|
+
# be too noisy due to issues in dependencies.
|
67
|
+
config.warnings = true
|
68
|
+
|
69
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
70
|
+
# file, and it's useful to allow more verbose output when running an
|
71
|
+
# individual spec file.
|
72
|
+
if config.files_to_run.one?
|
73
|
+
# Use the documentation formatter for detailed output,
|
74
|
+
# unless a formatter has already been configured
|
75
|
+
# (e.g. via a command-line flag).
|
76
|
+
config.default_formatter = 'doc'
|
77
|
+
end
|
78
|
+
|
79
|
+
# Print the 10 slowest examples and example groups at the
|
80
|
+
# end of the spec run, to help surface which specs are running
|
81
|
+
# particularly slow.
|
82
|
+
config.profile_examples = 10
|
83
|
+
|
84
|
+
# Run specs in random order to surface order dependencies. If you find an
|
85
|
+
# order dependency and want to debug it, you can fix the order by providing
|
86
|
+
# the seed, which is printed after each run.
|
87
|
+
# --seed 1234
|
88
|
+
config.order = :random
|
89
|
+
|
90
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
91
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
92
|
+
# test failures related to randomization by passing the same `--seed` value
|
93
|
+
# as the one that triggered the failure.
|
94
|
+
Kernel.srand config.seed
|
95
|
+
=end
|
96
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peter_pan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Nielsen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,8 +38,22 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
41
55
|
description: A virtual screen buffer with viewport panning. For the Dream Cheeky LED
|
42
|
-
sign
|
56
|
+
sign, but also works with a plain old computer screen.
|
43
57
|
email:
|
44
58
|
- xunker@pyxidis.org
|
45
59
|
executables: []
|
@@ -47,7 +61,10 @@ extensions: []
|
|
47
61
|
extra_rdoc_files: []
|
48
62
|
files:
|
49
63
|
- ".gitignore"
|
64
|
+
- ".rspec"
|
65
|
+
- ".travis.yml"
|
50
66
|
- Gemfile
|
67
|
+
- Guardfile
|
51
68
|
- LICENSE.txt
|
52
69
|
- README.md
|
53
70
|
- Rakefile
|
@@ -57,6 +74,8 @@ files:
|
|
57
74
|
- fonts/transpo.yml
|
58
75
|
- lib/peter_pan.rb
|
59
76
|
- peter_pan.gemspec
|
77
|
+
- spec/lib/peter_pan_spec.rb
|
78
|
+
- spec/spec_helper.rb
|
60
79
|
homepage: https://github.com/xunker/peter_pan
|
61
80
|
licenses:
|
62
81
|
- MIT
|
@@ -80,6 +99,8 @@ rubyforge_project:
|
|
80
99
|
rubygems_version: 2.2.2
|
81
100
|
signing_key:
|
82
101
|
specification_version: 4
|
83
|
-
summary: A virtual screen buffer with viewport panning. For the Dream Cheeky LED sign
|
84
|
-
|
85
|
-
test_files:
|
102
|
+
summary: A virtual screen buffer with viewport panning. For the Dream Cheeky LED sign,
|
103
|
+
but also works with a plain old computer screen.
|
104
|
+
test_files:
|
105
|
+
- spec/lib/peter_pan_spec.rb
|
106
|
+
- spec/spec_helper.rb
|