gigantron 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/History.txt +5 -0
  2. data/License.txt +20 -0
  3. data/Manifest.txt +48 -0
  4. data/PostInstall.txt +4 -0
  5. data/README.txt +70 -0
  6. data/Rakefile +4 -0
  7. data/app_generators/gigantron/USAGE +7 -0
  8. data/app_generators/gigantron/gigantron_generator.rb +80 -0
  9. data/app_generators/gigantron/templates/Rakefile +12 -0
  10. data/app_generators/gigantron/templates/database.yml +9 -0
  11. data/app_generators/gigantron/templates/initialize.rb +26 -0
  12. data/app_generators/gigantron/templates/tasks/import.rake +10 -0
  13. data/app_generators/gigantron/templates/test/tasks/test_import.rb +23 -0
  14. data/app_generators/gigantron/templates/test/test_helper.rb +5 -0
  15. data/bin/gigantron +15 -0
  16. data/config/hoe.rb +80 -0
  17. data/config/requirements.rb +15 -0
  18. data/gigantron_generators/model/USAGE +11 -0
  19. data/gigantron_generators/model/model_generator.rb +51 -0
  20. data/gigantron_generators/model/templates/models/model.rb +6 -0
  21. data/gigantron_generators/model/templates/test/models/test_model.rb +13 -0
  22. data/gigantron_generators/task/USAGE +10 -0
  23. data/gigantron_generators/task/task_generator.rb +50 -0
  24. data/gigantron_generators/task/templates/tasks/task.rake +4 -0
  25. data/gigantron_generators/task/templates/test/tasks/test_task.rb +22 -0
  26. data/lib/gigantron/tasks/db.rb +8 -0
  27. data/lib/gigantron/tasks/test.rb +30 -0
  28. data/lib/gigantron/version.rb +9 -0
  29. data/lib/gigantron.rb +0 -0
  30. data/script/console +10 -0
  31. data/script/destroy +14 -0
  32. data/script/generate +14 -0
  33. data/script/txt2html +82 -0
  34. data/setup.rb +1585 -0
  35. data/tasks/deployment.rake +34 -0
  36. data/tasks/environment.rake +7 -0
  37. data/tasks/website.rake +17 -0
  38. data/test/test_generator_helper.rb +29 -0
  39. data/test/test_gigantron.rb +11 -0
  40. data/test/test_gigantron_generator.rb +56 -0
  41. data/test/test_helper.rb +4 -0
  42. data/test/test_model_generator.rb +48 -0
  43. data/test/test_task_generator.rb +48 -0
  44. data/website/index.html +149 -0
  45. data/website/index.txt +93 -0
  46. data/website/javascripts/rounded_corners_lite.inc.js +285 -0
  47. data/website/stylesheets/screen.css +138 -0
  48. data/website/template.html.erb +48 -0
  49. metadata +110 -0
