dot_grid 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2d20dc3dcfaf751ae3bac1db9370a7b096441068
4
- data.tar.gz: 61c84e76ed26fb9fff8a327e9c0fd9260bed6713
3
+ metadata.gz: f335ec567f768314689a098563250d89d0ab3618
4
+ data.tar.gz: 82312df6b01c0d7e9ad129fa49823f3b1578414b
5
5
  SHA512:
6
- metadata.gz: c04ce6ff5138b6cfc8857798c1ba2cb8462c55852c2bef6a86da3fa4b78769940a6c93dc541e76d036e7ae248ec9d8b8cc5fc20c51bdcef9a80078df38093d1b
7
- data.tar.gz: b600b4427e8285b10e9104a960d79a45767474769273b3414f127aecbf4cd96032f240b584a36fabcb82f16ee8bda0dd335b8c41877891983618a8582550e56e
6
+ metadata.gz: 6ae51ca4792a330d8ad5e5522acb9a8605a412fd7214b68af2bb9d7a213b1baae4c4b30130c46f816c67a479284dddd36c78925b38ac23322c82242850762673
7
+ data.tar.gz: fc51b75a5ff46f29a0a1a5ae04152de84d74ff15c9f88d5f4a370e4ea6a425b3a59597c1533361a07830c2e5394b61095b35fd3706b6481601322fd03a2602af
data/README.md CHANGED
@@ -22,6 +22,9 @@ A simple ruby file for generating dot grid graph paper.
22
22
  ### A regular grid page
23
23
  dot_grid -f grid_c2dfff.pdf --page-types grid --spacing 5 --grid-color CFBAEC --margin 0.0
24
24
 
25
+ ### A grid + lines page
26
+ dot_grid -f grid_plus_lines_c2dfff.pdf --page-types grid_plus_lines --spacing 5 --grid-color CFBAEC --margin 0.0
27
+
25
28
  ### A horizontal rule page
26
29
  dot_grid -f horizontal_rule_c2dfff.pdf --page-types horizontal_rule --spacing 5 --grid-color CFBAEC --margin 0.0
27
30
 
@@ -32,7 +35,7 @@ A simple ruby file for generating dot grid graph paper.
32
35
  dot_grid -f page_types.pdf --page-types "planner, checkerboard, grid, dot_grid" --spacing 5 --grid-color CFBAEC --margin 0.0
33
36
 
34
37
  ### All of the pages at once ...
35
- dot_grid -f page_types.pdf --page-types "planner, checkerboard, grid, dot_grid, horizontal_rule" --spacing 5 --grid-color CFBAEC -m 0.0
38
+ dot_grid -f page_types.pdf --page-types "planner, checkerboard, grid, dot_grid, horizontal_rule, grid_plus_lines" --spacing 5 --grid-color CFBAEC -m 0.0
36
39
 
37
40
  ### To get help on the command and its options ...
38
41
  dot_grid --help
@@ -47,7 +50,7 @@ A simple ruby file for generating dot grid graph paper.
47
50
  </thead>
48
51
  <tbody>
49
52
  <tr><td>file-name</td><td>-f</td><td>dotgrid.pdf</td></tr>
50
- <tr><td>page-types</td><td>-p</td><td>Types of pages desired: DotGrid, Planner, Grid, HorizontalRule, Checkerboard (default: Planner)</td></tr>
53
+ <tr><td>page-types</td><td>-p</td><td>Types of pages desired: planner, checkerboard, grid, dot_grid, horizontal_rule, grid_plus_lines (default: planner)</td></tr>
51
54
  <tr><td>dot-weight</td><td>-d</td><td>1.5</td></tr>
52
55
  <tr><td>margin</td><td>-m</td><td>0.5</td></tr>
53
56
  <tr><td>page-size</td><td>-a</td><td>LETTER</td></tr>
@@ -57,3 +60,11 @@ A simple ruby file for generating dot grid graph paper.
57
60
  <tr><td>planner-color-2</td><td>-n</td><td>0099FF</td></tr>
58
61
  </tbody>
59
62
  </table>
