bobbyno-tbox 0.5.2 → 0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. data/History.txt +6 -0
  2. data/Manifest.txt +23 -12
  3. data/README.rdoc +20 -9
  4. data/Rakefile +13 -1
  5. data/app_generators/java/USAGE +14 -0
  6. data/app_generators/java/java_generator.rb +39 -0
  7. data/app_generators/java/templates/Greeting.java +24 -0
  8. data/app_generators/java/templates/GreetingTest.java +18 -0
  9. data/app_generators/java/templates/build.xml +55 -0
  10. data/app_generators/java/templates/lib/hamcrest-core.jar +0 -0
  11. data/app_generators/java/templates/lib/junit.jar +0 -0
  12. data/app_generators/java/templates/project.iml +22 -0
  13. data/app_generators/java/templates/project.ipr +259 -0
  14. data/app_generators/{tbox → ruby}/USAGE +1 -2
  15. data/app_generators/ruby/ruby_generator.rb +34 -0
  16. data/app_generators/{tbox → ruby}/templates/file.txt +0 -0
  17. data/app_generators/{tbox → ruby}/templates/rakefile.rb +0 -0
  18. data/app_generators/{tbox → ruby}/templates/right_triangle.rb +0 -6
  19. data/app_generators/{tbox → ruby}/templates/tbox.rb +0 -0
  20. data/app_generators/ruby/templates/test_helper.rb +9 -0
  21. data/app_generators/{tbox → ruby}/templates/test_io.rb +0 -0
  22. data/app_generators/{tbox → ruby}/templates/test_right_triangle.rb +0 -0
  23. data/bin/tbox +6 -3
  24. data/lib/languages.rb +22 -0
  25. data/lib/tbox.rb +1 -1
  26. data/lib/tbox_app_generator.rb +41 -0
  27. data/test/test_generator_helper.rb +37 -0
  28. data/test/test_java_generator.rb +37 -0
  29. data/test/test_languages.rb +32 -0
  30. data/test/test_ruby_generator.rb +32 -0
  31. metadata +31 -18
  32. data/app_generators/tbox/tbox_generator.rb +0 -84
  33. data/app_generators/tbox/templates/README +0 -45
  34. data/app_generators/tbox/templates/test_helper.rb +0 -9
  35. data/tbox.gemspec +0 -40
  36. data/test/test_tbox_generator.rb +0 -63
