Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Whitespace

  • Loading branch information...
commit 8c942646ada7158fe085f031f6bc9d2ce85d2546 1 parent c795c54
@brynary authored
View
18 lib/features2cards/card.rb
@@ -1,6 +1,6 @@
module Features2Cards
class Card
-
+
attr_reader :type
attr_reader :body
attr_reader :footer
@@ -14,10 +14,10 @@ def self.for_feature(feature)
body = actual_feature[0].gsub(/^\s*#{title}\n/, '')
card = [new(title, body, "")]
footer = title
-
+
actual_feature.shift
scenarios = actual_feature
-
+
scenarios.map do |scenario|
case(scenario[0])
when :scenario_outline
@@ -29,25 +29,25 @@ def self.for_feature(feature)
next
when :comment
next
- end
+ end
title = scenario[0] + " " + scenario[1]
scenario.shift
scenario.shift
body = ""
scenario.map do |step|
- body += step[2] + " " + step[3] + "\n" if step[0] == :step or step[0] == :step_invocation
+ body += step[2] + " " + step[3] + "\n" if step[0] == :step or step[0] == :step_invocation
end
card.push(new(title, body, footer))
end
-
+
return card
end
-
+
def initialize(type, body, footer = nil)
@type = type
@body = body
@footer = footer
end
-
+
end
-end
+end
View
2  lib/features2cards/cli.rb
@@ -110,4 +110,4 @@ def default_options
end
end
-end
+end
View
2  lib/features2cards/platform.rb
@@ -11,4 +11,4 @@ module Features2Cards
RAILS = defined?(Rails)
RUBY_BINARY = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
RUBY_1_9 = RUBY_VERSION =~ /^1\.9/
-end
+end
View
26 lib/features2cards/prawn.rb
@@ -3,23 +3,23 @@
class Prawn::Document
CARD_WIDTH = 72 * 5 # 5 inches
CARD_HEIGHT = 72 * 3 # 3 inches
-
+
def self.generate_cards(outfile, cards)
generate(outfile, :page_layout => :landscape) do
row = 2
col = 0
-
+
cards.each do |card|
if row == 0
start_new_page
row = 2
col = 0
end
-
+
draw_card(card, row, col)
-
+
col += 1
-
+
if col > 1
col = 0
row -= 1
@@ -27,13 +27,13 @@ def self.generate_cards(outfile, cards)
end
end
end
-
+
def margin_box(margin, &block)
bounding_box [bounds.left + margin, bounds.top - margin],
:width => bounds.width - (margin * 2), :height => bounds.height - (margin * 2),
&block
end
-
+
def outline_box
stroke_rectangle bounds.top_left, bounds.width, bounds.height
end
@@ -41,16 +41,16 @@ def outline_box
def draw_card(card, row, col)
bounding_box [CARD_WIDTH * col, CARD_HEIGHT * row + ((bounds.height - (2*CARD_HEIGHT))/2)],
:width => CARD_WIDTH, :height => CARD_HEIGHT do
-
+
outline_box
-
+
margin_box 8 do
text card.type, :size => 12
-
+
margin_box 16 do
text card.body, :size => 10, :align => :left
end
-
+
unless card.footer.nil?
bounding_box [bounds.left, bounds.bottom + 10], :width => bounds.width, :height => 10 do
text card.footer, :size => 8, :align => :right
@@ -59,5 +59,5 @@ def draw_card(card, row, col)
end
end
end
-
-end
+
+end
View
4 spec/features2cards/card_spec.rb
@@ -3,6 +3,6 @@
module Features2Cards
describe Card do
-
+
end
-end
+end
View
8 spec/features2cards/cli_spec.rb
@@ -2,20 +2,20 @@
require 'features2cards/cli'
module Features2Cards
- describe CLI do
+ describe CLI do
it "should parse feature" do
cli = CLI.execute(%w{examples/self_test/features/features2cards.feature})
end
-
+
it "should parse feature in german" do
cli = CLI.execute(%w{examples/i18n/de})
end
-
+
it "should accept --out option" do
cli = CLI.new(StringIO.new)
cli.parse!(%w{--out test.pdf})
cli.options[:pdf_file].should == 'test.pdf'
- end
+ end
end
end
View
2  spec/features2cards/prawn_spec.rb
@@ -2,4 +2,4 @@
require 'prawn'
describe Prawn::Document do
-end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.