63
+
64
+ ## Acknowledgements
65
+
66
+ The planner page is based on the Frictionless planning pad
67
+ (https://squareup.com/market/frictionless)
68
+
69
+ The grid plus lines is similar to the Doane Paper grid + lines paper
70
+ (http://doanepaper.bigcartel.com/products)
data/dot_grid.gemspec CHANGED
@@ -16,9 +16,10 @@ Gem::Specification.new do |gem|
16
16
  gem.require_paths = ["lib"]
17
17
  gem.version = DotGrid::VERSION
18
18
 
19
- gem.add_development_dependency "rspec", '~> 2.14.1'
19
+ gem.add_development_dependency "rspec", '~> 3.0.0'
20
+ gem.add_development_dependency "rspec-collection_matchers", '~> 1.0.0'
20
21
  gem.add_development_dependency "rake", '~> 10.3.2'
21
- gem.add_development_dependency "coveralls"
22
- gem.add_dependency "prawn", '~> 1.1.0'
22
+ gem.add_development_dependency "coveralls", '~> 0.7.1'
23
+ gem.add_dependency "prawn", '~> 1.2.1'
23
24
  gem.add_dependency "trollop", '~> 2.0'
24
25
  end
data/lib/dot_grid/cli.rb CHANGED
@@ -8,7 +8,7 @@ module DotGrid
8
8
  version "dot_grid #{DotGrid::VERSION}"
9
9
  opt :file_name, "File Name", :type => :string, :default => "dotgrid.pdf"
10
10
  opt :orientation, "Orientation of pages (portrait/landscape)", type: :string, default: "portrait"
11
- opt :page_types, "Types of pages desired: Types of pages desired: DotGrid, Planner, Grid, HorizontalRule, Checkerboard", type: :string, default: "planner"
11
+ opt :page_types, "Types of pages desired: Types of pages desired: planner, checkerboard, grid, dot_grid, horizontal_rule, grid_plus_lines", type: :string, default: "planner"
12
12
  opt :dot_weight, "Dot Weight", :type => :float, :default => 1.5
13
13
  opt :margin, "Border", :type => :float, :default => 0.0
14
14
  opt :page_size, "Page Size (LEGAL, LETTER)", :type => :string, :default => "LETTER"
@@ -7,6 +7,7 @@ module DotGrid
7
7
  'dot_grid' => ::DotGrid::Page::DotGrid,
8
8
  'planner' => ::DotGrid::Page::Planner,
9
9
  'grid' => ::DotGrid::Page::Grid,
10
+ 'grid_plus_lines' => ::DotGrid::Page::GridPlusLines,
10
11
  'horizontal_rule' => ::DotGrid::Page::HorizontalRule,
11
12
  'checkerboard' => ::DotGrid::Page::Checkerboard
12
13
  }
@@ -0,0 +1,11 @@
1
+ module DotGrid
2
+ module Page
3
+ class GridPlusLines < Page
4
+
5
+ def post_initialize(params)
6
+ add_pattern(::DotGrid::Pattern::GridPlusLines.new(params))
7
+ end
8
+ end
9
+ end
10
+ end
11
+
@@ -0,0 +1,29 @@
1
+ module DotGrid
2
+ module Pattern
3
+ class GridPlusLines < Pattern
4
+
5
+ DARK_LINE_WIDTH = 3
6
+ DARK_LINE_SPACING = 3
7
+
8
+ def draw_row(row)
9
+ pdf.mask(:line_width) do
10
+ pdf.line_width (row % DARK_LINE_SPACING == 0) ? DARK_LINE_WIDTH : pdf.line_width
11
+ pdf.stroke_horizontal_line(0, bounds.width, :at => row*spacing)
12
+ end
13
+ end
14
+
15
+ def draw_column(column)
16
+ pdf.stroke_vertical_line(0, bounds.height, :at => column*spacing)
17
+ end
18
+
19
+ def draw
20
+ pdf.stroke_color grid_color
21
+ draw_grid do |row, column|
22
+ draw_row(row) if column == 0
23
+ draw_column(column) if row == 0
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+
@@ -1,3 +1,3 @@
1
1
  module DotGrid
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
data/lib/dot_grid.rb CHANGED
@@ -8,12 +8,14 @@ require 'dot_grid/page/page'
8
8
  require 'dot_grid/page/dot_grid'
9
9
  require 'dot_grid/page/planner'
10
10
  require 'dot_grid/page/grid'
11
+ require 'dot_grid/page/grid_plus_lines'
11
12
  require 'dot_grid/page/horizontal_rule'
12
13
  require 'dot_grid/page/checkerboard'
13
14
  require 'dot_grid/page/factory'
14
15
 
15
16
  require 'dot_grid/pattern/pattern'
16
17
  require 'dot_grid/pattern/grid'
18
+ require 'dot_grid/pattern/grid_plus_lines'
17
19
  require 'dot_grid/pattern/dot_grid'
18
20
  require 'dot_grid/pattern/checkerboard'
19
21
  require 'dot_grid/pattern/horizontal_rule'
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe "DotGrid::Page::GridPlusLines" do
4
+ describe "#post_initialize" do
5
+ let(:subject) { DotGrid::Page::GridPlusLines.new({})}
6
+
7
+ before do
8
+ allow(::DotGrid::Pattern::GridPlusLines).to receive(:new)
9
+ end
10
+
11
+ it "draws the pattern" do
12
+ expect(subject).to receive(:add_pattern)
13
+ subject.post_initialize({})
14
+ end
15
+ end
16
+ end
17
+
@@ -0,0 +1,60 @@
1
+ require 'spec_helper'
2
+
3
+ describe "DotGrid::Pattern::GridPlusLines" do
4
+ let(:pdf) { double('pdf').as_null_object }
5
+ let(:params) { { pdf: pdf, bounds: double('bounds', { upper_left: [0, 0], height: 20.mm, width: 10.mm } ), spacing: 5 } }
6
+ let(:subject) { DotGrid::Pattern::GridPlusLines.new(params) }
7
+
8
+ describe "draw_row" do
9
+ before do
10
+ allow(pdf).to receive(:mask).and_yield
11
+ end
12
+
13
+ it "masks the line width" do
14
+ expect(pdf).to receive(:mask).with(:line_width)
15
+ subject.draw_row(0)
16
+ end
17
+
18
+ it "sets the line width" do
19
+ expect(pdf).to receive(:line_width)
20
+ subject.draw_row(0)
21
+ end
22
+
23
+ it "draws the horizontal line" do
24
+ expect(pdf).to receive(:stroke_horizontal_line)
25
+ subject.draw_row(0)
26
+ end
27
+ end
28
+
29
+ describe "draw_column" do
30
+ it "draws a vertical line" do
31
+ expect(pdf).to receive(:stroke_vertical_line)
32
+ subject.draw_column(0)
33
+ end
34
+ end
35
+
36
+ describe "#draw" do
37
+
38
+ before do
39
+ allow(pdf).to receive(:mask).and_yield
40
+ allow(pdf).to receive(:bounding_box).and_yield
41
+ end
42
+
43
+ it "sets the fill color" do
44
+ expect(pdf).to receive(:stroke_color)
45
+ subject.draw
46
+ end
47
+
48
+ it "draws the horizontal lines" do
49
+ allow(subject).to receive(:rows).and_return(2)
50
+ expect(subject).to receive(:draw_row).exactly(3).times
51
+ subject.draw
52
+ end
53
+
54
+ it "draws the vertical lines" do
55
+ allow(subject).to receive(:columns).and_return(3)
56
+ expect(subject).to receive(:draw_column).exactly(4).times
57
+ subject.draw
58
+ end
59
+ end
60
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  require 'coveralls'
2
2
  Coveralls.wear!
3
3
 
4
+ require 'rspec/collection_matchers'
5
+
4
6
  $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '../lib')