@@ -0,0 +1,34 @@
1
+ desc 'Release the website and new gem version'
2
+ task :deploy => [:check_version, :website, :release] do
3
+ puts "Remember to create SVN tag:"
4
+ puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
5
+ "svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
6
+ puts "Suggested comment:"
7
+ puts "Tagging release #{CHANGES}"
8
+ end
9
+
10
+ desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
11
+ task :local_deploy => [:website_generate, :install_gem]
12
+
13
+ task :check_version do
14
+ unless ENV['VERSION']
15
+ puts 'Must pass a VERSION=x.y.z release version'
16
+ exit
17
+ end
18
+ unless ENV['VERSION'] == VERS
19
+ puts "Please update your version.rb to match the release version, currently #{VERS}"
20
+ exit
21
+ end
22
+ end
23
+
24
+ desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
25
+ task :install_gem_no_doc => [:clean, :package] do
26
+ sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
27
+ end
28
+
29
+ namespace :manifest do
30
+ desc 'Recreate Manifest.txt to include ALL files'
31
+ task :refresh do
32
+ `rake check_manifest | patch -p0 > Manifest.txt`
33
+ end
34
+ end
@@ -0,0 +1,7 @@
1
+ task :ruby_env do
2
+ RUBY_APP = if RUBY_PLATFORM =~ /java/
3
+ "jruby"
4
+ else
5
+ "ruby"
6
+ end unless defined? RUBY_APP
7
+ end
@@ -0,0 +1,17 @@
1
+ desc 'Generate website files'
2
+ task :website_generate => :ruby_env do
3
+ (Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt|
4
+ sh %{ #{RUBY_APP} script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
5
+ end
6
+ end
7
+
8
+ desc 'Upload website files to rubyforge'
9
+ task :website_upload do
10
+ host = "#{rubyforge_username}@rubyforge.org"
11
+ remote_dir = "/var/www/gforge-projects/#{PATH}/"
12
+ local_dir = 'website'
13
+ sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
14
+ end
15
+
16
+ desc 'Generate and upload website files'
17
+ task :website => [:website_generate, :website_upload, :publish_docs]
@@ -0,0 +1,29 @@
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'
@@ -0,0 +1,11 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class TestGigantron < Test::Unit::TestCase
4
+
5
+ def setup
6
+ end
7
+
8
+ def test_truth
9
+ assert true
10
+ end
11
+ end
@@ -0,0 +1,56 @@
1
+ require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
2
+
3
+ class TestGigantronGenerator < 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
+ # Some generator-related assertions:
15
+ # assert_generated_file(name, &block) # block passed the file contents
16
+ # assert_directory_exists(name)
17
+ # assert_generated_class(name, &block)
18
+ # assert_generated_module(name, &block)
19
+ # assert_generated_test_for(name, &block)
20
+ # The assert_generated_(class|module|test_for) &block is passed the body of the class/module within the file
21
+ # assert_has_method(body, *methods) # check that the body has a list of methods (methods with parentheses not supported yet)
22
+ #
23
+ # Other helper methods are:
24
+ # app_root_files - put this in teardown to show files generated by the test method (e.g. p app_root_files)
25
+ # bare_setup - place this in setup method to create the APP_ROOT folder for each test
26
+ # bare_teardown - place this in teardown method to destroy the TMP_ROOT or APP_ROOT folder after each test
27
+
28
+ def test_generator_without_options
29
+ run_generator('gigantron', [APP_ROOT], sources)
30
+ assert_directory_exists "tasks/"
31
+ assert_generated_file "tasks/import.rake"
32
+ assert_directory_exists "test/"
33
+ assert_generated_file "test/test_helper.rb"
34
+ assert_directory_exists "test/tasks/"
35
+ assert_generated_file "test/tasks/test_import.rb"
36
+ assert_directory_exists "test/models/"
37
+ assert_directory_exists "lib/"
38
+ assert_directory_exists "models/"
39
+ assert_directory_exists "db/"
40
+ assert_directory_exists "script/"
41
+ assert_generated_file "script/generate"
42
+ assert_generated_file "database.yml"
43
+ assert_generated_file "Rakefile"
44
+ assert_generated_file "initialize.rb"
45
+ end
46
+
47
+ private
48
+ def sources
49
+ [RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
50
+ ]
51
+ end
52
+
53
+ def generator_path
54
+ "app_generators"
55
+ end
56
+ end
@@ -0,0 +1,4 @@
1
+ require 'test/unit'
2
+ require 'rubygems'
3
+ require 'shoulda'
4
+ require File.dirname(__FILE__) + '/../lib/gigantron'
@@ -0,0 +1,48 @@
1
+ require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
2
+
3
+
4
+ class TestModelGenerator < 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
+ name = "foo"
31
+ run_generator('model', [name], sources)
32
+ assert_directory_exists "models/"
33
+ assert_generated_file "models/#{name}.rb"
34
+ assert_directory_exists "test/"
35
+ assert_directory_exists "test/models/"
36
+ assert_generated_file "test/models/test_#{name}.rb"
37
+ end
38
+
39
+ private
40
+ def sources
41
+ [RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
42
+ ]
43
+ end
44
+
45
+ def generator_path
46
+ "gigantron_generators"
47
+ end
48
+ end
@@ -0,0 +1,48 @@
1
+ require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
2
+
3
+
4
+ class TestTaskGenerator < 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
+ name = "bar"
31
+ run_generator('task', [name], sources)
32
+ assert_directory_exists "tasks/"
33
+ assert_generated_file "tasks/#{name}.rake"
34
+ assert_directory_exists "test/"
35
+ assert_directory_exists "test/tasks"
36
+ assert_generated_file "test/tasks/test_#{name}.rb"
37
+ end
38
+
39
+ private
40
+ def sources
41
+ [RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
42
+ ]
43
+ end
44
+
45
+ def generator_path
46
+ "gigantron_generators"
47
+ end
48
+ end
@@ -0,0 +1,149 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
+ <title>
8
+ Gigantron: Processor of Data
9
+ </title>
10
+ <script src="javascripts/rounded_corners_lite.inc.js" type="text/javascript"></script>
11
+ <style>
12
+
13
+ </style>
14
+ <script type="text/javascript">
15
+ window.onload = function() {
16
+ settings = {
17
+ tl: { radius: 10 },
18
+ tr: { radius: 10 },
19
+ bl: { radius: 10 },
20
+ br: { radius: 10 },
21
+ antiAlias: true,
22
+ autoPad: true,
23
+ validTags: ["div"]
24
+ }
25
+ var versionBox = new curvyCorners(settings, document.getElementById("version"));
26
+ versionBox.applyCornersToAll();
27
+ }
28
+ </script>
29
+ </head>
30
+ <body>
31
+ <div id="main">
32
+
33
+ <h1>Gigantron: Processor of Data</h1>
34
+ <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/gigantron"; return false'>
35
+ <p>Get Version</p>
36
+ <a href="http://rubyforge.org/projects/gigantron" class="numbers">0.0.1</a>
37
+ </div>
38
+ <h1>&#x2192; &#8216;gigantron&#8217;</h1>
39
+
40
+
41
+ <h2>What</h2>
42
+
43
+
44
+ <p>Gigantron is a simple framework for the creation and organization of
45
+ data processing projects. Data-processing transforms are created as Rake tasks
46
+ and data is handled through DataMapper models.</p>
47
+
48
+
49
+ <p>Ruby is great for exploratory data processing. Data processing projects tend
50
+ to grow up and encompass large numbers of random scripts and input files. It
51
+ is easy to get lost in coding and lose organization. Gigantron is an attempt
52
+ to use code generation and random magic to make maintaining organized DP
53
+ projects simple. Code is separated into data (models) and operations on the
54
+ data (tasks). Code generators stub out these files and the associated tests
55
+ for the user.</p>
56
+
57
+
58
+ <p>Gigantron was written for my own needs working with atmospheric data and will
59
+ evolve through use to reduce the trivialities that can sometimes dominate the
60
+ work of developers.</p>
61
+
62
+
63
+ <h2>Installing</h2>
64
+
65
+
66
+ <p><pre class='syntax'><span class="ident">sudo</span> <span class="ident">gem</span> <span class="ident">install</span> <span class="ident">gigantron</span></pre></p>
67
+
68
+
69
+ <h2>The basics</h2>
70
+
71
+
72
+ <pre>
73
+ # Generate new project
74
+ shell&gt; $ gigantron project
75
+ create
76
+ create tasks
77
+ create db
78
+ create models
79
+ create lib
80
+ create test
81
+ create Rakefile
82
+ create database.yml
83
+ create initialize.rb
84
+ create tasks/import.rake
85
+ create test/test_helper.rb
86
+ create test/models
87
+ create test/tasks
88
+ create test/tasks/test_import.rb
89
+ dependency install_rubigen_scripts
90
+ create script
91
+ create script/generate
92
+ create script/destroy
93
+ shell&gt; $ cd project
94
+ # Create new model
95
+ shell&gt; $ script/generate model modis
96
+ exists models/
97
+ create models/modis.rb
98
+ exists test/
99
+ exists test/models/
100
+ create test/models/test_modis.rb
101
+ shell&gt; $ script/generate task modis_to_kml
102
+ exists tasks/
103
+ create tasks/modis_to_kml.rake
104
+ exists test/
105
+ exists test/tasks/
106
+ create test/tasks/test_modis_to_kml.rb
107
+ </pre>
108
+
109
+ <p>One can edit these files to add functionality. Gigantron by default includes
110
+ ActiveSupport for convenience.</p>
111
+
112
+
113
+ <h2>How to submit patches</h2>
114
+
115
+
116
+ <ul>
117
+ <li>github: <a href="http://github.com/schleyfox/gigantron/tree/master">http://github.com/schleyfox/gigantron/tree/master</a></li>
118
+ </ul>
119
+
120
+
121
+ <pre>git clone git://github.com/schleyfox/gigantron.git</pre>
122
+
123
+ <h3>Build and test instructions</h3>
124
+
125
+
126
+ <pre>cd gigantron
127
+ rake test
128
+ rake install_gem</pre>
129
+
130
+ <h2>License</h2>
131
+
132
+
133
+ <p>This code is free to use under the terms of the <span class="caps">MIT</span> license.</p>
134
+
135
+
136
+ <h2>Contact</h2>
137
+
138
+
139
+ <p>Comments are welcome. Send an email to <a href="mailto:ben@pixelmachine.org">Ben Hughes</a></p>
140
+ <p class="coda">
141
+ <a href="ben@pixelmachine.org">Ben Hughes</a>, 1st June 2008<br>
142
+ Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
143
+ </p>
144
+ </div>
145
+
146
+ <!-- insert site tracking codes here, like Google Urchin -->
147
+
148
+ </body>
149
+ </html>
data/website/index.txt ADDED
@@ -0,0 +1,93 @@
1
+ h1. Gigantron: Processor of Data
2
+
3
+ h1. &#x2192; 'gigantron'
4
+
5
+
6
+ h2. What
7
+
8
+ Gigantron is a simple framework for the creation and organization of
9
+ data processing projects. Data-processing transforms are created as Rake tasks
10
+ and data is handled through DataMapper models.
11
+
12
+ Ruby is great for exploratory data processing. Data processing projects tend
13
+ to grow up and encompass large numbers of random scripts and input files. It
14
+ is easy to get lost in coding and lose organization. Gigantron is an attempt
15
+ to use code generation and random magic to make maintaining organized DP
16
+ projects simple. Code is separated into data (models) and operations on the
17
+ data (tasks). Code generators stub out these files and the associated tests
18
+ for the user.
19
+
20
+ Gigantron was written for my own needs working with atmospheric data and will
21
+ evolve through use to reduce the trivialities that can sometimes dominate the
22
+ work of developers.
23
+
24
+ h2. Installing
25
+
26
+ <pre syntax="ruby">sudo gem install gigantron</pre>
27
+
28
+ h2. The basics
29
+
30
+ <pre>
31
+ # Generate new project
32
+ shell> $ gigantron project
33
+ create
34
+ create tasks
35
+ create db
36
+ create models
37
+ create lib
38
+ create test
39
+ create Rakefile
40
+ create database.yml
41
+ create initialize.rb
42
+ create tasks/import.rake
43
+ create test/test_helper.rb
44
+ create test/models
45
+ create test/tasks
46
+ create test/tasks/test_import.rb
47
+ dependency install_rubigen_scripts
48
+ create script
49
+ create script/generate
50
+ create script/destroy
51
+ shell> $ cd project
52
+ # Create new model
53
+ shell> $ script/generate model modis
54
+ exists models/
55
+ create models/modis.rb
56
+ exists test/
57
+ exists test/models/
58
+ create test/models/test_modis.rb
59
+ shell> $ script/generate task modis_to_kml
60
+ exists tasks/
61
+ create tasks/modis_to_kml.rake
62
+ exists test/
63
+ exists test/tasks/
64
+ create test/tasks/test_modis_to_kml.rb
65
+ </pre>
66
+
67
+ One can edit these files to add functionality. Gigantron by default includes
68
+ ActiveSupport for convenience.
69
+
70
+
71
+ h2. How to submit patches
72
+
73
+
74
+ * github: "http://github.com/schleyfox/gigantron/tree/master":http://github.com/schleyfox/gigantron/tree/master
75
+
76
+ <pre>git clone git://github.com/schleyfox/gigantron.git</pre>
77
+
78
+
79
+ h3. Build and test instructions
80
+
81
+ <pre>cd gigantron
82
+ rake test
83
+ rake install_gem</pre>
84
+
85
+
86
+ h2. License
87
+
88
+ This code is free to use under the terms of the MIT license.
89
+
90
+ h2. Contact
91
+
92
+ Comments are welcome. Send an email to "Ben Hughes":mailto:ben@pixelmachine.org
93
+