shubox 0.9

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 (58) hide show
  1. data/History.txt +57 -0
  2. data/MIT-LICENSE +22 -0
  3. data/Manifest.txt +57 -0
  4. data/PostInstall.txt +6 -0
  5. data/README.rdoc +128 -0
  6. data/Rakefile +61 -0
  7. data/app_generators/clojure/USAGE +15 -0
  8. data/app_generators/clojure/clojure_generator.rb +46 -0
  9. data/app_generators/clojure/templates/README.rdoc +29 -0
  10. data/app_generators/clojure/templates/bin/repl.sh +3 -0
  11. data/app_generators/clojure/templates/bin/runtests.sh +3 -0
  12. data/app_generators/clojure/templates/lib/clojure-contrib.jar +0 -0
  13. data/app_generators/clojure/templates/lib/clojure.jar +0 -0
  14. data/app_generators/clojure/templates/lib/jline-0.9.94.jar +0 -0
  15. data/app_generators/clojure/templates/project.iml +19 -0
  16. data/app_generators/clojure/templates/project.ipr +261 -0
  17. data/app_generators/clojure/templates/src/repl.clj +3 -0
  18. data/app_generators/clojure/templates/test/core/about_clojure_testing.clj +21 -0
  19. data/app_generators/clojure/templates/test/core/about_forms.clj +22 -0
  20. data/app_generators/clojure/templates/test/tests.clj +11 -0
  21. data/app_generators/java/USAGE +14 -0
  22. data/app_generators/java/java_generator.rb +39 -0
  23. data/app_generators/java/templates/Greeting.java +24 -0
  24. data/app_generators/java/templates/GreetingTest.java +18 -0
  25. data/app_generators/java/templates/build.xml +55 -0
  26. data/app_generators/java/templates/lib/hamcrest-core.jar +0 -0
  27. data/app_generators/java/templates/lib/junit.jar +0 -0
  28. data/app_generators/java/templates/project.iml +22 -0
  29. data/app_generators/java/templates/project.ipr +259 -0
  30. data/app_generators/ruby/USAGE +12 -0
  31. data/app_generators/ruby/ruby_generator.rb +37 -0
  32. data/app_generators/ruby/templates/file.txt +3 -0
  33. data/app_generators/ruby/templates/rakefile.rb +9 -0
  34. data/app_generators/ruby/templates/right_triangle.rb +18 -0
  35. data/app_generators/ruby/templates/shubox.rb +6 -0
  36. data/app_generators/ruby/templates/test_helper.rb +9 -0
  37. data/app_generators/ruby/templates/test_io.rb +15 -0
  38. data/app_generators/ruby/templates/test_right_triangle.rb +21 -0
  39. data/bin/shubox +24 -0
  40. data/cleaner_generators/test_unit_cleaner/USAGE +7 -0
  41. data/cleaner_generators/test_unit_cleaner/lib/test_unit_cleaner.rb +93 -0
  42. data/cleaner_generators/test_unit_cleaner/templates/clean_test_unit +12 -0
  43. data/cleaner_generators/test_unit_cleaner/templates/filter_test_unit +13 -0
  44. data/cleaner_generators/test_unit_cleaner/test_unit_cleaner_generator.rb +27 -0
  45. data/lib/languages.rb +20 -0
  46. data/lib/shubox.rb +11 -0
  47. data/lib/shubox_app_generator.rb +40 -0
  48. data/script/console +10 -0
  49. data/script/destroy +14 -0
  50. data/script/generate +14 -0
  51. data/test/cleaners/test_test_unit_cleaner.rb +111 -0
  52. data/test/generators/test_clojure_generator.rb +44 -0
  53. data/test/generators/test_java_generator.rb +37 -0
  54. data/test/generators/test_ruby_generator.rb +34 -0
  55. data/test/lib/test_languages.rb +38 -0
  56. data/test/test_generator_helper.rb +72 -0
  57. data/test/test_helper.rb +4 -0
  58. metadata +144 -0
@@ -0,0 +1,57 @@
1
+ == 0.9 2009-10-22
2
+
3
+ * 1 major enhancement:
4
+ * added clojure environment based on Stu Halloway's clojure_bowling
5
+
6
+ == 0.8.2 2009-09-26
7
+
8
+ * 1 minor enhancements:
9
+ * test_unit_cleaner now also cleans ruby_koans.
10
+
11
+ == 0.8.1 2009-09-26
12
+
13
+ * 2 minor enhancements:
14
+ * script/filter_test_unit can be called from within a test file in TextMate
15
+ using "Text -> Filter Through Command" and Document as Input; alternately
16
+ create a TextMate command with the contents of the script.
17
+ * Comments and whitespace are now mostly preserved in test cases; comments
18
+ appear after the test case in which they appear.
19
+
20
+ == 0.8 2009-09-22
21
+
22
+ * 1 major enhancement:
23
+ * clean script now included in generated shubox to reset tests in ruby.
24
+ * Thanks to bendyworks for the original concept in his patch.
25
+ * cleaners organized as generators to simplify new cleaner creation.
26
+ * cleaners can operate on directories or individual files.
27
+
28
+
29
+ == 0.7 2009-08-26
30
+
31
+ * Project rename:
32
+ * tbox -> shubox: Shubox helps you move more quickly from Shu to Ha and Ri.
33
+ * Thanks to Alistair Cockburn @ Agile 2009 for this one.
34
+
35
+
36
+ == 0.6 2009-06-24
37
+
38
+ * 1 major enhancement:
39
+ * Added ability to generate Java sandboxes with Ant, JUnit, and IntelliJ support.
40
+
41
+
42
+ == 0.5.2 2009-06-18
43
+
44
+ * 1 minor enhancement:
45
+ * Changed newgem from dev to runtime dependency.
46
+
47
+
48
+ == 0.5.1 2009-06-15
49
+
50
+ * 1 minor enhancement:
51
+ * Refactoring gemspec to work with github.
52
+
53
+
54
+ == 0.5.0 2009-06-15
55
+
56
+ * 1 major enhancement:
57
+ * Refactored to use newgem / rubigen file generation.
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2009 Bobby Norton
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,57 @@
1
+ History.txt
2
+ MIT-LICENSE
3
+ Manifest.txt
4
+ PostInstall.txt
5
+ README.rdoc
6
+ Rakefile
7
+ app_generators/clojure/USAGE
8
+ app_generators/clojure/clojure_generator.rb
9
+ app_generators/clojure/templates/README.rdoc
10
+ app_generators/clojure/templates/bin/repl.sh
11
+ app_generators/clojure/templates/bin/runtests.sh
12
+ app_generators/clojure/templates/lib/clojure-contrib.jar
13
+ app_generators/clojure/templates/lib/clojure.jar
14
+ app_generators/clojure/templates/lib/jline-0.9.94.jar
15
+ app_generators/clojure/templates/project.iml
16
+ app_generators/clojure/templates/project.ipr
17
+ app_generators/clojure/templates/src/repl.clj
18
+ app_generators/clojure/templates/test/core/about_clojure_testing.clj
19
+ app_generators/clojure/templates/test/core/about_forms.clj
20
+ app_generators/clojure/templates/test/tests.clj
21
+ app_generators/java/USAGE
22
+ app_generators/java/java_generator.rb
23
+ app_generators/java/templates/Greeting.java
24
+ app_generators/java/templates/GreetingTest.java
25
+ app_generators/java/templates/build.xml
26
+ app_generators/java/templates/lib/hamcrest-core.jar
27
+ app_generators/java/templates/lib/junit.jar
28
+ app_generators/java/templates/project.iml
29
+ app_generators/java/templates/project.ipr
30
+ app_generators/ruby/USAGE
31
+ app_generators/ruby/ruby_generator.rb
32
+ app_generators/ruby/templates/file.txt
33
+ app_generators/ruby/templates/rakefile.rb
34
+ app_generators/ruby/templates/right_triangle.rb
35
+ app_generators/ruby/templates/shubox.rb
36
+ app_generators/ruby/templates/test_helper.rb
37
+ app_generators/ruby/templates/test_io.rb
38
+ app_generators/ruby/templates/test_right_triangle.rb
39
+ bin/shubox
40
+ cleaner_generators/test_unit_cleaner/USAGE
41
+ cleaner_generators/test_unit_cleaner/lib/test_unit_cleaner.rb
42
+ cleaner_generators/test_unit_cleaner/templates/clean_test_unit
43
+ cleaner_generators/test_unit_cleaner/templates/filter_test_unit
44
+ cleaner_generators/test_unit_cleaner/test_unit_cleaner_generator.rb
45
+ lib/languages.rb
46
+ lib/shubox.rb
47
+ lib/shubox_app_generator.rb
48
+ script/console
49
+ script/destroy
50
+ script/generate
51
+ test/cleaners/test_test_unit_cleaner.rb
52
+ test/generators/test_clojure_generator.rb
53
+ test/generators/test_java_generator.rb
54
+ test/generators/test_ruby_generator.rb
55
+ test/lib/test_languages.rb
56
+ test/test_generator_helper.rb
57
+ test/test_helper.rb
@@ -0,0 +1,6 @@
1
+
2
+ For more information on shubox, see http://github.com/bobbyno/shubox/tree/master
3
+
4
+
5
+
6
+
@@ -0,0 +1,128 @@
1
+ = shubox - A framework to create sandboxes for test-driven learning
2
+
3
+ http://github.com/bobbyno/shubox/tree/master
4
+
5
+ More on Test-Driven Learning: http://www.bobbynorton.com/?p=36
6
+
7
+ == DESCRIPTION
8
+
9
+ shubox lowers the barrier to entry for test-driven learning by providing a basic infrastructure in which
10
+ to start coding: A directory structure, some classes and unit tests to get started, and a build script.
11
+
12
+ == TEST-DRIVEN LEARNING
13
+
14
+ Test-driven learning is a way to master a programming language by writing unit tests around its API's.
15
+ After installing shubox and generating a testing environment, you'll start off with some passing tests that exercise
16
+ parts of the language's API. Write new learning tests, naming each method with the intent of the lesson, then write
17
+ the code that makes a test pass.
18
+
19
+ Can you complete the lesson again from memory? If not, you may need to study the concept more closely
20
+ and implement the tests again. According to {a paper by Karpicke and Roediger}[http://psych.wustl.edu/memory/Roddy%20article%20PDF's/Karpicke_Roediger_2008_Science.pdf],
21
+ "repeated retrieval practice led to greater than 150% improvements in long-term retention than studying alone.
22
+ ...Although educators and psychologists often consider testing a neutral process that merely assesses the
23
+ contents of memory, practicing retrieval during tests clearly produces more learning than additional
24
+ encoding or study once an item has been recalled."
25
+
26
+ shubox makes repeated testing easy by providing built-in test cleaners that delete your test implementations,
27
+ while keeping comments and test names to express the intent of the test. shubox currently creates environments
28
+ for Ruby and Java, but can easily be extended to any language that lends itself to unit testing. shubox is built
29
+ on newgem, so extending the framework is as simple as creating new generator scripts.
30
+
31
+ == INSTALL
32
+
33
+ The <code>shubox</code> application is distributed as a RubyGem and is available immediately after installation.
34
+
35
+ <code>$ gem sources -a http:http://gems.github.com</code>
36
+
37
+ <code>$ sudo gem install bobbyno-shubox</code>
38
+
39
+ Alternately, download the gem and install manually from github.
40
+
41
+ == RUBY USAGE
42
+
43
+ Ruby is the default language option in shubox:
44
+
45
+ <code>$ shubox /tmp/learn_ruby</code>
46
+
47
+ <code>$ cd /tmp/learn_ruby</code>
48
+
49
+ <code>$ rake</code>
50
+
51
+ To clean all tests in your project:
52
+
53
+ <code>$ script/clean_test_unit .</code>
54
+
55
+ If you're using TextMate, you can quickly reset a test file from within the editor using
56
+ "Text -> Filter Through Command". Select "/tmp/learn_ruby/script/filter_test_unit"
57
+ as the command, select "Document" as input, and select "Replace Document" as output. Alternately,
58
+ save the contents of the filter script to a custom TextMate command to easily run it with a
59
+ keyboard shortcut.
60
+
61
+ == JAVA USAGE
62
+
63
+ shubox supports Java:
64
+
65
+ <code>$ shubox -l=java /tmp/LearnJava</code>
66
+
67
+ <code>$ cd /tmp/LearnJava</code>
68
+
69
+ <code>$ ant -f build/build.xml</code>
70
+
71
+ The Java command will also generate a <project name>.ipr file to allow the project to easily be
72
+ opened in IntelliJ 8.
73
+
74
+ shubox does not currently include a JUnit cleaner script. Patches welcome. ;-)
75
+
76
+ == CLOJURE USAGE
77
+
78
+ shubox also supports Clojure:
79
+
80
+ <code>$ shubox -l=clojure /tmp/learn_clojure</code>
81
+
82
+ <code>$ cd /tmp/learn_clojure</code>
83
+
84
+ <code>$ bin/runtests.sh</code>
85
+
86
+ The Clojure command will also generate a <project name>.ipr file to allow the project to easily be
87
+ opened in IntelliJ 8.
88
+
89
+ shubox does not currently include a clojure test cleaner script. Patches welcome. ;-)
90
+
91
+ == APPLICATION ARCHITECTURE
92
+
93
+ shubox is organized as a set of generators, as in newgem and RubiGen.
94
+
95
+ app_generators are where we define the basic environment for one of our supported languages.
96
+
97
+ cleaner_generators hold the test framework cleaning implementations to reset tests.
98
+ In the future, these can be mixed and matched to support polyglots like JRuby by installing both
99
+ JUnit and Test::Unit cleaners. Run script/generate in a generated shubox to see the list of
100
+ available cleaners and generators that can be installed.
101
+
102
+ cleaner/lib folders hold the implementations of the cleaners referenced in the clean_xxx files
103
+ copied to the generated application. This makes it easy to upgrade existing shuboxes.
104
+
105
+ == REQUIREMENTS
106
+
107
+ * newgem
108
+
109
+ == CONTRIBUTORS
110
+
111
+ Initial concept - Bobby Norton
112
+
113
+ bendyworks for {Test::Unit cleaner patch}[http://github.com/bendyworks/shubox]
114
+
115
+ == THANKS!
116
+
117
+ {DRW Trading Group}[http://www.drwtrading.com] for time and feedback
118
+
119
+ Test-Driven Learning Attendees at {SCNA 2009}[http://scna.softwarecraftsmanship.org/schedule#bobby_norton]
120
+
121
+ Dr. Nic Williams for newgem and rubigen: {RubyConf 2007 Presentation}[http://rubyconf2007.confreaks.com/d3t1p1_rubigen.html]
122
+
123
+ Jim Weirich and EdgeCase for {ruby_koans}[http://github.com/edgecase/ruby_koans]
124
+
125
+ Stu Halloway for the clojure project structure in {clojure_bowling}[http://github.com/stuarthalloway/clojure-bowling/]
126
+
127
+
128
+
@@ -0,0 +1,61 @@
1
+ require 'rubygems'
2
+ gem 'hoe', '>= 2.1.0'
3
+ require 'hoe'
4
+ require 'fileutils'
5
+ require './lib/shubox'
6
+
7
+ Hoe.plugin :newgem
8
+
9
+ # require 'rubygems' unless ENV['NO_RUBYGEMS']
10
+ # %w[rake rake/clean fileutils newgem rubigen].each { |f| require f }
11
+ # require File.dirname(__FILE__) + '/lib/shubox'
12
+
13
+ # Generate all the Rake tasks
14
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
15
+ $hoe = Hoe.spec 'shubox' do |p|
16
+ p.developer('Bobby Norton', 'codeculturist@gmail.com')
17
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
18
+ p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
19
+ p.rubyforge_name = p.name # TODO this is default value
20
+ p.extra_deps = [['newgem', "= #{::Newgem::VERSION}"]]
21
+ p.clean_globs |= %w[**/.DS_Store tmp *.log]
22
+ path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
23
+ p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
24
+ p.rsync_args = '-av --delete --ignore-errors'
25
+ p.readme_file = 'README.rdoc'
26
+ p.extra_rdoc_files = ['README.rdoc']
27
+ end
28
+
29
+ require 'newgem/tasks' # load /tasks/*.rake
30
+ Dir['tasks/**/*.rake'].each { |t| load t }
31
+
32
+ # TODO - want other tests/tasks run by default? Add them to the list
33
+ # task :default => [:spec, :features]
34
+
35
+ desc "Create the gem and install it"
36
+ task :dev => [:clean, :manifest, :clean_manifest, :gemspec, :package, :install_gem, :uat]
37
+
38
+ desc "Strip out the entries in the .git folder for ppl who haven't updated .hoerc"
39
+ task :clean_manifest do
40
+ manifest = IO.readlines("Manifest.txt")
41
+ clean = manifest.reject {|item| item =~ /.git/ }
42
+ File.open("Manifest.txt", mode_string="w" ) {|file| file.puts(clean)}
43
+ end
44
+
45
+ task :clean do
46
+ rm_f("shubox.gemspec")
47
+ rm_rf("pkg")
48
+ end
49
+
50
+ task :uninstall do
51
+ rm_rf("/tmp/clojure_test")
52
+ rm_rf("/tmp/JavaTest")
53
+ rm_rf("/tmp/ruby_test")
54
+ sh "sudo gem uninstall shubox"
55
+ end
56
+
57
+ task :uat do
58
+ sh "shubox -l=clojure /tmp/clojure_test"
59
+ sh "shubox -l=java /tmp/JavaTest"
60
+ sh "shubox /tmp/ruby_test"
61
+ end
@@ -0,0 +1,15 @@
1
+ Description:
2
+
3
+ shubox lowers the barrier to entry for test-driven learning by providing a basic infrastructure in which
4
+ to start coding: A directory structure, some classes and unit tests to get started, and a build script
5
+ to run all tests.
6
+
7
+ Usage:
8
+
9
+ $ shubox -l=clojure /tmp/learn_clojure
10
+ $ cd /tmp/learn_clojure
11
+ $ bin/runtests.sh
12
+
13
+ If you have IntelliJ, install the La Clojure plugin, then open the IPR file to get started with adding
14
+ your learning tests. If you have a different IDE, follow the instructions to import your application as
15
+ existing source.
@@ -0,0 +1,46 @@
1
+ require 'shubox_app_generator'
2
+
3
+ class ClojureGenerator < ShuboxAppGenerator
4
+
5
+ def manifest
6
+ script_options = { :chmod => 0755 }
7
+
8
+ record do |m|
9
+ # Ensure appropriate folder(s) exists
10
+ m.directory ''
11
+ BASEDIRS.each { |path| m.directory path }
12
+
13
+ # root
14
+ m.template("project.ipr", "#{@name}.ipr")
15
+ m.file("project.iml", "#{@name}.iml")
16
+ m.template("README.rdoc", "README.rdoc")
17
+
18
+ # bin
19
+ m.directory "bin"
20
+ m.file_copy_each %w(repl.sh runtests.sh), "bin", script_options
21
+
22
+ # lib
23
+ m.directory "lib"
24
+ m.file_copy_each %w(clojure-contrib.jar clojure.jar jline-0.9.94.jar), "lib"
25
+
26
+ # src
27
+ m.directory "src"
28
+ m.file("src/repl.clj", "src/repl.clj")
29
+
30
+ # test
31
+ m.directory "test/core"
32
+ m.file("test/core/about_clojure_testing.clj", "test/core/about_clojure_testing.clj")
33
+ m.file("test/core/about_forms.clj", "test/core/about_forms.clj")
34
+ m.file("test/tests.clj", "test/tests.clj")
35
+ end
36
+ end
37
+
38
+ protected
39
+ # Installation skeleton.
40
+ BASEDIRS = %w(
41
+ build
42
+ lib
43
+ src
44
+ test
45
+ )
46
+ end
@@ -0,0 +1,29 @@
1
+ = Clojure Shubox
2
+
3
+ Generated from http://www.github.com/bobbyno/shubox
4
+
5
+ == Running via command line
6
+
7
+ REPL: <code>bin/repl.sh</code>
8
+
9
+ Tests: <code>bin/runtests.sh</code>
10
+
11
+ == Running in IntelliJ
12
+
13
+ * Install the La Clojure plugin
14
+ * Create a run configuration for tests.clj
15
+ * Check "Run script in REPL" and uncheck "Display settings before launching"
16
+ * Run tests.clj - output displays in the run tab
17
+ * Enter <code>(. System exit 0)</code> or hit the stop button if the REPL doesn't exit.
18
+
19
+ == Credits
20
+
21
+ Project structure based on Stuart Halloway's clojure-bowling: http://github.com/stuarthalloway/clojure-bowling/
22
+
23
+ Note that this requires a post-1.0 version of Clojure and contrib to use the new 'are' syntax.
24
+
25
+ Required JARs are in lib, and there are scripts to run a REPL or the tests in bin.
26
+
27
+ == Author
28
+
29
+ Bobby Norton
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+
3
+ java -cp src:test:lib/jline-0.9.94.jar:lib/clojure.jar:lib/clojure-contrib.jar jline.ConsoleRunner clojure.main -i src/repl.clj -r
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+
3
+ java -Xmx1G -cp test:src:lib/clojure.jar:lib/clojure-contrib.jar:lib/hsqldb.jar:lib/ant.jar:lib/ant-launcher.jar clojure.lang.Script test/tests.clj