5
7
  require 'dot_grid'
6
8
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dot_grid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott LaBounty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-13 00:00:00.000000000 Z
11
+ date: 2014-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -16,14 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 2.14.1
19
+ version: 3.0.0
20
20
  type: :development
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: 2.14.1
26
+ version: 3.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec-collection_matchers
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 1.0.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 1.0.0
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rake
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -42,30 +56,30 @@ dependencies:
42
56
  name: coveralls
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - '>='
59
+ - - ~>
46
60
  - !ruby/object:Gem::Version
47
- version: '0'
61
+ version: 0.7.1
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
- - - '>='
66
+ - - ~>
53
67
  - !ruby/object:Gem::Version
54
- version: '0'
68
+ version: 0.7.1
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: prawn
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - ~>
60
74
  - !ruby/object:Gem::Version
61
- version: 1.1.0
75
+ version: 1.2.1
62
76
  type: :runtime
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - ~>
67
81
  - !ruby/object:Gem::Version
68
- version: 1.1.0
82
+ version: 1.2.1
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: trollop
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -107,12 +121,14 @@ files:
107
121
  - lib/dot_grid/page/dot_grid.rb
108
122
  - lib/dot_grid/page/factory.rb
109
123
  - lib/dot_grid/page/grid.rb
124
+ - lib/dot_grid/page/grid_plus_lines.rb
110
125
  - lib/dot_grid/page/horizontal_rule.rb
