gigantron 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/test/test_generator_helper.rb +29 -29
- data/test/test_gigantron_generator.rb +118 -114
- data/test/test_helper.rb +4 -4
- data/test/test_mapreduce_task_generator.rb +50 -50
- data/test/test_migration_generator.rb +49 -49
- data/test/test_model_generator.rb +53 -53
- data/test/test_task_generator.rb +48 -48
- metadata +48 -109
- data/History.txt +0 -15
- data/License.txt +0 -20
- data/Manifest.txt +0 -62
- data/PostInstall.txt +0 -4
- data/README.txt +0 -77
- data/Rakefile +0 -4
- data/app_generators/gigantron/USAGE +0 -7
- data/app_generators/gigantron/gigantron_generator.rb +0 -81
- data/app_generators/gigantron/templates/Rakefile +0 -12
- data/app_generators/gigantron/templates/database.yml +0 -8
- data/app_generators/gigantron/templates/initialize.rb +0 -34
- data/app_generators/gigantron/templates/tasks/import.rake +0 -10
- data/app_generators/gigantron/templates/test/tasks/test_import.rb +0 -23
- data/app_generators/gigantron/templates/test/test_helper.rb +0 -7
- data/bin/gigantron +0 -15
- data/config/hoe.rb +0 -82
- data/config/requirements.rb +0 -15
- data/gigantron_generators/mapreduce_task/USAGE +0 -5
- data/gigantron_generators/mapreduce_task/mapreduce_task_generator.rb +0 -54
- data/gigantron_generators/mapreduce_task/templates/mapreduce/mr_task.rb +0 -22
- data/gigantron_generators/mapreduce_task/templates/tasks/task.rake +0 -5
- data/gigantron_generators/mapreduce_task/templates/test/tasks/test_task.rb +0 -22
- data/gigantron_generators/migration/USAGE +0 -5
- data/gigantron_generators/migration/migration_generator.rb +0 -61
- data/gigantron_generators/migration/templates/db/migrate/migration.rb +0 -7
- data/gigantron_generators/model/USAGE +0 -11
- data/gigantron_generators/model/model_generator.rb +0 -54
- data/gigantron_generators/model/templates/models/model.rb +0 -3
- data/gigantron_generators/model/templates/test/models/test_model.rb +0 -13
- data/gigantron_generators/task/USAGE +0 -10
- data/gigantron_generators/task/task_generator.rb +0 -51
- data/gigantron_generators/task/templates/tasks/task.rake +0 -4
- data/gigantron_generators/task/templates/test/tasks/test_task.rb +0 -22
- data/lib/gigantron/migrator.rb +0 -10
- data/lib/gigantron/tasks/db.rb +0 -11
- data/lib/gigantron/tasks/test.rb +0 -30
- data/lib/gigantron/version.rb +0 -9
- data/lib/gigantron.rb +0 -0
- data/script/console +0 -10
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/script/txt2html +0 -82
- data/setup.rb +0 -1585
- data/tasks/deployment.rake +0 -34
- data/tasks/environment.rake +0 -7
- data/tasks/website.rake +0 -17
- data/test/template_database.yml +0 -9
- data/test/template_database.yml.example +0 -9
- data/test/template_migration.rb +0 -16
- data/website/index.html +0 -213
- data/website/index.txt +0 -145
- data/website/javascripts/rounded_corners_lite.inc.js +0 -285
- data/website/stylesheets/screen.css +0 -138
- data/website/template.html.erb +0 -48
data/test/test_task_generator.rb
CHANGED
@@ -1,48 +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 = "FooBar"
|
31
|
-
run_generator('task', [name], sources)
|
32
|
-
assert_directory_exists "tasks/"
|
33
|
-
assert_generated_file "tasks/foo_bar.rake"
|
34
|
-
assert_directory_exists "test/"
|
35
|
-
assert_directory_exists "test/tasks"
|
36
|
-
assert_generated_file "test/tasks/test_foo_bar.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
|
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 = "FooBar"
|
31
|
+
run_generator('task', [name], sources)
|
32
|
+
assert_directory_exists "tasks/"
|
33
|
+
assert_generated_file "tasks/foo_bar.rake"
|
34
|
+
assert_directory_exists "test/"
|
35
|
+
assert_directory_exists "test/tasks"
|
36
|
+
assert_generated_file "test/tasks/test_foo_bar.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
|
metadata
CHANGED
@@ -1,89 +1,62 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gigantron
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ben Hughes
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-06-22 00:00:00 -04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: description of gem
|
8
17
|
email:
|
9
18
|
- ben@pixelmachine.org
|
10
|
-
|
11
|
-
|
19
|
+
executables: []
|
20
|
+
|
21
|
+
extensions: []
|
22
|
+
|
23
|
+
extra_rdoc_files: []
|
24
|
+
|
25
|
+
files: []
|
26
|
+
|
27
|
+
has_rdoc: true
|
28
|
+
homepage: http://gigantron.rubyforge.org
|
12
29
|
post_install_message: |
|
13
30
|
|
14
31
|
For more information on gigantron, see http://gigantron.rubyforge.org
|
15
|
-
|
32
|
+
|
16
33
|
Do you enjoy the tangy zip of miracle whip?
|
17
|
-
|
18
|
-
- History.txt
|
19
|
-
- License.txt
|
20
|
-
- Manifest.txt
|
21
|
-
- PostInstall.txt
|
22
|
-
- README.txt
|
23
|
-
- website/index.txt
|
24
|
-
homepage: http://gigantron.rubyforge.org
|
25
|
-
signing_key:
|
26
|
-
name: gigantron
|
34
|
+
|
27
35
|
rdoc_options:
|
28
36
|
- --main
|
29
37
|
- README.txt
|
30
|
-
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: "0"
|
45
|
+
version:
|
46
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: "0"
|
51
|
+
version:
|
52
|
+
requirements: []
|
53
|
+
|
31
54
|
rubyforge_project: gigantron
|
32
|
-
|
33
|
-
|
34
|
-
description: description of gem
|
55
|
+
rubygems_version: 1.2.0
|
56
|
+
signing_key:
|
35
57
|
specification_version: 2
|
36
|
-
|
37
|
-
|
38
|
-
- History.txt
|
39
|
-
- License.txt
|
40
|
-
- Manifest.txt
|
41
|
-
- PostInstall.txt
|
42
|
-
- README.txt
|
43
|
-
- Rakefile
|
44
|
-
- app_generators/gigantron/USAGE
|
45
|
-
- app_generators/gigantron/gigantron_generator.rb
|
46
|
-
- app_generators/gigantron/templates/Rakefile
|
47
|
-
- app_generators/gigantron/templates/database.yml
|
48
|
-
- app_generators/gigantron/templates/initialize.rb
|
49
|
-
- app_generators/gigantron/templates/tasks/import.rake
|
50
|
-
- app_generators/gigantron/templates/test/tasks/test_import.rb
|
51
|
-
- app_generators/gigantron/templates/test/test_helper.rb
|
52
|
-
- bin/gigantron
|
53
|
-
- config/hoe.rb
|
54
|
-
- config/requirements.rb
|
55
|
-
- gigantron_generators/mapreduce_task/USAGE
|
56
|
-
- gigantron_generators/mapreduce_task/mapreduce_task_generator.rb
|
57
|
-
- gigantron_generators/mapreduce_task/templates/mapreduce/mr_task.rb
|
58
|
-
- gigantron_generators/mapreduce_task/templates/tasks/task.rake
|
59
|
-
- gigantron_generators/mapreduce_task/templates/test/tasks/test_task.rb
|
60
|
-
- gigantron_generators/migration/USAGE
|
61
|
-
- gigantron_generators/migration/migration_generator.rb
|
62
|
-
- gigantron_generators/migration/templates/db/migrate/migration.rb
|
63
|
-
- gigantron_generators/model/USAGE
|
64
|
-
- gigantron_generators/model/model_generator.rb
|
65
|
-
- gigantron_generators/model/templates/models/model.rb
|
66
|
-
- gigantron_generators/model/templates/test/models/test_model.rb
|
67
|
-
- gigantron_generators/task/USAGE
|
68
|
-
- gigantron_generators/task/task_generator.rb
|
69
|
-
- gigantron_generators/task/templates/tasks/task.rake
|
70
|
-
- gigantron_generators/task/templates/test/tasks/test_task.rb
|
71
|
-
- lib/gigantron.rb
|
72
|
-
- lib/gigantron/migrator.rb
|
73
|
-
- lib/gigantron/tasks/db.rb
|
74
|
-
- lib/gigantron/tasks/test.rb
|
75
|
-
- lib/gigantron/version.rb
|
76
|
-
- script/console
|
77
|
-
- script/destroy
|
78
|
-
- script/generate
|
79
|
-
- script/txt2html
|
80
|
-
- setup.rb
|
81
|
-
- tasks/deployment.rake
|
82
|
-
- tasks/environment.rake
|
83
|
-
- tasks/website.rake
|
84
|
-
- test/template_database.yml
|
85
|
-
- test/template_database.yml.example
|
86
|
-
- test/template_migration.rb
|
58
|
+
summary: description of gem
|
59
|
+
test_files:
|
87
60
|
- test/test_generator_helper.rb
|
88
61
|
- test/test_gigantron.rb
|
89
62
|
- test/test_gigantron_generator.rb
|
@@ -92,37 +65,3 @@ files:
|
|
92
65
|
- test/test_migration_generator.rb
|
93
66
|
- test/test_model_generator.rb
|
94
67
|
- test/test_task_generator.rb
|
95
|
-
- website/index.html
|
96
|
-
- website/index.txt
|
97
|
-
- website/javascripts/rounded_corners_lite.inc.js
|
98
|
-
- website/stylesheets/screen.css
|
99
|
-
- website/template.html.erb
|
100
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
-
requirements:
|
102
|
-
- - '>='
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version: !str 0
|
105
|
-
version:
|
106
|
-
extensions: []
|
107
|
-
rubygems_version: 1.1.1
|
108
|
-
requirements: []
|
109
|
-
authors:
|
110
|
-
- Ben Hughes
|
111
|
-
date: 2008-06-19 04:00:00 +00:00
|
112
|
-
platform: ruby
|
113
|
-
test_files:
|
114
|
-
- test/test_model_generator.rb
|
115
|
-
- test/test_migration_generator.rb
|
116
|
-
- test/test_helper.rb
|
117
|
-
- test/test_task_generator.rb
|
118
|
-
- test/test_gigantron_generator.rb
|
119
|
-
- test/test_mapreduce_task_generator.rb
|
120
|
-
- test/test_gigantron.rb
|
121
|
-
- test/test_generator_helper.rb
|
122
|
-
version: !ruby/object:Gem::Version
|
123
|
-
version: 0.1.1
|
124
|
-
require_paths:
|
125
|
-
- lib
|
126
|
-
dependencies: []
|
127
|
-
bindir: bin
|
128
|
-
has_rdoc: true
|
data/History.txt
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
== 0.1.1 2008-06-19
|
2
|
-
* 1 minor enhancement:
|
3
|
-
* Migrations are now created with model
|
4
|
-
* 1 major bugfix:
|
5
|
-
* use camelcase instead of capitalize in code generators
|
6
|
-
== 0.1.0 2008-06-18
|
7
|
-
|
8
|
-
* Millions of major enhancements:
|
9
|
-
* Now uses ActiveRecord
|
10
|
-
* Better tests
|
11
|
-
== 0.0.1 2008-05-31
|
12
|
-
|
13
|
-
* 1 major enhancement:
|
14
|
-
* Initial release
|
15
|
-
* It works somewhat, will use in practice to see where it is headed
|
data/License.txt
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2008 Ben Hughes
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Manifest.txt
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
History.txt
|
2
|
-
License.txt
|
3
|
-
Manifest.txt
|
4
|
-
PostInstall.txt
|
5
|
-
README.txt
|
6
|
-
Rakefile
|
7
|
-
app_generators/gigantron/USAGE
|
8
|
-
app_generators/gigantron/gigantron_generator.rb
|
9
|
-
app_generators/gigantron/templates/Rakefile
|
10
|
-
app_generators/gigantron/templates/database.yml
|
11
|
-
app_generators/gigantron/templates/initialize.rb
|
12
|
-
app_generators/gigantron/templates/tasks/import.rake
|
13
|
-
app_generators/gigantron/templates/test/tasks/test_import.rb
|
14
|
-
app_generators/gigantron/templates/test/test_helper.rb
|
15
|
-
bin/gigantron
|
16
|
-
config/hoe.rb
|
17
|
-
config/requirements.rb
|
18
|
-
gigantron_generators/mapreduce_task/USAGE
|
19
|
-
gigantron_generators/mapreduce_task/mapreduce_task_generator.rb
|
20
|
-
gigantron_generators/mapreduce_task/templates/mapreduce/mr_task.rb
|
21
|
-
gigantron_generators/mapreduce_task/templates/tasks/task.rake
|
22
|
-
gigantron_generators/mapreduce_task/templates/test/tasks/test_task.rb
|
23
|
-
gigantron_generators/migration/USAGE
|
24
|
-
gigantron_generators/migration/migration_generator.rb
|
25
|
-
gigantron_generators/migration/templates/db/migrate/migration.rb
|
26
|
-
gigantron_generators/model/USAGE
|
27
|
-
gigantron_generators/model/model_generator.rb
|
28
|
-
gigantron_generators/model/templates/models/model.rb
|
29
|
-
gigantron_generators/model/templates/test/models/test_model.rb
|
30
|
-
gigantron_generators/task/USAGE
|
31
|
-
gigantron_generators/task/task_generator.rb
|
32
|
-
gigantron_generators/task/templates/tasks/task.rake
|
33
|
-
gigantron_generators/task/templates/test/tasks/test_task.rb
|
34
|
-
lib/gigantron.rb
|
35
|
-
lib/gigantron/migrator.rb
|
36
|
-
lib/gigantron/tasks/db.rb
|
37
|
-
lib/gigantron/tasks/test.rb
|
38
|
-
lib/gigantron/version.rb
|
39
|
-
script/console
|
40
|
-
script/destroy
|
41
|
-
script/generate
|
42
|
-
script/txt2html
|
43
|
-
setup.rb
|
44
|
-
tasks/deployment.rake
|
45
|
-
tasks/environment.rake
|
46
|
-
tasks/website.rake
|
47
|
-
test/template_database.yml
|
48
|
-
test/template_database.yml.example
|
49
|
-
test/template_migration.rb
|
50
|
-
test/test_generator_helper.rb
|
51
|
-
test/test_gigantron.rb
|
52
|
-
test/test_gigantron_generator.rb
|
53
|
-
test/test_helper.rb
|
54
|
-
test/test_mapreduce_task_generator.rb
|
55
|
-
test/test_migration_generator.rb
|
56
|
-
test/test_model_generator.rb
|
57
|
-
test/test_task_generator.rb
|
58
|
-
website/index.html
|
59
|
-
website/index.txt
|
60
|
-
website/javascripts/rounded_corners_lite.inc.js
|
61
|
-
website/stylesheets/screen.css
|
62
|
-
website/template.html.erb
|
data/PostInstall.txt
DELETED
data/README.txt
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
= Gigantron: Processor of Data
|
2
|
-
|
3
|
-
http://gigantron.rubyforge.org
|
4
|
-
http://github.com/schleyfox/gigantron
|
5
|
-
|
6
|
-
== DESCRIPTION:
|
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 ActiveRecord* models.
|
11
|
-
|
12
|
-
* Will switch back to DataMapper once it plays nice with JRuby
|
13
|
-
|
14
|
-
== FEATURES/PROBLEMS:
|
15
|
-
|
16
|
-
Features:
|
17
|
-
* Generates folder/file structure for new DP projects
|
18
|
-
* Contains generators for both models and tasks
|
19
|
-
|
20
|
-
== SYNOPSIS:
|
21
|
-
|
22
|
-
Use:
|
23
|
-
|
24
|
-
shell> $ gigantron projectname
|
25
|
-
|
26
|
-
to generate the project folder and then
|
27
|
-
|
28
|
-
shell> $ script/generate model modelname
|
29
|
-
|
30
|
-
OR
|
31
|
-
|
32
|
-
shell> $ script/generate task taskname
|
33
|
-
|
34
|
-
to add code.
|
35
|
-
|
36
|
-
== REQUIREMENTS:
|
37
|
-
|
38
|
-
* RubyGems
|
39
|
-
* RubiGen
|
40
|
-
* Rake
|
41
|
-
* ActiveRecord
|
42
|
-
* ActiveSupport
|
43
|
-
* Shoulda
|
44
|
-
|
45
|
-
== INSTALL:
|
46
|
-
|
47
|
-
sudo gem install gigantron
|
48
|
-
|
49
|
-
== HACKING:
|
50
|
-
|
51
|
-
Check out the website for a quick overview of how to fiddle with the generators
|
52
|
-
behind Gigantron. http://gigantron.rubyforge.org.
|
53
|
-
|
54
|
-
== LICENSE:
|
55
|
-
|
56
|
-
(The MIT License)
|
57
|
-
|
58
|
-
Copyright (c) 2008 Ben Hughes
|
59
|
-
|
60
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
61
|
-
a copy of this software and associated documentation files (the
|
62
|
-
'Software'), to deal in the Software without restriction, including
|
63
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
64
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
65
|
-
permit persons to whom the Software is furnished to do so, subject to
|
66
|
-
the following conditions:
|
67
|
-
|
68
|
-
The above copyright notice and this permission notice shall be
|
69
|
-
included in all copies or substantial portions of the Software.
|
70
|
-
|
71
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
72
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
73
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
74
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
75
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
76
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
77
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
DELETED
@@ -1,81 +0,0 @@
|
|
1
|
-
class GigantronGenerator < RubiGen::Base
|
2
|
-
|
3
|
-
DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
|
4
|
-
Config::CONFIG['ruby_install_name'])
|
5
|
-
|
6
|
-
default_options :author => nil
|
7
|
-
|
8
|
-
attr_reader :name
|
9
|
-
|
10
|
-
def initialize(runtime_args, runtime_options = {})
|
11
|
-
super
|
12
|
-
usage if args.empty?
|
13
|
-
@destination_root = File.expand_path(args.shift)
|
14
|
-
@name = base_name
|
15
|
-
extract_options
|
16
|
-
end
|
17
|
-
|
18
|
-
def manifest
|
19
|
-
record do |m|
|
20
|
-
# Ensure appropriate folder(s) exists
|
21
|
-
m.directory ''
|
22
|
-
BASEDIRS.each { |path| m.directory path }
|
23
|
-
|
24
|
-
# Create stubs
|
25
|
-
m.file "Rakefile", "Rakefile"
|
26
|
-
m.file "database.yml", "database.yml"
|
27
|
-
m.file "initialize.rb", "initialize.rb"
|
28
|
-
|
29
|
-
m.file "tasks/import.rake", "tasks/import.rake"
|
30
|
-
|
31
|
-
m.file "test/test_helper.rb", "test/test_helper.rb"
|
32
|
-
|
33
|
-
m.directory "test/models"
|
34
|
-
m.directory "test/tasks"
|
35
|
-
|
36
|
-
m.file "test/tasks/test_import.rb", "test/tasks/test_import.rb"
|
37
|
-
|
38
|
-
|
39
|
-
m.dependency "install_rubigen_scripts", [destination_root, 'gigantron'],
|
40
|
-
:shebang => options[:shebang], :collision => :force
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
protected
|
45
|
-
def banner
|
46
|
-
<<-EOS
|
47
|
-
Creates a ...
|
48
|
-
|
49
|
-
USAGE: #{spec.name} name
|
50
|
-
EOS
|
51
|
-
end
|
52
|
-
|
53
|
-
def add_options!(opts)
|
54
|
-
opts.separator ''
|
55
|
-
opts.separator 'Options:'
|
56
|
-
# For each option below, place the default
|
57
|
-
# at the top of the file next to "default_options"
|
58
|
-
# opts.on("-a", "--author=\"Your Name\"", String,
|
59
|
-
# "Some comment about this option",
|
60
|
-
# "Default: none") { |options[:author]| }
|
61
|
-
opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
|
62
|
-
end
|
63
|
-
|
64
|
-
def extract_options
|
65
|
-
# for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
|
66
|
-
# Templates can access these value via the attr_reader-generated methods, but not the
|
67
|
-
# raw instance variable value.
|
68
|
-
# @author = options[:author]
|
69
|
-
end
|
70
|
-
|
71
|
-
# Installation skeleton. Intermediate directories are automatically
|
72
|
-
# created so don't sweat their absence here.
|
73
|
-
BASEDIRS = %w(
|
74
|
-
tasks
|
75
|
-
db
|
76
|
-
models
|
77
|
-
lib
|
78
|
-
test
|
79
|
-
log
|
80
|
-
)
|
81
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# This file handles all the background initialization work that the programmer
|
2
|
-
# shouldn't have to worry about.
|
3
|
-
# This includes database startup, common requires, activesupport, and other
|
4
|
-
# magic. I'm not sure if this is a good idea or not.
|
5
|
-
|
6
|
-
# ENV works like in rails, except is :real or :test
|
7
|
-
GTRON_ENV rescue GTRON_ENV = :real
|
8
|
-
|
9
|
-
GTRON_ROOT = File.dirname(__FILE__)
|
10
|
-
|
11
|
-
require 'rubygems'
|
12
|
-
require 'rake'
|
13
|
-
|
14
|
-
require 'activesupport'
|
15
|
-
#set up autoload paths
|
16
|
-
Dependencies.load_paths << "#{GTRON_ROOT}/lib/"
|
17
|
-
|
18
|
-
require 'active_record'
|
19
|
-
|
20
|
-
|
21
|
-
def get_db_conn(env)
|
22
|
-
env = env.to_sym
|
23
|
-
#set up logging
|
24
|
-
ActiveRecord::Base.logger = Logger.new("#{GTRON_ROOT}/log/#{env}.log")
|
25
|
-
|
26
|
-
#load in dbs from database.yml
|
27
|
-
ActiveRecord::Base.establish_connection(
|
28
|
-
YAML::load(File.read("#{GTRON_ROOT}/database.yml"))[env])
|
29
|
-
|
30
|
-
#load all models
|
31
|
-
Dir["#{GTRON_ROOT}/models/**/*.rb"].each {|r| load r }
|
32
|
-
|
33
|
-
nil
|
34
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
desc "Import data into the database"
|
2
|
-
task :import do
|
3
|
-
# Acquire your data (e.g. from input/ or something) and parse it into
|
4
|
-
# your database. Your models should probably be the ones doing the heavy
|
5
|
-
# lifting on this one.
|
6
|
-
#
|
7
|
-
# Ex:
|
8
|
-
# Foo.import_yaml(FileList["input/*.yml"].to_a)
|
9
|
-
get_db_conn(ENV["GTRON_ENV"] || GTRON_ENV)
|
10
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
|
-
|
3
|
-
class TestImport < Test::Unit::TestCase
|
4
|
-
def setup
|
5
|
-
get_db_conn(GTRON_ENV)
|
6
|
-
@rake = Rake::Application.new
|
7
|
-
Rake.application = @rake
|
8
|
-
load File.dirname(__FILE__) + '/../../tasks/import.rake'
|
9
|
-
end
|
10
|
-
|
11
|
-
should "import data" do
|
12
|
-
# Testing rake is a bit different
|
13
|
-
# http://blog.nicksieger.com/articles/2007/06/11/test-your-rake-tasks
|
14
|
-
# Example:
|
15
|
-
# @rake["task_name"].invoke
|
16
|
-
@rake["import"].invoke
|
17
|
-
assert true
|
18
|
-
end
|
19
|
-
|
20
|
-
def teardown
|
21
|
-
Rake.application = nil
|
22
|
-
end
|
23
|
-
end
|
data/bin/gigantron
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rubigen'
|
3
|
-
|
4
|
-
if %w(-v --version).include? ARGV.first
|
5
|
-
require 'gigantron/version'
|
6
|
-
puts "#{File.basename($0)} #{Gigantron::VERSION::STRING}"
|
7
|
-
exit(0)
|
8
|
-
end
|
9
|
-
|
10
|
-
require 'rubigen/scripts/generate'
|
11
|
-
source = RubiGen::PathSource.new(:application,
|
12
|
-
File.join(File.dirname(__FILE__), "../app_generators"))
|
13
|
-
RubiGen::Base.reset_sources
|
14
|
-
RubiGen::Base.append_sources source
|
15
|
-
RubiGen::Scripts::Generate.new.run(ARGV, :generator => 'gigantron')
|