features2cards 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. data/.gitignore +3 -0
  2. data/History.txt +11 -0
  3. data/README.rdoc +2 -3
  4. data/Rakefile +26 -2
  5. data/Thorfile +114 -0
  6. data/examples/i18n/.gitignore +1 -0
  7. data/examples/i18n/README.textile +18 -0
  8. data/examples/i18n/Rakefile +30 -0
  9. data/examples/i18n/ar/addition.feature +17 -0
  10. data/examples/i18n/bg/addition.feature +12 -0
  11. data/examples/i18n/bg/consecutive_calculations.feature +19 -0
  12. data/examples/i18n/bg/division.feature +17 -0
  13. data/examples/i18n/cat/suma.feature +17 -0
  14. data/examples/i18n/da/summering.feature +18 -0
  15. data/examples/i18n/de/addition.feature +17 -0
  16. data/examples/i18n/de/division.feature +10 -0
  17. data/examples/i18n/en-lol/stuffing.feature +8 -0
  18. data/examples/i18n/en/addition.feature +17 -0
  19. data/examples/i18n/en/division.feature +10 -0
  20. data/examples/i18n/es/adicion.feature +17 -0
  21. data/examples/i18n/et/jagamine.feature +10 -0
  22. data/examples/i18n/et/liitmine.feature +17 -0
  23. data/examples/i18n/fi/jakolasku.feature +10 -0
  24. data/examples/i18n/fi/yhteenlasku.feature +16 -0
  25. data/examples/i18n/fr/addition.feature +18 -0
  26. data/examples/i18n/he/addition.feature +17 -0
  27. data/examples/i18n/he/division.feature +10 -0
  28. data/examples/i18n/hu/addition.feature +17 -0
  29. data/examples/i18n/hu/division.feature +10 -0
  30. data/examples/i18n/id/addition.feature +17 -0
  31. data/examples/i18n/id/division.feature +10 -0
  32. data/examples/i18n/it/somma.feature +11 -0
  33. data/examples/i18n/ja/addition.feature +17 -0
  34. data/examples/i18n/ja/division.feature +10 -0
  35. data/examples/i18n/ko/addition.feature +17 -0
  36. data/examples/i18n/ko/division.feature +11 -0
  37. data/examples/i18n/lt/addition.feature +17 -0
  38. data/examples/i18n/lt/division.feature +10 -0
  39. data/examples/i18n/lv/addition.feature +17 -0
  40. data/examples/i18n/lv/division.feature +10 -0
  41. data/examples/i18n/no/summering.feature +19 -0
  42. data/examples/i18n/pl/addition.feature +17 -0
  43. data/examples/i18n/pl/division.feature +10 -0
  44. data/examples/i18n/pt/adicao.feature +11 -0
  45. data/examples/i18n/ro/suma.feature +11 -0
  46. data/examples/i18n/ru/addition.feature +11 -0
  47. data/examples/i18n/ru/consecutive_calculations.feature +17 -0
  48. data/examples/i18n/ru/division.feature +16 -0
  49. data/examples/i18n/se/summering.feature +18 -0
  50. data/examples/i18n/sk/addition.feature +17 -0
  51. data/examples/i18n/sk/division.feature +10 -0
  52. data/examples/i18n/zh-CN/addition.feature +18 -0
  53. data/examples/i18n/zh-TW/addition.feature +17 -0
  54. data/examples/i18n/zh-TW/division.feature +11 -0
  55. data/examples/self_test/.gitignore +2 -0
  56. data/examples/self_test/features/features2cards.feature +19 -0
  57. data/features/features2cards_cli.feature +40 -0
  58. data/features/step_definitions/features2cards_steps.rb +41 -0
  59. data/features/support/env.rb +79 -0
  60. data/features2cards.gemspec +118 -0
  61. data/lib/features2cards.rb +2 -8
  62. data/lib/features2cards/card.rb +14 -10
  63. data/lib/features2cards/cli.rb +27 -34
  64. data/lib/features2cards/platform.rb +1 -1
  65. data/lib/features2cards/prawn.rb +13 -13
  66. data/spec/features2cards/card_spec.rb +8 -0
  67. data/spec/features2cards/cli_spec.rb +21 -0
  68. data/spec/features2cards/prawn_spec.rb +5 -0
  69. data/spec/spec.opts +2 -0
  70. data/spec/spec_helper.rb +7 -0
  71. metadata +81 -12
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ pkg
2
+ *.pdf
3
+
data/History.txt CHANGED
@@ -1,3 +1,14 @@
1
+ === 0.4.0 / 2009-11-09
2
+
3
+ * 1 major enhancements
4
+
5
+ * Upgraded to Cucumber > 0.4.x (Kosmas Schütz)
6
+ * Use language specified in feature files (Kosmas Schütz)
7
+
8
+ * 1 bug fix
9
+
10
+ * Don't require rubygems or modify load path in lib/ code (Bryan Helmkamp)
11
+
1
12
  === 0.3.1 / 2009-06-12