111
126
  - lib/dot_grid/page/page.rb
112
127
  - lib/dot_grid/page/planner.rb
113
128
  - lib/dot_grid/pattern/checkerboard.rb
114
129
  - lib/dot_grid/pattern/dot_grid.rb
115
130
  - lib/dot_grid/pattern/grid.rb
131
+ - lib/dot_grid/pattern/grid_plus_lines.rb
116
132
  - lib/dot_grid/pattern/horizontal_rule.rb
117
133
  - lib/dot_grid/pattern/pattern.rb
118
134
  - lib/dot_grid/pattern/square_grid.rb
@@ -123,12 +139,14 @@ files:
123
139
  - spec/lib/dot_grid/page/checkerboard_spec.rb
124
140
  - spec/lib/dot_grid/page/dot_grid_spec.rb
125
141
  - spec/lib/dot_grid/page/factory_spec.rb
142
+ - spec/lib/dot_grid/page/grid_plus_lines_spec.rb
126
143
  - spec/lib/dot_grid/page/grid_spec.rb
127
144
  - spec/lib/dot_grid/page/horizontal_rule_spec.rb
128
145
  - spec/lib/dot_grid/page/page_spec.rb
129
146
  - spec/lib/dot_grid/page/planner_spec.rb
130
147
  - spec/lib/dot_grid/pattern/checkerboard_spec.rb
131
148
  - spec/lib/dot_grid/pattern/dot_grid_spec.rb
149
+ - spec/lib/dot_grid/pattern/grid_plus_lines_spec.rb
132
150
  - spec/lib/dot_grid/pattern/grid_spec.rb
133
151
  - spec/lib/dot_grid/pattern/horizontal_rule_spec.rb
134
152
  - spec/lib/dot_grid/pattern/pattern_spec.rb
@@ -164,12 +182,14 @@ test_files:
164
182
  - spec/lib/dot_grid/page/checkerboard_spec.rb
165
183
  - spec/lib/dot_grid/page/dot_grid_spec.rb
166
184
  - spec/lib/dot_grid/page/factory_spec.rb
185
+ - spec/lib/dot_grid/page/grid_plus_lines_spec.rb
167
186
  - spec/lib/dot_grid/page/grid_spec.rb
168
187
  - spec/lib/dot_grid/page/horizontal_rule_spec.rb
169
188
  - spec/lib/dot_grid/page/page_spec.rb
170
189
  - spec/lib/dot_grid/page/planner_spec.rb
171
190
  - spec/lib/dot_grid/pattern/checkerboard_spec.rb
172
191
  - spec/lib/dot_grid/pattern/dot_grid_spec.rb
192
+ - spec/lib/dot_grid/pattern/grid_plus_lines_spec.rb
173
193
  - spec/lib/dot_grid/pattern/grid_spec.rb
174
194
  - spec/lib/dot_grid/pattern/horizontal_rule_spec.rb
175
195
  - spec/lib/dot_grid/pattern/pattern_spec.rb