dot_grid 0.0.11 → 0.0.12

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: f335ec567f768314689a098563250d89d0ab3618
4
- data.tar.gz: 82312df6b01c0d7e9ad129fa49823f3b1578414b
3
+ metadata.gz: fe3f6f66185eec4acdf0e1190f1122adc7ce8113
4
+ data.tar.gz: 5977a1d7890f34c50995284c10a2926a39d1fa7b
5
5
  SHA512:
6
- metadata.gz: 6ae51ca4792a330d8ad5e5522acb9a8605a412fd7214b68af2bb9d7a213b1baae4c4b30130c46f816c67a479284dddd36c78925b38ac23322c82242850762673
7
- data.tar.gz: fc51b75a5ff46f29a0a1a5ae04152de84d74ff15c9f88d5f4a370e4ea6a425b3a59597c1533361a07830c2e5394b61095b35fd3706b6481601322fd03a2602af
6
+ metadata.gz: 5f99ec483e119b483824e2f9f99273963540f65dbe75a3b17d73032781af89610182d633b5604420807ab4c0e27dded7ab95aa6aece695d6a717a610ade5300f
7
+ data.tar.gz: bdf8e4c4b282afe69ca9417652c4bfe98e897782b5e55578e66f4149195d60b89bc4299eb6d6d2a50206d4522783b686077384f81269d59ea5f2eba93645860e
data/README.md CHANGED
@@ -34,8 +34,11 @@ A simple ruby file for generating dot grid graph paper.
34
34
  ### Multiple page types (either with no spaces after commas or in quotes).
35
35
  dot_grid -f page_types.pdf --page-types "planner, checkerboard, grid, dot_grid" --spacing 5 --grid-color CFBAEC --margin 0.0
36
36
 
37
+ ### A basic dot dash page can be generated like this ...
38
+ dot_grid -f dot_dash.pdf --page-types dot_dash --spacing 5 --grid-color CFBAEC --dot-weight 0.5 -m 0.0
39
+
37
40
  ### All of the pages at once ...
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
41
+ dot_grid -f page_types.pdf --page-types "planner, checkerboard, grid, dot_grid, horizontal_rule, grid_plus_lines, dot_dash" --spacing 5 --grid-color CFBAEC -m 0.0
39
42
 
40
43
  ### To get help on the command and its options ...
41
44
  dot_grid --help
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: planner, checkerboard, grid, dot_grid, horizontal_rule, grid_plus_lines", 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, dot_dash", 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"
@@ -0,0 +1,11 @@
1
+ module DotGrid
2
+ module Page
3
+ class DotDash < Page
4
+
5
+ def post_initialize(params)
6
+ add_pattern(::DotGrid::Pattern::DotDash.new(params))
7
+ end
8
+ end
9
+ end
10
+ end
11
+
@@ -9,7 +9,8 @@ module DotGrid
9
9
  'grid' => ::DotGrid::Page::Grid,
10
10
  'grid_plus_lines' => ::DotGrid::Page::GridPlusLines,
11
11
  'horizontal_rule' => ::DotGrid::Page::HorizontalRule,
12
- 'checkerboard' => ::DotGrid::Page::Checkerboard
12
+ 'checkerboard' => ::DotGrid::Page::Checkerboard,
13
+ 'dot_dash' => ::DotGrid::Page::DotDash,
13
14
  }
14
15
 
15
16
  def self.build(page_type, params)