2
13
 
3
14
  The Kosmas Schütz Release.
data/README.rdoc CHANGED
@@ -13,11 +13,10 @@ off our sprints to create index cards for our task board.
13
13
 
14
14
  Examples:
15
15
  features2cards features2cards.feature
16
- features2cards --out italian.pdf--language it examples/i18n/it
16
+ features2cards --out italian.pdf examples/i18n/it
17
17
 
18
18
  === Options
19
19
 
20
- -l [LANG], --language [LANG] Specify language for features (Default: en)
21
20
  -o, --out [FILE] Specify pdf output file (Default: cards.pdf).
22
21
  --version Show version
23
22
  -h, --help Show help
@@ -33,5 +32,5 @@ off our sprints to create index cards for our task board.
33
32
 
34
33
  == License
35
34
 
36
- Copyright (c) 2008 Bryan Helmkamp.
35
+ Copyright (c) 2008-2009 Bryan Helmkamp.
37
36
  See MIT-LICENSE.txt in this directory.
data/Rakefile CHANGED
@@ -1,7 +1,31 @@
1
1
  require 'rubygems'
2
2
  require "rake/gempackagetask"
3
3
  require "rake/clean"
4
- require './lib/features2cards.rb'
4
+ require "spec/rake/spectask"
5
+ require 'cucumber/rake/task'
6
+
7
+ $:.unshift('lib')
8
+ require 'features2cards'
9
+
10
+ desc "Run the Features2Cards specs"
11
+ Spec::Rake::SpecTask.new do |t|
12
+ t.spec_opts = ['--options', "spec/spec.opts"]
13
+ t.spec_files = FileList['spec/**/*_spec.rb']
14
+ t.rcov = ENV['RCOV']
15
+ t.rcov_opts = %w{--exclude osx\/objc,gems\/,spec\/}
16
+ t.verbose = true
17
+ end
18
+
19
+ Cucumber::Rake::Task.new(:features) do |t|
20
+ t.cucumber_opts = "--format pretty"
21
+ end
22
+
23
+ namespace :features do
24
+ Cucumber::Rake::Task.new(:rcov) do |t|
25
+ t.rcov = true
26
+ t.rcov_opts = %w{--rails --exclude osx\/objc,gems\/,spec\/}
27
+ t.rcov_opts << %[-o "features_rcov"]
28
+ end
29
+ end
5
30
 
6
- Dir['rake_tasks/**/*.rake'].each { |rake| load rake }
7
31
 
