forked from jeremylightsmith/cards
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
making cards play nice w/ activesupport
- Loading branch information
1 parent
109e706
commit eaf6b76
Showing
19 changed files
with
91 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,29 @@ | ||
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__)) | ||
|
||
# this is making this a mac only distro, I'm afraid | ||
require 'rubygems' | ||
gem 'rb-appscript' | ||
require 'appscript' | ||
gem 'activesupport' | ||
require 'activesupport' | ||
|
||
require 'cards/extensions' | ||
require 'cards/builder' | ||
require 'cards/csv_parser' | ||
require 'cards/numbers_parser' | ||
|
||
require 'cards/layouts/column_layout' | ||
require 'cards/layouts/row_layout' | ||
require 'cards/layouts/nil_layout' | ||
|
||
require 'cards/card' | ||
require 'cards/card_wall' | ||
# writers | ||
require 'cards/writers/dot_writer' | ||
require 'cards/writers/graffle_writer' | ||
|
||
# csv builders | ||
require 'cards/csv_builder' | ||
require 'cards/master_story_list' | ||
require 'cards/tracker_csv' | ||
|
||
# osx specific - require them explicitly | ||
#require 'cards/numbers_parser' | ||
#require 'cards/writers/graffle_writer' | ||
|
||
module Cards | ||
VERSION = "0.9.1" | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
lib/cards/writers/graffle_writer.rb → lib/cards/graffle_writer.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,36 @@ | ||
require 'enumerator' | ||
|
||
module Cards | ||
class ColumnLayout | ||
def initialize(options = {}) | ||
@wrap_at = options.delete(:wrap_at) || 10 | ||
end | ||
module Layouts | ||
class ColumnLayout | ||
def initialize(options = {}) | ||
@wrap_at = options.delete(:wrap_at) || 10 | ||
end | ||
|
||
def layout(card) | ||
x = card.x | ||
card.children.each_slice(@wrap_at) do |slice| | ||
y = card.y + 1 | ||
slice.each do |child| | ||
child.x, child.y = x, y | ||
child.layout | ||
y += child.height | ||
def layout(card) | ||
x = card.x | ||
card.children.each_slice(@wrap_at) do |slice| | ||
y = card.y + 1 | ||
slice.each do |child| | ||
child.x, child.y = x, y | ||
child.layout | ||
y += child.height | ||
end | ||
x += slice.widths.max | ||
end | ||
x += slice.widths.max | ||
end | ||
end | ||
|
||
def width(card) | ||
width = 0 | ||
card.children.each_slice(@wrap_at) do |slice| | ||
width += slice.widths.max | ||
def width(card) | ||
width = 0 | ||
card.children.each_slice(@wrap_at) do |slice| | ||
width += slice.widths.max | ||
end | ||
width | ||
end | ||
width | ||
end | ||
|
||
def height(card) | ||
card.children.heights.sum | ||
def height(card) | ||
card.children.heights.sum | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
module Cards | ||
class NilLayout | ||
def layout(card) | ||
end | ||
module Layouts | ||
class NilLayout | ||
def layout(card) | ||
end | ||
|
||
def width(card) | ||
1 | ||
end | ||
def width(card) | ||
1 | ||
end | ||
|
||
def height(card) | ||
1 | ||
def height(card) | ||
1 | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
module Cards | ||
class RowLayout | ||
def layout(card) | ||
x = card.x | ||
card.children.each_with_index do |child, i| | ||
child.x = x | ||
child.y = card.y + 1 | ||
child.layout | ||
x += child.width | ||
module Layouts | ||
class RowLayout | ||
def layout(card) | ||
x = card.x | ||
card.children.each_with_index do |child, i| | ||
child.x = x | ||
child.y = card.y + 1 | ||
child.layout | ||
x += child.width | ||
end | ||
end | ||
end | ||
|
||
def width(card) | ||
card.children.map {|c| c.width}.sum | ||
end | ||
def width(card) | ||
card.children.map {|c| c.width}.sum | ||
end | ||
|
||
def height(card) | ||
card.children.map {|c| c.height}.max | ||
def height(card) | ||
card.children.map {|c| c.height}.max | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
spec/cards/writers/dot_writer_spec.rb → spec/cards/dot_writer_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
spec/cards/writers/text_writer_spec.rb → spec/cards/text_writer_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters