bobbyno-shubox 0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/History.txt +29 -0
  2. data/MIT-LICENSE +22 -0
  3. data/Manifest.txt +37 -0
  4. data/PostInstall.txt +6 -0
  5. data/README.rdoc +61 -0
  6. data/Rakefile +47 -0
  7. data/app_generators/java/USAGE +14 -0
  8. data/app_generators/java/java_generator.rb +39 -0
  9. data/app_generators/java/templates/Greeting.java +24 -0
  10. data/app_generators/java/templates/GreetingTest.java +18 -0
  11. data/app_generators/java/templates/build.xml +55 -0
  12. data/app_generators/java/templates/lib/hamcrest-core.jar +0 -0
  13. data/app_generators/java/templates/lib/junit.jar +0 -0
  14. data/app_generators/java/templates/project.iml +22 -0
  15. data/app_generators/java/templates/project.ipr +259 -0
  16. data/app_generators/ruby/USAGE +11 -0
  17. data/app_generators/ruby/ruby_generator.rb +34 -0
  18. data/app_generators/ruby/templates/file.txt +3 -0
  19. data/app_generators/ruby/templates/rakefile.rb +9 -0
  20. data/app_generators/ruby/templates/right_triangle.rb +18 -0
  21. data/app_generators/ruby/templates/shubox.rb +6 -0
  22. data/app_generators/ruby/templates/test_helper.rb +9 -0
  23. data/app_generators/ruby/templates/test_io.rb +15 -0
  24. data/app_generators/ruby/templates/test_right_triangle.rb +21 -0
  25. data/bin/shubox +20 -0
  26. data/lib/languages.rb +22 -0
  27. data/lib/shubox.rb +6 -0
  28. data/lib/shubox_app_generator.rb +41 -0
  29. data/script/console +10 -0
  30. data/script/destroy +14 -0
  31. data/script/generate +14 -0
  32. data/test/test_generator_helper.rb +66 -0
  33. data/test/test_helper.rb +4 -0
  34. data/test/test_java_generator.rb +37 -0
  35. data/test/test_languages.rb +32 -0
  36. data/test/test_ruby_generator.rb +32 -0
  37. metadata +118 -0