data/Thorfile ADDED
@@ -0,0 +1,114 @@
1
+ module GemHelpers
2
+
3
+ def generate_gemspec
4
+ $LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), "lib")))
5
+ require "features2cards"
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "features2cards"
9
+ s.version = Features2Cards::VERSION::STRING
10
+ s.author = "Bryan Helmkamp"
11
+ s.email = "bryan@brynary.com"
12
+ s.homepage = "http://github.com/brynary/features2cards"
13
+ s.summary = "Generate printable PDF index cards from Cucumber feature files"
14
+ s.description = <<-EOS.strip
15
+ Create PDF cards from Cucumber features and scenarios for printing. We use it as we kick
16
+ off our sprints to create index cards for our task board.
17
+ EOS
18
+ s.rubyforge_project = "features2cards"
19
+
20
+ s.executables = "features2cards"
21
+
22
+ require "git"
23
+ repo = Git.open(".")
24
+
25
+ s.files = normalize_files(repo.ls_files.keys - repo.lib.ignored_files)
26
+ s.test_files = normalize_files(Dir['spec/**/*.rb'] - repo.lib.ignored_files)
27
+
28
+ s.has_rdoc = true
29
+ s.extra_rdoc_files = %w[History.txt README.rdoc MIT-LICENSE.txt]
30
+
31
+ s.add_dependency "prawn"
32
+ end
33
+ end
34
+
35
+ def normalize_files(array)
36
+ # only keep files, no directories, and sort
37
+ array.select do |path|
38
+ File.file?(path)
39
+ end.sort
40
+ end
41
+
42
+ # Adds extra space when outputting an array. This helps create better version
43
+ # control diffs, because otherwise it is all on the same line.
44
+ def prettyify_array(gemspec_ruby, array_name)
45
+ gemspec_ruby.gsub(/s\.#{array_name.to_s} = \[.+?\]/) do |match|
46
+ leadin, files = match[0..-2].split("[")
47
+ leadin + "[\n #{files.split(",").join(",\n ")}\n ]"
48
+ end
49
+ end
50
+
51
+ def read_gemspec
52
+ @read_gemspec ||= eval(File.read("features2cards.gemspec"))
53
+ end
54
+
55
+ def sh(command)
56
+ puts command
57
+ system command
58
+ end
59
+ end
60
+
61
+ class Default < Thor
62
+ include GemHelpers
63
+
64
+ desc "gemspec", "Regenerate features2cards.gemspec"
65
+ def gemspec
66
+ File.open("features2cards.gemspec", "w") do |file|
67
+ gemspec_ruby = generate_gemspec.to_ruby
68
+ gemspec_ruby = prettyify_array(gemspec_ruby, :files)
69
+ gemspec_ruby = prettyify_array(gemspec_ruby, :test_files)
70
+ gemspec_ruby = prettyify_array(gemspec_ruby, :extra_rdoc_files)
71
+
72
+ file.write gemspec_ruby
73
+ end
74
+
75
+ puts "Wrote gemspec to features2cards.gemspec"
76
+ read_gemspec.validate
77
+ end
78
+
79
+ desc "build", "Build a features2cards gem"
80
+ def build
81
+ sh "gem build features2cards.gemspec"
82
+ FileUtils.mkdir_p "pkg"
83
+ FileUtils.mv read_gemspec.file_name, "pkg"
84
+ end
85
+
86
+ desc "install", "Install the latest built gem"
87
+ def install
88
+ sh "gem install --local pkg/#{read_gemspec.file_name}"
89
+ end
90
+
91
+ desc "release", "Release the current branch to GitHub and Gemcutter"
92
+ def release
93
+ gemspec
94
+ build
95
+ Release.new.tag
96
+ Release.new.gem
97
+ end
98
+ end
99
+
100
+ class Release < Thor
101
+ include GemHelpers
102
+
103
+ desc "tag", "Tag the gem on the origin server"
104
+ def tag
105
+ release_tag = "v#{read_gemspec.version}"
106
+ sh "git tag -a #{release_tag} -m 'Tagging #{release_tag}'"
107
+ sh "git push origin #{release_tag}"
108
+ end
109
+
110
+ desc "gem", "Push the gem to Gemcutter"
111
+ def gem
112
+ sh "gem push pkg/#{read_gemspec.file_name}"
113
+ end
114
+ end
@@ -0,0 +1 @@
1
+ *.pdf
@@ -0,0 +1,18 @@
1
+ h1. Internationalisation (i18n) examples
2
+
3
+ Under this directory you'll find examples of Cucumber features written in
4
+ many of the natural languages Cucumber supports.
5
+
6
+ For a full list of what languages Cucumber supports - run <pre>cucumber --language help</pre>
7
+
8
+ h2. Running all the examples
9
+
10
+ Open a shell in this directory and run
11
+
12
+ <pre>rake i18n</pre>
13
+
14
+ h2. Running examples for a specific language
15
+
16
+ Open a shell in the directory for the specific language and run
17
+
18
+ <pre>rake features</pre>
@@ -0,0 +1,30 @@
1
+ desc 'Run features for all languages'
2
+ task :i18n do
3
+ dir = File.dirname(__FILE__)
4
+ Dir["#{dir}/*"].each do |f|
5
+ if File.directory?(f)
6
+ lang = f[dir.length+1..-1]
7
+ if examples_working?(lang)
8
+ Dir.chdir(f) do
9
+ rake("features")
10
+ end
11
+ else
12
+ STDERR.puts %{
13
+ !!!!!
14
+ !!!!!
15
+ !!!!! SKIPPING #{lang} (The examples are out of date - please help update them)
16
+ !!!!!
17
+ !!!!!
18
+ }
19
+ end
20
+ end
21
+ end
22
+ end
23
+
24
+ def examples_working?(lang)
25
+ !%w{ro ko li lt}.index(lang)
26
+ end
27
+
28
+ def rake(args)
29
+ ruby($0, args) rescue nil
30
+ end
@@ -0,0 +1,17 @@
1
+ # language: ar
2
+ خاصية: الجمع
3
+ من اجل تجنب الأخطاء السخيفة
4
+ كشخص غبي في الرياضيات
5
+ اريد معرفة ناتج جمع عددين
6
+
7
+ سيناريو مخطط: جمع عددين
8
+ بفرض كتابة <input_1> في الآلة الحاسبة
9
+ و كتابة <input_2> في الآلة الحاسبة
10
+ متى يتم الضغط على <button>
11
+ اذاً يظهر <output> على الشاشة
12
+
13
+ امثلة:
14
+ | input_1 | input_2 | button | output |
15
+ | 20 | 30 | جمع | 50 |
16
+ | 2 | 5 | جمع | 7 |
17
+ | 0 | 40 | جمع | 40 |
@@ -0,0 +1,12 @@
1
+ # language: bg
2
+ Функционалност: Събиране на числа
3
+ За да не го правят наум
4
+ Потребителите
5
+ Трябва да могат да събират числа с калкулатора
6
+
7
+ Сценарий: Събиране на две цели числа
8
+ Дадено е че съм въвел 50
9
+ И съм въвел 70
10
+ Когато натисна "+"
11
+ То резултата трябва да е равен на 120
12
+
@@ -0,0 +1,19 @@
1
+ # language: bg
2
+ Функционалост: Последователни изчисления
3
+ За да не го правят наум
4
+ Потребителите
5
+ Трябва да могат да извършват последователни изчисления с калкулатора
6
+
7
+ Предистория:
8
+ Дадено е че съм събрал 3 и 5
9
+
10
+ Сценарий: събиране с резултата от последната операция
11
+ Когато въведа 4
12
+ И натисна "+"
13
+ То резултата трябва да е равен на 12
14
+
15
+ Сценарий: делене с резултата от последната операция
16
+ Когато въведа 2
17
+ И натисна "/"
18
+ То резултата трябва да е равен на 4
19
+
@@ -0,0 +1,17 @@
1
+ # language: bg
2
+ Фунцкционалност: Делене на числа
3
+ За да не го правят наум
4
+ Потребителите
5
+ Трябва да могат да разделят числа с калкулатора
6
+
7
+ Рамка на сценарий: Делене на цели числа
8
+ Дадено е че съм въвел <делимо>
9
+ И е че съм въвел <делител>
10
+ Когато натисна "/"
11
+ То резултата трябва да е равен на <частно>
12
+
13
+ Примери:
14
+ | делимо | делител | частно |
15
+ | 100 | 2 | 50 |
16
+ | 28 | 7 | 4 |
17
+ | 0 | 5 | 0 |
@@ -0,0 +1,17 @@
1
+ # language: cat
2
+ Característica: Suma
3
+ Per evitar fer errors tontos
4
+ Com un matemàtic idiota
5
+ Vull saber la suma dels números
6
+
7
+ Esquema de l'escenari: Sumar dos números
8
+ Donat que he introduït <entrada_1> a la calculadora
9
+ I que he introduït <entrada_2> a la calculadora
10
+ Quan premo el <botó>
11
+ Aleshores el resultat ha de ser <resultat> a la pantalla
12
+
13
+ Exemples:
14
+ | entrada_1 | entrada_2 | botó | resultat |
15
+ | 20 | 30 | add | 50 |
16
+ | 2 | 5 | add | 7 |
17
+ | 0 | 40 | add | 40 |
@@ -0,0 +1,18 @@
1
+ # language: da
2
+ Egenskab: Summering
3
+ For at slippe for at lave dumme fejl
4
+ Som en regnskabsfører
5
+ Vil jeg kunne lægge sammen
6
+
7
+ Scenarie: to tal
8
+ Givet at jeg har indtastet 5
9
+ Og at jeg har indtastet 7
10
+ Når jeg summerer
11
+ Så skal resultatet være 12
12
+
13
+ Scenarie: tre tal
14
+ Givet at jeg har indtastet 5
15
+ Og at jeg har indtastet 7
16
+ Og at jeg har indtastet 1
17
+ Når jeg summerer
18
+ Så skal resultatet være 13
@@ -0,0 +1,17 @@
1
+ # language: de
2
+ Funktionalität: Addition
3
+ Um dumme Fehler zu vermeiden
4
+ möchte ich als Matheidiot
5
+ die Summe zweier Zahlen gesagt bekommen
6
+
7
+ Szenariogrundriss: Zwei Zahlen hinzufügen
8
+ Gegeben sei ich habe <Eingabe_1> in den Taschenrechner eingegeben
9
+ Und ich habe <Eingabe_2> in den Taschenrechner eingegeben
10
+ Wenn ich <Knopf> drücke
11
+ Dann sollte das Ergebniss auf dem Bildschirm <Ausgabe> sein
12
+
13
+ Beispiele:
14
+ | Eingabe_1 | Eingabe_2 | Knopf | Ausgabe |
15
+ | 20 | 30 | add | 50 |
16
+ | 2 | 5 | add | 7 |
17
+ | 0 | 40 | add | 40 |
@@ -0,0 +1,10 @@
1
+ # language: de
2
+ Funktionalität: Division
3
+ Um dumme Fehler zu vermeiden
4
+ müssen Kassierer in der Lage sein einen Bruchteil zu berechnen
5
+
6
+ Szenario: Normale Zahlen
7
+ Gegeben sei ich habe 3 in den Taschenrechner eingegeben
8
+ Und ich habe 2 in den Taschenrechner eingegeben
9
+ Wenn ich divide drücke
10
+ Dann sollte das Ergebniss auf dem Bildschirm 1.5 sein
@@ -0,0 +1,8 @@
1
+ # language: en-lol
2
+ OH HAI: STUFFING
3
+
4
+ MISHUN: CUCUMBR
5
+ I CAN HAZ IN TEH BEGINNIN 3 CUCUMBRZ
6
+ WEN I EAT 2 CUCUMBRZ
7
+ DEN I HAS 2 CUCUMBERZ IN MAH BELLY
8
+ AN IN TEH END 1 CUCUMBRZ KTHXBAI
@@ -0,0 +1,17 @@
1
+ # language: en
2
+ Feature: Addition
3
+ In order to avoid silly mistakes
4
+ As a math idiot
5
+ I want to be told the sum of two numbers
6
+
7
+ Scenario Outline: Add two numbers
8
+ Given I have entered <input_1> into the calculator
9
+ And I have entered <input_2> into the calculator
10
+ When I press <button>
11
+ Then the result should be <output> on the screen
12
+
13
+ Examples:
14
+ | input_1 | input_2 | button | output |
15
+ | 20 | 30 | add | 50 |
16
+ | 2 | 5 | add | 7 |
17
+ | 0 | 40 | add | 40 |
@@ -0,0 +1,10 @@
1
+ # language: en
2
+ Feature: Division
3
+ In order to avoid silly mistakes
4
+ Cashiers must be able to calculate a fraction
5
+
6
+ Scenario: Regular numbers
7
+ Given I have entered 3 into the calculator
8
+ And I have entered 2 into the calculator
9
+ When I press divide
10
+ Then the result should be 1.5 on the screen
@@ -0,0 +1,17 @@
1
+ # language: es
2
+ Característica: adición
3
+ Para evitar hacer errores tontos
4
+ Como un matemático idiota
5
+ Quiero saber la suma de los números
6
+
7
+ Esquema del escenario: Sumar dos números
8
+ Dado que he introducido <entrada_1> en la calculadora
9
+ Y que he introducido <entrada_2> en la calculadora
10
+ Cuando oprimo el <botón>
11
+ Entonces el resultado debe ser <resultado> en la pantalla
12
+
13
+ Ejemplos:
14
+ | entrada_1 | entrada_2 | botón | resultado |
15
+ | 20 | 30 | add | 50 |
16
+ | 2 | 5 | add | 7 |
17
+ | 0 | 40 | add | 40 |