@@ -0,0 +1,28 @@
1
+ module DotGrid
2
+ module Pattern
3
+ class DotDash < Pattern
4
+ attr_accessor(
5
+ :dot_weight,
6
+ )
7
+
8
+ POST_DOT_SPACING = 0.2
9
+ TO_LENGTH = 1.0 - POST_DOT_SPACING
10
+
11
+ def post_initialize(params)
12
+ @dot_weight = params[:dot_weight] || 1.5
13
+ end
14
+
15
+ def draw
16
+ pdf.line_width @dot_weight
17
+ pdf.fill_color grid_color
18
+ pdf.stroke_color grid_color
19
+ draw_grid do |row, column|
20
+ pdf.fill_circle [column*spacing, row*spacing], dot_weight
21
+ pdf.stroke_horizontal_line(column*spacing+POST_DOT_SPACING*spacing, column*spacing+spacing*TO_LENGTH, :at => row*spacing)
22
+ pdf.stroke_vertical_line(row*spacing+POST_DOT_SPACING*spacing, row*spacing+spacing*TO_LENGTH, :at => column*spacing)
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+
@@ -1,3 +1,3 @@
1
1
  module DotGrid
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
data/lib/dot_grid.rb CHANGED
@@ -11,6 +11,7 @@ require 'dot_grid/page/grid'
11
11
  require 'dot_grid/page/grid_plus_lines'
12
12
  require 'dot_grid/page/horizontal_rule'
13
13
  require 'dot_grid/page/checkerboard'
14
+ require 'dot_grid/page/dot_dash'
14
15
  require 'dot_grid/page/factory'
15
16
 
16
17
  require 'dot_grid/pattern/pattern'
@@ -19,6 +20,7 @@ require 'dot_grid/pattern/grid_plus_lines'
19
20
  require 'dot_grid/pattern/dot_grid'
20
21
  require 'dot_grid/pattern/checkerboard'
21
22
  require 'dot_grid/pattern/horizontal_rule'
23
+ require 'dot_grid/pattern/dot_dash'
22
24
  require 'dot_grid/pattern/square_grid'
23
25
 
24
26
  module DotGrid
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe "DotGrid::Page::DotDash" do
4
+ describe "#post_initialize" do
5
+ let(:subject) { DotGrid::Page::DotDash.new({})}
6
+
7
+ before do
8
+ allow(::DotGrid::Pattern::DotDash).to receive(:new)
9
+ end
10
+
11
+ it "adds the pattern" do
12
+ expect(subject).to receive(:add_pattern)
13
+ subject.post_initialize({})
14
+ end
15
+ end
16
+ end
17
+
@@ -0,0 +1,50 @@
1
+ require 'spec_helper'
2
+
3
+ describe "DotGrid::Pattern::DotDash" do
4
+ describe "#draw" do
5
+ let(:pdf) { double('pdf').as_null_object }
6
+ let(:params) { { pdf: pdf, bounds: double('bounds', { upper_left: [0, 0], height: 20.mm, width: 10.mm } ), spacing: 5 } }
7
+ let(:subject) { DotGrid::Pattern::DotDash.new(params) }
8
+
9
+ before do
10
+ allow(pdf).to receive(:bounding_box).and_yield
11
+ end
12
+
13
+ it "sets the fill color" do
14
+ expect(pdf).to receive(:fill_color)
15
+ subject.draw
16
+ end
17
+
18
+ it "sets the line width" do
19
+ expect(pdf).to receive(:line_width)
20
+ subject.draw
21
+ end
22
+
23
+ it "sets the stroke color" do
24
+ expect(pdf).to receive(:stroke_color)
25
+ subject.draw
26
+ end
27
+
28
+ it "calls fill circle the correct number of times" do
29
+ allow(subject).to receive(:rows).and_return(2)
30
+ allow(subject).to receive(:columns).and_return(3)
31
+ expect(pdf).to receive(:fill_circle).exactly(3*4).times
32
+ subject.draw
33
+ end
34
+
35
+ it "calls horizontal line the correct number of times" do
36
+ allow(subject).to receive(:rows).and_return(2)
37
+ allow(subject).to receive(:columns).and_return(3)
38
+ expect(pdf).to receive(:stroke_horizontal_line).exactly(3*4).times
39
+ subject.draw
40
+ end
41
+
42
+ it "calls vertical line the correct number of times" do
43
+ allow(subject).to receive(:rows).and_return(2)
44
+ allow(subject).to receive(:columns).and_return(3)
45
+ expect(pdf).to receive(:stroke_vertical_line).exactly(3*4).times
46
+ subject.draw
47
+ end
48
+ end
49
+ end
50
+
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.11
4
+ version: 0.0.12
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-17 00:00:00.000000000 Z
11
+ date: 2014-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -118,6 +118,7 @@ files:
118
118
  - lib/dot_grid/document.rb
119
119
  - lib/dot_grid/generator.rb
120
120
  - lib/dot_grid/page/checkerboard.rb
121
+ - lib/dot_grid/page/dot_dash.rb
121
122
  - lib/dot_grid/page/dot_grid.rb
122
123
  - lib/dot_grid/page/factory.rb
123
124
  - lib/dot_grid/page/grid.rb
@@ -126,6 +127,7 @@ files:
126
127
  - lib/dot_grid/page/page.rb
127
128
  - lib/dot_grid/page/planner.rb
128
129
  - lib/dot_grid/pattern/checkerboard.rb
130
+ - lib/dot_grid/pattern/dot_dash.rb
129
131
  - lib/dot_grid/pattern/dot_grid.rb
130
132
  - lib/dot_grid/pattern/grid.rb
131
133
  - lib/dot_grid/pattern/grid_plus_lines.rb
@@ -137,6 +139,7 @@ files:
137
139
  - spec/lib/dot_grid/document_spec.rb
138
140
  - spec/lib/dot_grid/generator_spec.rb
139
141
  - spec/lib/dot_grid/page/checkerboard_spec.rb
142
+ - spec/lib/dot_grid/page/dot_dash_spec.rb
140
143
  - spec/lib/dot_grid/page/dot_grid_spec.rb
141
144
  - spec/lib/dot_grid/page/factory_spec.rb
142
145
  - spec/lib/dot_grid/page/grid_plus_lines_spec.rb
@@ -145,6 +148,7 @@ files:
145
148
  - spec/lib/dot_grid/page/page_spec.rb
146
149
  - spec/lib/dot_grid/page/planner_spec.rb
147
150
  - spec/lib/dot_grid/pattern/checkerboard_spec.rb
151
+ - spec/lib/dot_grid/pattern/dot_dash_spec.rb
148
152
  - spec/lib/dot_grid/pattern/dot_grid_spec.rb
149
153
  - spec/lib/dot_grid/pattern/grid_plus_lines_spec.rb
150
154
  - spec/lib/dot_grid/pattern/grid_spec.rb
@@ -171,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
175
  version: '0'
172
176
  requirements: []
173
177
  rubyforge_project:
174
- rubygems_version: 2.1.11
178
+ rubygems_version: 2.0.5
175
179
  signing_key:
176
180
  specification_version: 4
177
181
  summary: Dot Grid planner PDF generator.
@@ -180,6 +184,7 @@ test_files:
180
184
  - spec/lib/dot_grid/document_spec.rb
181
185
  - spec/lib/dot_grid/generator_spec.rb
182
186
  - spec/lib/dot_grid/page/checkerboard_spec.rb
187
+ - spec/lib/dot_grid/page/dot_dash_spec.rb
183
188
  - spec/lib/dot_grid/page/dot_grid_spec.rb
184
189
  - spec/lib/dot_grid/page/factory_spec.rb
185
190
  - spec/lib/dot_grid/page/grid_plus_lines_spec.rb
@@ -188,6 +193,7 @@ test_files:
188
193
  - spec/lib/dot_grid/page/page_spec.rb
189
194
  - spec/lib/dot_grid/page/planner_spec.rb
190
195
  - spec/lib/dot_grid/pattern/checkerboard_spec.rb
196
+ - spec/lib/dot_grid/pattern/dot_dash_spec.rb
191
197
  - spec/lib/dot_grid/pattern/dot_grid_spec.rb
192
198
  - spec/lib/dot_grid/pattern/grid_plus_lines_spec.rb
193
199
  - spec/lib/dot_grid/pattern/grid_spec.rb