@@ -0,0 +1,29 @@
1
+ == 0.7 2009-08-26
2
+
3
+ * Project rename:
4
+ * tbox -> shubox: Shubox helps you move more quickly from Shu to Ha and Ri.
5
+ * Thanks to Alistair Cockburn @ Agile 2009 for this one.
6
+
7
+
8
+ == 0.6 2009-06-24
9
+
10
+ * 1 major enhancement:
11
+ * Added ability to generate Java sandboxes with Ant, JUnit, and IntelliJ support.
12
+
13
+
14
+ == 0.5.2 2009-06-18
15
+
16
+ * 1 minor enhancement:
17
+ * Changed newgem from dev to runtime dependency.
18
+
19
+
20
+ == 0.5.1 2009-06-15
21
+
22
+ * 1 minor enhancement:
23
+ * Refactoring gemspec to work with github.
24
+
25
+
26
+ == 0.5.0 2009-06-15
27
+
28
+ * 1 major enhancement:
29
+ * 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,37 @@
1
+ History.txt
2
+ MIT-LICENSE
3
+ Manifest.txt
4
+ PostInstall.txt
5
+ README.rdoc
6
+ Rakefile
7
+ app_generators/java/USAGE
8
+ app_generators/java/java_generator.rb
9
+ app_generators/java/templates/Greeting.java
10
+ app_generators/java/templates/GreetingTest.java
11
+ app_generators/java/templates/build.xml
12
+ app_generators/java/templates/lib/hamcrest-core.jar
13
+ app_generators/java/templates/lib/junit.jar
14
+ app_generators/java/templates/project.iml
15
+ app_generators/java/templates/project.ipr
16
+ app_generators/ruby/USAGE
17
+ app_generators/ruby/ruby_generator.rb
18
+ app_generators/ruby/templates/file.txt
19
+ app_generators/ruby/templates/rakefile.rb
20
+ app_generators/ruby/templates/right_triangle.rb
21
+ app_generators/ruby/templates/shubox.rb
22
+ app_generators/ruby/templates/test_helper.rb
23
+ app_generators/ruby/templates/test_io.rb
24
+ app_generators/ruby/templates/test_right_triangle.rb
25
+ bin/shubox
26
+ lib/languages.rb
27
+ lib/shubox.rb
28
+ lib/shubox_app_generator.rb
29
+ script/console
30
+ script/destroy
31
+ script/generate
32
+ tbox.gemspec
33
+ test/test_generator_helper.rb
34
+ test/test_helper.rb
35
+ test/test_java_generator.rb
36
+ test/test_languages.rb
37
+ test/test_ruby_generator.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,61 @@
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
+ Test-driven learning is a way to master a programming language by writing unit tests around its API's.
10
+ shubox lowers the barrier to entry for test-driven learning by providing a basic infrastructure in which
11
+ to start coding: A directory structure, some classes and unit tests to get started, and a build script.
12
+
13
+ == INSTALL:
14
+
15
+ The <code>shubox</code> application is distributed as a RubyGem and is available immediately after installation.
16
+
17
+ <code>$ gem sources -a http:http://gems.github.com</code>
18
+
19
+ <code>$ sudo gem install bobbyno-shubox</code>
20
+
21
+ Alternately, download the gem and install manually from github.
22
+
23
+ == BASIC USAGE:
24
+
25
+ Go to the folder where you want to create your new test sandbox, and run the <code>shubox</code> command
26
+ to generate your test scaffolding.
27
+
28
+ The default is Ruby:
29
+
30
+ <code>$ cd ~/ruby_projects</code>
31
+
32
+ <code>$ shubox learning_ruby</code>
33
+
34
+ <code>$ rake</code>
35
+
36
+ shubox also supports Java:
37
+
38
+ <code>$ cd ~/java_projects</code>
39
+
40
+ <code>$ shubox -j LearnJava</code>
41
+
42
+ <code>$ ant -f build/build.xml</code>
43
+
44
+ The Java command will also generate a <project name>.ipr file to allow the project to easily be
45
+ opened in IntelliJ 8.
46
+
47
+ == SYNOPSIS:
48
+
49
+ shubox currently creates environments for Ruby and Java, but can easily be extended to any language that
50
+ lends itself to unit testing. shubox is built on newgem, so extending the framework is as simple as creating
51
+ new generator scripts.
52
+
53
+ == REQUIREMENTS:
54
+
55
+ * newgem
56
+
57
+ == CREDITS:
58
+
59
+ Bobby Norton, DRW Trading Group
60
+
61
+ Dr. Nic Williams for newgem and rubigen: {RubyConf 2007 Presentation}[http://rubyconf2007.confreaks.com/d3t1p1_rubigen.html]
@@ -0,0 +1,47 @@
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 = [
21
+ ['newgem', ">= #{::Newgem::VERSION}"]
22
+ ]
23
+ p.clean_globs |= %w[**/.DS_Store tmp *.log]
24
+ path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
25
+ p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
26
+ p.rsync_args = '-av --delete --ignore-errors'
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]
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
+ end
@@ -0,0 +1,14 @@
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
+ $ cd ~/your_projects
10
+ $ shubox --java LearnJava
11
+ $ ant -f build/build.xml
12
+
13
+ If you have IntelliJ, open the IPR file to get started with adding your learning tests. If you have
14
+ a different IDE, follow the instructions to import your application as existing source.
@@ -0,0 +1,39 @@
1
+ require 'shubox_app_generator'
2
+
3
+ class JavaGenerator < ShuboxAppGenerator
4
+
5
+ def manifest
6
+ record do |m|
7
+ # Ensure appropriate folder(s) exists
8
+ m.directory ''
9
+ BASEDIRS.each { |path| m.directory path }
10
+
11
+ # root
12
+ m.template("project.ipr", "#{@name}.ipr")
13
+ m.file("project.iml", "#{@name}.iml")
14
+
15
+ # build
16
+ m.template("build.xml", "build/build.xml")
17
+
18
+ # lib
19
+ m.file_copy_each %w(hamcrest-core.jar junit.jar), "lib"
20
+
21
+ # src
22
+ m.directory "src/com/samples"
23
+ m.file("Greeting.java", "src/com/samples/Greeting.java")
24
+
25
+ # test
26
+ m.directory "test/com/samples"
27
+ m.file("GreetingTest.java", "test/com/samples/GreetingTest.java")
28
+ end
29
+ end
30
+
31
+ protected
32
+ # Installation skeleton.
33
+ BASEDIRS = %w(
34
+ build
35
+ lib
36
+ src
37
+ test
38
+ )
39
+ end
@@ -0,0 +1,24 @@
1
+ package com.samples;
2
+
3
+ /**
4
+ * Understands how to greet in several languages
5
+ */
6
+ public class Greeting {
7
+ private final String subject;
8
+
9
+ public Greeting(String subject) {
10
+ this.subject = ", " + subject + "!";
11
+ }
12
+
13
+ public String english() {
14
+ return "Hello" + subject;
15
+ }
16
+
17
+ public String espanol() {
18
+ return "Hola" + subject;
19
+ }
20
+
21
+ public String farsi() {
22
+ return "Salam" + subject;
23
+ }
24
+ }
@@ -0,0 +1,18 @@
1
+ package com.samples;
2
+
3
+ import org.junit.Test;
4
+ import static org.junit.Assert.assertThat;
5
+ import static org.hamcrest.CoreMatchers.is;
6
+
7
+ /**
8
+ * Tests our toy class; ensures we have everything wired together.
9
+ */
10
+ public class GreetingTest {
11
+
12
+ @Test
13
+ public void shouldSayHi() {
14
+ assertThat(new Greeting("World").english(), is("Hello, World!"));
15
+ assertThat(new Greeting("Donia").farsi(), is("Salam, Donia!"));
16
+ assertThat(new Greeting("Miami").espanol(), is("Hola, Miami!"));
17
+ }
18
+ }
@@ -0,0 +1,55 @@
1
+ <?xml version="1.0" ?>
2
+ <project default="all" basedir=".." name="<%= name %>">
3
+
4
+ <property name="message" value="Building the project...."/>
5
+ <property name="src" location="src"/>
6
+ <property name="test" location="test"/>
7
+ <property name="out" location="out"/>
8
+ <property name="dist" location="dist"/>
9
+ <property name="lib" location="lib"/>
10
+ <property name="results" location="dist/results"/>
11
+
12
+ <path id="test.lib">
13
+ <pathelement location="${lib}/junit.jar"/>
14
+ <pathelement location="${lib}/hamcrest-core.jar"/>
15
+ <pathelement location="${out}" />
16
+ </path>
17
+
18
+ <target name="all" depends="clean, init, compile, test, compress" description="Run all targets" />
19
+
20
+ <target name="clean" description="Remove working directories">
21
+ <delete dir="${dist}"/>
22
+ <delete dir="${out}"/>
23
+ </target>
24
+
25
+ <target name="init">
26
+ <mkdir dir="${out}"/>
27
+ <mkdir dir="${dist}"/>
28
+ <mkdir dir="${results}"/>
29
+ </target>
30
+
31
+ <target name="compile">
32
+ <javac srcdir="${src}" destdir="${out}"/>
33
+ <javac srcdir="${test}" destdir="${out}">
34
+ <classpath refid="test.lib" />
35
+ </javac>
36
+ </target>
37
+
38
+ <target name="test" depends="compile">
39
+ <junit printsummary="yes" haltonfailure="yes">
40
+ <formatter type="brief" usefile="false"/>
41
+ <classpath refid="test.lib"/>
42
+ <batchtest>
43
+ <fileset dir="${out}" includes="**/*Test.class"/>
44
+ </batchtest>
45
+ </junit>
46
+ </target>
47
+
48
+ <target name="compress">
49
+ <jar destfile="${dist}/${ant.project.name}.jar" basedir="${out}">
50
+ <include name="**/*.class"/>
51
+ <exclude name="**/*Test.class"/>
52
+ </jar>
53
+ </target>
54
+
55
+ </project>
@@ -0,0 +1,22 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module relativePaths="true" type="JAVA_MODULE" version="4">
3
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
4
+ <exclude-output />
5
+ <content url="file://$MODULE_DIR$">
6
+ <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
7
+ <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
8
+ </content>
9
+ <orderEntry type="inheritedJdk" />
10
+ <orderEntry type="sourceFolder" forTests="false" />
11
+ <orderEntry type="module-library">
12
+ <library>
13
+ <CLASSES>
14
+ <root url="jar://$APPLICATION_HOME_DIR$/lib/junit-4.5.jar!/" />
15
+ </CLASSES>
16
+ <JAVADOC />
17
+ <SOURCES />
18
+ </library>
19
+ </orderEntry>
20
+ </component>
21
+ </module>
22
+
@@ -0,0 +1,259 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project relativePaths="false" version="4">
3
+ <component name="AntConfiguration">
4
+ <defaultAnt bundledAnt="true" />
5
+ <buildFile url="file://$PROJECT_DIR$/build/build.xml">
6
+ <additionalClassPath />
7
+ <antReference projectDefault="true" />
8
+ <customJdkName value="" />
9
+ <maximumHeapSize value="128" />
10
+ <maximumStackSize value="32" />
11
+ <properties />
12
+ </buildFile>
13
+ </component>
14
+ <component name="BuildJarProjectSettings">
15
+ <option name="BUILD_JARS_ON_MAKE" value="false" />
16
+ </component>
17
+ <component name="CodeStyleSettingsManager">
18
+ <option name="PER_PROJECT_SETTINGS" />
19
+ <option name="USE_PER_PROJECT_SETTINGS" value="false" />
20
+ </component>
21
+ <component name="CompilerConfiguration">
22
+ <option name="DEFAULT_COMPILER" value="Javac" />
23
+ <option name="DEPLOY_AFTER_MAKE" value="0" />
24
+ <resourceExtensions>
25
+ <entry name=".+\.(properties|xml|html|dtd|tld)" />
26
+ <entry name=".+\.(gif|png|jpeg|jpg)" />
27
+ </resourceExtensions>
28
+ <wildcardResourcePatterns>
29
+ <entry name="?*.properties" />
30
+ <entry name="?*.xml" />
31
+ <entry name="?*.gif" />
32
+ <entry name="?*.png" />
33
+ <entry name="?*.jpeg" />
34
+ <entry name="?*.jpg" />
35
+ <entry name="?*.html" />
36
+ <entry name="?*.dtd" />
37
+ <entry name="?*.tld" />
38
+ <entry name="?*.ftl" />
39
+ </wildcardResourcePatterns>
40
+ </component>
41
+ <component name="CopyrightManager" default="">
42
+ <module2copyright />
43
+ </component>
44
+ <component name="DependencyValidationManager">
45
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
46
+ </component>
47
+ <component name="EclipseCompilerSettings">
48
+ <option name="DEBUGGING_INFO" value="true" />
49
+ <option name="GENERATE_NO_WARNINGS" value="true" />
50
+ <option name="DEPRECATION" value="false" />
51
+ <option name="ADDITIONAL_OPTIONS_STRING" value="" />
52
+ <option name="MAXIMUM_HEAP_SIZE" value="128" />
53
+ </component>
54
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
55
+ <component name="IdProvider" IDEtalkID="CD12B10C71E44033B2F52F90C08DEF9E" />
56
+ <component name="InspectionProjectProfileManager">
57
+ <option name="PROJECT_PROFILE" value="Project Default" />
58
+ <option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
59
+ <scopes />
60
+ <profiles>
61
+ <profile version="1.0" is_locked="false">
62
+ <option name="myName" value="Project Default" />
63
+ <option name="myLocal" value="false" />
64
+ </profile>
65
+ </profiles>
66
+ <list size="0" />
67
+ </component>
68
+ <component name="JavacSettings">
69
+ <option name="DEBUGGING_INFO" value="true" />
70
+ <option name="GENERATE_NO_WARNINGS" value="false" />
71
+ <option name="DEPRECATION" value="true" />
72
+ <option name="ADDITIONAL_OPTIONS_STRING" value="" />
73
+ <option name="MAXIMUM_HEAP_SIZE" value="128" />
74
+ </component>
75
+ <component name="JavadocGenerationManager">
76
+ <option name="OUTPUT_DIRECTORY" />
77
+ <option name="OPTION_SCOPE" value="protected" />
78
+ <option name="OPTION_HIERARCHY" value="true" />
79
+ <option name="OPTION_NAVIGATOR" value="true" />
80
+ <option name="OPTION_INDEX" value="true" />
81
+ <option name="OPTION_SEPARATE_INDEX" value="true" />
82
+ <option name="OPTION_DOCUMENT_TAG_USE" value="false" />
83
+ <option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
84
+ <option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
85
+ <option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
86
+ <option name="OPTION_DEPRECATED_LIST" value="true" />
87
+ <option name="OTHER_OPTIONS" value="" />
88
+ <option name="HEAP_SIZE" />
89
+ <option name="LOCALE" />
90
+ <option name="OPEN_IN_BROWSER" value="true" />
91
+ </component>
92
+ <component name="JikesSettings">
93
+ <option name="JIKES_PATH" value="" />
94
+ <option name="DEBUGGING_INFO" value="true" />
95
+ <option name="DEPRECATION" value="true" />
96
+ <option name="GENERATE_NO_WARNINGS" value="false" />
97
+ <option name="IS_EMACS_ERRORS_MODE" value="true" />
98
+ <option name="ADDITIONAL_OPTIONS_STRING" value="" />
99
+ </component>
100
+ <component name="Palette2">
101
+ <group name="Swing">
102
+ <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
103
+ <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
104
+ </item>
105
+ <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
106
+ <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
107
+ </item>
108
+ <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
109
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
110
+ </item>
111
+ <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
112
+ <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
113
+ </item>
114
+ <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
115
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
116
+ <initial-values>
117
+ <property name="text" value="Button" />
118
+ </initial-values>
119
+ </item>
120
+ <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
121
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
122
+ <initial-values>
123
+ <property name="text" value="RadioButton" />
124
+ </initial-values>
125
+ </item>
126
+ <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
127
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
128
+ <initial-values>
129
+ <property name="text" value="CheckBox" />
130
+ </initial-values>
131
+ </item>
132
+ <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
133
+ <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
134
+ <initial-values>
135
+ <property name="text" value="Label" />
136
+ </initial-values>
137
+ </item>
138
+ <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
139
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
140
+ <preferred-size width="150" height="-1" />
141
+ </default-constraints>
142
+ </item>
143
+ <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
144
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
145
+ <preferred-size width="150" height="-1" />
146
+ </default-constraints>
147
+ </item>
148
+ <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
149
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
150
+ <preferred-size width="150" height="-1" />
151
+ </default-constraints>
152
+ </item>
153
+ <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
154
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
155
+ <preferred-size width="150" height="50" />
156
+ </default-constraints>
157
+ </item>
158
+ <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
159
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
160
+ <preferred-size width="150" height="50" />
161
+ </default-constraints>
162
+ </item>
163
+ <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
164
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
165
+ <preferred-size width="150" height="50" />
166
+ </default-constraints>
167
+ </item>
168
+ <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
169
+ <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
170
+ </item>
171
+ <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
172
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
173
+ <preferred-size width="150" height="50" />
174
+ </default-constraints>
175
+ </item>
176
+ <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
177
+ <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
178
+ <preferred-size width="150" height="50" />
179
+ </default-constraints>
180
+ </item>
181
+ <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
182
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
183
+ <preferred-size width="150" height="50" />
184
+ </default-constraints>
185
+ </item>
186
+ <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
187
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
188
+ <preferred-size width="200" height="200" />
189
+ </default-constraints>
190
+ </item>
191
+ <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
192
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
193
+ <preferred-size width="200" height="200" />
194
+ </default-constraints>
195
+ </item>
196
+ <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
197
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
198
+ </item>
199
+ <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
200
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
201
+ </item>
202
+ <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
203
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
204
+ </item>
205
+ <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
206
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
207
+ </item>
208
+ <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
209
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
210
+ <preferred-size width="-1" height="20" />
211
+ </default-constraints>
212
+ </item>
213
+ <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
214
+ <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
215
+ </item>
216
+ <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
217
+ <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
218
+ </item>
219
+ </group>
220
+ </component>
221
+ <component name="ProjectDetails">
222
+ <option name="projectName" value="<%= name %>" />
223
+ </component>
224
+ <component name="ProjectFileVersion" converted="true" />
225
+ <component name="ProjectKey">
226
+ <option name="state" value="project://<%= destination_root %>/<%= name %>.ipr" />
227
+ </component>
228
+ <component name="ProjectModuleManager">
229
+ <modules>
230
+ <module fileurl="file://$PROJECT_DIR$/<%= name %>.iml" filepath="$PROJECT_DIR$/<%= name %>.iml" />
231
+ </modules>
232
+ </component>
233
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_5" assert-keyword="true" jdk-15="true" project-jdk-name="1.6" project-jdk-type="JavaSDK">
234
+ <output url="file://$PROJECT_DIR$/out" />
235
+ </component>
236
+ <component name="ResourceManagerContainer">
237
+ <option name="myResourceBundles">
238
+ <value>
239
+ <list size="0" />
240
+ </value>
241
+ </option>
242
+ </component>
243
+ <component name="RmicSettings">
244
+ <option name="IS_EANABLED" value="false" />
245
+ <option name="DEBUGGING_INFO" value="true" />
246
+ <option name="GENERATE_NO_WARNINGS" value="false" />
247
+ <option name="GENERATE_IIOP_STUBS" value="false" />
248
+ <option name="ADDITIONAL_OPTIONS_STRING" value="" />
249
+ </component>
250
+ <component name="SvnBranchConfigurationManager">
251
+ <option name="myVersion" value="124" />
252
+ <option name="mySupportsUserInfoFilter" value="true" />
253
+ </component>
254
+ <component name="VcsDirectoryMappings">
255
+ <mapping directory="" vcs="Git" />
256
+ </component>
257
+ <component name="WebServicesPlugin" addRequiredLibraries="true" />
258
+ </project>
259
+
@@ -0,0 +1,11 @@
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 Rakefile to run
5
+ all tests.
6
+
7
+ Usage:
8
+
9
+ $ cd ~/ruby_projects
10
+ $ shubox learning_ruby
11
+ $ rake
@@ -0,0 +1,34 @@
1
+ require 'shubox_app_generator'
2
+
3
+ class RubyGenerator < ShuboxAppGenerator
4
+
5
+ def manifest
6
+ record do |m|
7
+ # Ensure appropriate folder(s) exists
8
+ m.directory ''
9
+ BASEDIRS.each { |path| m.directory path }
10
+
11
+ m.file "rakefile.rb", "rakefile.rb"
12
+ m.directory "lib/samples"
13
+ m.file "right_triangle.rb", "lib/samples/right_triangle.rb"
14
+ m.file "shubox.rb", "lib/shubox.rb"
15
+ m.directory "test/samples"
16
+ m.directory "test/data"
17
+ m.file "test_right_triangle.rb", "test/samples/test_right_triangle.rb"
18
+ m.file "test_io.rb", "test/test_io.rb"
19
+ m.file "file.txt", "test/data/file.txt"
20
+ m.file "test_helper.rb", "test/test_helper.rb"
21
+
22
+ m.dependency "install_rubigen_scripts", [destination_root, 'shubox'],
23
+ :shebang => options[:shebang], :collision => :force
24
+ end
25
+ end
26
+
27
+ protected
28
+ # Installation skeleton.
29
+ BASEDIRS = %w(
30
+ lib
31
+ script
32
+ test
33
+ )
34
+ end
@@ -0,0 +1,3 @@
1
+ Salam, azizam!
2
+
3
+ Welcome to Expo.
@@ -0,0 +1,9 @@
1
+ require 'rake/testtask'
2
+
3
+ task :default => :test
4
+
5
+ Rake::TestTask.new do |t|
6
+ t.libs << "test"
7
+ t.test_files = FileList['test/**/test*.rb']
8
+ t.verbose = true
9
+ end
@@ -0,0 +1,18 @@
1
+ # Encapsulates the geometry of a 3-sided polygon with a right angle.
2
+ # http://mathworld.wolfram.com/RightTriangle.html
3
+ class RightTriangle
4
+
5
+ def initialize(base, height)
6
+ @a, @b = base, height
7
+ @c = hypotenuse
8
+ end
9
+
10
+ def hypotenuse
11
+ Math.sqrt((@a**2) + (@b**2))
12
+ end
13
+
14
+ def area
15
+ 0.5 * @a * @b
16
+ end
17
+
18
+ end
@@ -0,0 +1,6 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+
4
+ module Shubox
5
+
6
+ end
@@ -0,0 +1,9 @@
1
+ require 'stringio'
2
+ require 'test/unit'
3
+ require File.dirname(__FILE__) + '/../lib/shubox'
4
+
5
+ module Constants
6
+ if (!defined? TEST_DATA_DIR)
7
+ TEST_DATA_DIR = File.join(File.expand_path(File.dirname(__FILE__)), "data")
8
+ end
9
+ end
@@ -0,0 +1,15 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+
3
+ # Expo usage note: Keeping an inline bookmark to the rdocs for the class under study
4
+ # makes it easy to continue your learning later.
5
+
6
+ # Exploring the methods of the IO class: http://www.ruby-doc.org/core/classes/IO.html
7
+ class TestIO < Test::Unit::TestCase
8
+
9
+ def test_readlines
10
+ contents = IO.readlines(File.join(Constants::TEST_DATA_DIR, "file.txt"))
11
+ # See String Match for =~ syntax: http://www.ruby-doc.org/core/classes/String.html#M000792
12
+ assert(contents[0] =~ /Salam/)
13
+ end
14
+
15
+ end
@@ -0,0 +1,21 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+ require 'samples/right_triangle'
3
+
4
+ # An example of testing a class in the lib folder.
5
+ class TestRightTriangle < Test::Unit::TestCase
6
+
7
+ def setup
8
+ @small = RightTriangle.new(3, 4)
9
+ @big = RightTriangle.new(120, 160)
10
+ end
11
+
12
+ def test_hypotenuse
13
+ assert_equal(5, @small.hypotenuse)
14
+ assert_equal(200, @big.hypotenuse)
15
+ end
16
+
17
+ def test_area
18
+ assert_equal(6, @small.area)
19
+ end
20
+
21
+ end
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'rubigen'
5
+ require File.dirname(__FILE__) + "/../lib/shubox"
6
+ require File.dirname(__FILE__) + "/../lib/languages"
7
+
8
+ if %w(-v --version).include? ARGV.first
9
+ puts "#{File.basename($0)} #{Shubox::VERSION}"
10
+ exit(0)
11
+ end
12
+
13
+ require 'rubigen/scripts/generate'
14
+
15
+ source = RubiGen::PathSource.new(:application,
16
+ File.join(File.dirname(__FILE__), "../app_generators"))
17
+ RubiGen::Base.reset_sources
18
+ RubiGen::Base.append_sources source
19
+
20
+ RubiGen::Scripts::Generate.new.run(ARGV, :generator => Languages.parse(ARGV))
@@ -0,0 +1,22 @@
1
+ class Languages
2
+
3
+ def self.parse(args)
4
+ lang = args.find {|arg| ((arg =~ /-l=/) or (arg =~ /--language=/)) }
5
+ lang = "-l=ruby" if lang.nil?
6
+ lang = lang.split('=')[1]
7
+ raise "Supported languages: #{current.inspect}" if (!current.member?(lang))
8
+ lang
9
+ end
10
+
11
+ def self.current
12
+ langs = Dir.entries(File.join(File.dirname(__FILE__), "../app_generators"))
13
+ langs.reject {|i| ((i == ".") or (i == ".."))}
14
+ end
15
+
16
+ def self.print
17
+ list = ""
18
+ current.each {|lang| list << lang << '|'}
19
+ list.chomp('|')
20
+ end
21
+
22
+ end
@@ -0,0 +1,6 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+
4
+ module Shubox
5
+ VERSION = '0.7'
6
+ end
@@ -0,0 +1,41 @@
1
+ class ShuboxAppGenerator < RubiGen::Base
2
+
3
+ DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
4
+ Config::CONFIG['ruby_install_name'])
5
+
6
+ default_options :language => 'ruby'
7
+
8
+ attr_reader :language
9
+ attr_reader :name
10
+
11
+ def initialize(runtime_args, runtime_options = {})
12
+ super
13
+ usage if args.empty?
14
+ @destination_root = File.expand_path(args.shift)
15
+ @name = base_name
16
+ extract_options
17
+ end
18
+
19
+ protected
20
+
21
+ def banner
22
+ "\n" << IO.readlines(File.join(File.dirname(__FILE__), "../README.rdoc"))[0]
23
+ end
24
+
25
+ def add_options!(opts)
26
+ opts.separator ''
27
+ opts.separator 'Options:'
28
+ # For each option below, place the default
29
+ # at the top of the file next to "default_options"
30
+ # opts.on("-a", "--author=\"Your Name\"", String,
31
+ # "Some comment about this option",
32
+ # "Default: none") { |o| options[:author] = o }
33
+ opts.on("-l", "--language=name", "Language of the environment to generate. Options: #{Languages.print}", "Default: ruby")
34
+ opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
35
+ end
36
+
37
+ def extract_options
38
+ @language = options[:language]
39
+ end
40
+
41
+ end
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # File: script/console
3
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
+
5
+ libs = " -r irb/completion"
6
+ # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
+ # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
+ libs << " -r #{File.dirname(__FILE__) + '/../lib/shubox.rb'}"
9
+ puts "Loading shubox gem"
10
+ exec "#{irb} #{libs} --simple-prompt"
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/destroy'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/generate'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Generate.new.run(ARGV)
@@ -0,0 +1,66 @@
1
+ begin
2
+ require File.dirname(__FILE__) + '/test_helper'
3
+ rescue LoadError
4
+ require 'test/unit'
5
+ end
6
+ require 'fileutils'
7
+
8
+ # Must set before requiring generator libs.
9
+ TMP_ROOT = File.dirname(__FILE__) + "/tmp" unless defined?(TMP_ROOT)
10
+ PROJECT_NAME = "myproject" unless defined?(PROJECT_NAME)
11
+ app_root = File.join(TMP_ROOT, PROJECT_NAME)
12
+ if defined?(APP_ROOT)
13
+ APP_ROOT.replace(app_root)
14
+ else
15
+ APP_ROOT = app_root
16
+ end
17
+ if defined?(RAILS_ROOT)
18
+ RAILS_ROOT.replace(app_root)
19
+ else
20
+ RAILS_ROOT = app_root
21
+ end
22
+
23
+ begin
24
+ require 'rubigen'
25
+ rescue LoadError
26
+ require 'rubygems'
27
+ require 'rubigen'
28
+ end
29
+ require 'rubigen/helpers/generator_test_helper'
30
+
31
+ module RubiGen::GeneratorTestHelper
32
+ def assert_file_contains(keyword, filename)
33
+ ipr = IO.readlines(File.join(APP_ROOT, filename)).to_s
34
+ assert(ipr =~ Regexp.new(keyword))
35
+ end
36
+
37
+ def run_generated_build_script(cmd)
38
+ FileUtils::cd(APP_ROOT) do
39
+ puts "Running generated build script in #{FileUtils::pwd} with #{cmd}"
40
+ `#{cmd}`
41
+ raise "Exit code #{$?} while running generated build script with #{cmd}" if ($?.to_s != "0")
42
+ end
43
+ end
44
+
45
+ def sources
46
+ [RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))]
47
+ end
48
+
49
+ def generator_path
50
+ "app_generators"
51
+ end
52
+ # Some generator-related assertions:
53
+ # assert_generated_file(name, &block) # block passed the file contents
54
+ # assert_directory_exists(name)
55
+ # assert_generated_class(name, &block)
56
+ # assert_generated_module(name, &block)
57
+ # assert_generated_test_for(name, &block)
58
+ # The assert_generated_(class|module|test_for) &block is passed the body of the class/module within the file
59
+ # assert_has_method(body, *methods) # check that the body has a list of methods (methods with parentheses not supported yet)
60
+ #
61
+ # Other helper methods are:
62
+ # app_root_files - put this in teardown to show files generated by the test method (e.g. p app_root_files)
63
+ # bare_setup - place this in setup method to create the APP_ROOT folder for each test
64
+ # bare_teardown - place this in teardown method to destroy the TMP_ROOT or APP_ROOT folder after each test
65
+ end
66
+
@@ -0,0 +1,4 @@
1
+ require 'stringio'
2
+ require 'test/unit'
3
+ require File.dirname(__FILE__) + '/../lib/shubox'
4
+
@@ -0,0 +1,37 @@
1
+ require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
2
+
3
+ class TestJavaGenerator < Test::Unit::TestCase
4
+ include RubiGen::GeneratorTestHelper
5
+
6
+ def setup
7
+ bare_setup
8
+ end
9
+
10
+ def teardown
11
+ bare_teardown
12
+ end
13
+
14
+ def test_generator_without_options
15
+ run_generator('java', [APP_ROOT], sources)
16
+ assert_generated_file "myproject.ipr"
17
+ assert_generated_file "myproject.iml"
18
+ assert_file_contains(PROJECT_NAME, "myproject.ipr")
19
+
20
+ assert_directory_exists "build"
21
+ assert_generated_file "build/build.xml"
22
+ assert_file_contains(PROJECT_NAME, "build/build.xml")
23
+
24
+ assert_directory_exists "lib"
25
+ assert_generated_file "lib/junit.jar"
26
+ assert_generated_file "lib/hamcrest-core.jar"
27
+
28
+ assert_directory_exists "src"
29
+ assert_generated_file "src/com/samples/Greeting.java"
30
+
31
+ assert_directory_exists "test"
32
+ assert_generated_file "test/com/samples/GreetingTest.java"
33
+
34
+ run_generated_build_script("ant -f build/build.xml")
35
+ end
36
+
37
+ end
@@ -0,0 +1,32 @@
1
+ require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
2
+ require 'languages'
3
+
4
+ class TestLanguages < Test::Unit::TestCase
5
+
6
+ def test_list_current_languages
7
+ langs = Languages.current
8
+ assert(langs.length > 1)
9
+ assert(!langs.include?("."))
10
+ assert(!langs.include?(".."))
11
+ end
12
+
13
+ def test_parse_command_for_valid_language
14
+ args = %w{-l=java MyAppName}
15
+ assert_equal("java", Languages.parse(args))
16
+ args = %w{--language=ruby app_name}
17
+ assert_equal("ruby", Languages.parse(args))
18
+ end
19
+
20
+ def test_reject_invalid_language
21
+ args = %w{-l=non sense}
22
+ assert_raise RuntimeError do
23
+ Languages.parse(args)
24
+ end
25
+ end
26
+
27
+ def test_print_languages
28
+ base = "java|ruby"
29
+ print = Languages.print
30
+ assert(print.include?(base))
31
+ end
32
+ end
@@ -0,0 +1,32 @@
1
+ require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
2
+ require 'fileutils'
3
+
4
+ class TestRubyGenerator < 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
+ def test_generator_without_options
16
+ run_generator('ruby', [APP_ROOT], sources)
17
+
18
+ assert_generated_file "rakefile.rb"
19
+ assert_directory_exists "lib/samples"
20
+ assert_generated_file "lib/samples/right_triangle.rb"
21
+ assert_generated_file "lib/shubox.rb"
22
+ assert_directory_exists "test/samples"
23
+ assert_generated_file "test/samples/test_right_triangle.rb"
24
+ assert_directory_exists "test/data"
25
+ assert_generated_file "test/data/file.txt"
26
+ assert_generated_file "test/test_io.rb"
27
+ assert_generated_file "test/test_helper.rb"
28
+
29
+ run_generated_build_script("rake")
30
+ end
31
+
32
+ end
metadata ADDED
@@ -0,0 +1,118 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bobbyno-shubox
3
+ version: !ruby/object:Gem::Version
4
+ version: "0.6"
5
+ platform: ruby
6
+ authors:
7
+ - Bobby Norton
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-06-24 00:00:00 -07:00
13
+ default_executable: shubox
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: newgem
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.4.1
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: hoe
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.8.0
34
+ version:
35
+ description: "Test-driven learning is a way to master a programming language by writing unit tests around its API's. shubox 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 build script."
36
+ email:
37
+ - codeculturist@gmail.com
38
+ executables:
39
+ - shubox
40
+ extensions: []
41
+
42
+ extra_rdoc_files:
43
+ - History.txt
44
+ - Manifest.txt
45
+ - PostInstall.txt
46
+ - README.rdoc
47
+ - app_generators/ruby/templates/file.txt
48
+ files:
49
+ - History.txt
50
+ - MIT-LICENSE
51
+ - Manifest.txt
52
+ - PostInstall.txt
53
+ - README.rdoc
54
+ - Rakefile
55
+ - app_generators/java/USAGE
56
+ - app_generators/java/java_generator.rb
57
+ - app_generators/java/templates/Greeting.java
58
+ - app_generators/java/templates/GreetingTest.java
59
+ - app_generators/java/templates/build.xml
60
+ - app_generators/java/templates/lib/hamcrest-core.jar
61
+ - app_generators/java/templates/lib/junit.jar
62
+ - app_generators/java/templates/project.iml
63
+ - app_generators/java/templates/project.ipr
64
+ - app_generators/ruby/USAGE
65
+ - app_generators/ruby/ruby_generator.rb
66
+ - app_generators/ruby/templates/file.txt
67
+ - app_generators/ruby/templates/rakefile.rb
68
+ - app_generators/ruby/templates/right_triangle.rb
69
+ - app_generators/ruby/templates/shubox.rb
70
+ - app_generators/ruby/templates/test_helper.rb
71
+ - app_generators/ruby/templates/test_io.rb
72
+ - app_generators/ruby/templates/test_right_triangle.rb
73
+ - bin/shubox
74
+ - lib/languages.rb
75
+ - lib/shubox.rb
76
+ - lib/shubox_app_generator.rb
77
+ - script/console
78
+ - script/destroy
79
+ - script/generate
80
+ - test/test_generator_helper.rb
81
+ - test/test_helper.rb
82
+ - test/test_java_generator.rb
83
+ - test/test_languages.rb
84
+ - test/test_ruby_generator.rb
85
+ has_rdoc: false
86
+ homepage: http://github.com/bobbyno/shubox/tree/master
87
+ licenses:
88
+ post_install_message: PostInstall.txt
89
+ rdoc_options:
90
+ - --main
91
+ - README.rdoc
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: "0"
99
+ version:
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: "0"
105
+ version:
106
+ requirements: []
107
+
108
+ rubyforge_project: shubox
109
+ rubygems_version: 1.3.5
110
+ signing_key:
111
+ specification_version: 3
112
+ summary: Test-driven learning is a way to master a programming language by writing unit tests around its API's
113
+ test_files:
114
+ - test/test_generator_helper.rb
115
+ - test/test_helper.rb
116
+ - test/test_java_generator.rb
117
+ - test/test_languages.rb
118
+ - test/test_ruby_generator.rb