@@ -1,45 +0,0 @@
1
- = tbox - A test-driven learning sandbox creation tool
2
-
3
- * See http://www.bobbynorton.com/?p=36 for more on tbox and test-driven learning.
4
-
5
- == Description:
6
-
7
- tbox lowers the barrier to entry for test-driven learning by providing a basic infrastructure in which
8
- to start coding: A directory structure, some classes and unit tests to get started, and a Rakefile to run
9
- all tests. For now, tbox is geared toward Ruby, though the technique is applicable to any language that
10
- lends itself to TDD.
11
-
12
- == Learning Ruby by Testing:
13
-
14
- If you're completely new to Ruby, you should start with "Ruby in Twenty Minutes" -
15
- http://www.ruby-lang.org/en/documentation/quickstart/. This will help you get Ruby installed and will
16
- explain the basics of Ruby programming.
17
-
18
- If you already have Ruby and rake (http://rake.rubyforge.org/files/README.html) installed and you're
19
- ready to start, then fire up a command prompt and run the starter tests that ship with tbox:
20
-
21
- $ cd ~/ruby_projects
22
- $ tbox learning_ruby
23
- $ rake
24
-
25
- This uses the rake TestTask to run all the unit tests in your test folder. If everything goes as planned,
26
- running this command should produce something like:
27
-
28
- Loaded suite /Library/Ruby/Gems/1.8/gems/rake-0.8.4/lib/rake/rake_test_loader
29
- Started
30
- ...
31
- Finished in 0.000706 seconds.
32
-
33
- 3 tests, 4 assertions, 0 failures, 0 errors
34
-
35
- Open up the test cases in your favorite editor and have a look at what's going on. Change the tests. Add
36
- some new cases. Run them again every time you want to experiment with something new. Make sure you run
37
- all the tests in your suite before you check in at the end of your session.
38
-
39
- If you don't yet have a copy of Pickaxe, get one (http://www.pragprog.com/titles/ruby/programming-ruby).
40
- Add to your tbox repository as you read through the book to code up examples of what you're reading.
41
-
42
- == Credits:
43
-
44
- Bobby Norton, DRW Trading Group
45
- Dr. Nic Williams for newgem and rubigen: http://rubyconf2007.confreaks.com/d3t1p1_rubigen.html
@@ -1,9 +0,0 @@
1
- require 'stringio'
2
- require 'test/unit'
3
- require File.dirname(__FILE__) + '/../lib/tbox'
4
-
5
- module Constants
6
-
7
- TEST_DATA_DIR = File.join(File.expand_path(File.dirname(__FILE__)), "data")
8
-
9
- end
data/tbox.gemspec DELETED
@@ -1,40 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- Gem::Specification.new do |s|
4
- s.name = %q{tbox}
5
- s.version = "0.5.2"
6
-
7
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Bobby Norton"]
9
- s.date = %q{2009-06-18}
10
- s.default_executable = %q{tbox}
11
- s.description = %q{Provides a basic directory structure for test-driven learning.}
12
- s.email = ["codeculturist@gmail.com"]
13
- s.executables = ["tbox"]
14
- s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "app_generators/tbox/templates/file.txt"]
15
- s.files = ["History.txt", "MIT-LICENSE", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "app_generators/tbox/USAGE", "app_generators/tbox/tbox_generator.rb", "app_generators/tbox/templates/README", "app_generators/tbox/templates/file.txt", "app_generators/tbox/templates/rakefile.rb", "app_generators/tbox/templates/right_triangle.rb", "app_generators/tbox/templates/tbox.rb", "app_generators/tbox/templates/test_helper.rb", "app_generators/tbox/templates/test_io.rb", "app_generators/tbox/templates/test_right_triangle.rb", "bin/tbox", "lib/tbox.rb", "script/console", "script/destroy", "script/generate", "tbox.gemspec", "test/test_generator_helper.rb", "test/test_helper.rb", "test/test_tbox_generator.rb"]
16
- s.homepage = %q{http://github.com/bobbyno/tbox/tree/master}
17
- s.post_install_message = %q{PostInstall.txt}
18
- s.rdoc_options = ["--main", "README.rdoc"]
19
- s.require_paths = ["lib"]
20
- s.rubyforge_project = %q{tbox}
21
- s.rubygems_version = %q{1.3.4}
22
- s.summary = %q{Test-driven learning is a way to master a programming language by writing unit tests around its API's, tbox lowers the barrier to entry for test-driven learning by providing a basic infrastructure in which to start coding: A directory structure, some classes and unit tests to get started, and a Rakefile to run all tests.}
23
- s.test_files = ["test/test_generator_helper.rb", "test/test_helper.rb", "test/test_tbox_generator.rb"]
24
-
25
- if s.respond_to? :specification_version then
26
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
27
- s.specification_version = 3
28
-
29
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
30
- s.add_runtime_dependency(%q<newgem>, [">= 1.4.1"])
31
- s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
32
- else
33
- s.add_dependency(%q<newgem>, [">= 1.4.1"])
34
- s.add_dependency(%q<hoe>, [">= 1.8.0"])
35
- end
36
- else
37
- s.add_dependency(%q<newgem>, [">= 1.4.1"])
38
- s.add_dependency(%q<hoe>, [">= 1.8.0"])
39
- end
40
- end
@@ -1,63 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
2
- require 'fileutils'
3
-
4
- class TestTboxGenerator < Test::Unit::TestCase
5
- include RubiGen::GeneratorTestHelper
6
-
7
- def setup
8
- bare_setup
9
- end
10
-
11
- def teardown
12
- bare_teardown
13
- end
14
-
15
- # Some generator-related assertions:
16
- # assert_generated_file(name, &block) # block passed the file contents
17
- # assert_directory_exists(name)
18
- # assert_generated_class(name, &block)
19
- # assert_generated_module(name, &block)
20
- # assert_generated_test_for(name, &block)
21
- # The assert_generated_(class|module|test_for) &block is passed the body of the class/module within the file
22
- # assert_has_method(body, *methods) # check that the body has a list of methods (methods with parentheses not supported yet)
23
- #
24
- # Other helper methods are:
25
- # app_root_files - put this in teardown to show files generated by the test method (e.g. p app_root_files)
26
- # bare_setup - place this in setup method to create the APP_ROOT folder for each test
27
- # bare_teardown - place this in teardown method to destroy the TMP_ROOT or APP_ROOT folder after each test
28
-
29
- def test_generator_without_options
30
- run_generator('tbox', [APP_ROOT], sources)
31
-
32
- assert_generated_file "rakefile.rb"
33
- assert_generated_file "README"
34
- assert_generated_file "MIT-LICENSE"
35
- assert_directory_exists "lib/samples"
36
- assert_generated_file "lib/samples/right_triangle.rb"
37
- assert_generated_file "lib/tbox.rb"
38
- assert_directory_exists "test/samples"
39
- assert_generated_file "test/samples/test_right_triangle.rb"
40
- assert_directory_exists "test/data"
41
- assert_generated_file "test/data/file.txt"
42
- assert_generated_file "test/test_io.rb"
43
- assert_generated_file "test/test_helper.rb"
44
-
45
- FileUtils::cd(APP_ROOT) do
46
- puts "Running generated rakefile in #{FileUtils::pwd}"
47
- `rake`
48
- raise "Error occured while running generated rakefile" if ($?.to_s != "0")
49
- end
50
-
51
- p app_root_files
52
- end
53
-
54
- private
55
- def sources
56
- [RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
57
- ]
58
- end
59
-
60
- def generator_path
61
- "app_generators"
62
- end
63
- end