michaelbarton-gigantron 0.1.6 → 0.1.7
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.
- data/Rakefile +2 -0
- data/VERSION.yml +1 -1
- data/templates/migration/db/migrate/migration.rb +7 -0
- data/templates/model/models/model.rb +3 -0
- data/templates/model/test/models/test_model.rb +13 -0
- data/templates/project/Rakefile +12 -0
- data/templates/project/database.yml.example +9 -0
- data/templates/project/initialize.rb +31 -0
- data/templates/project/tasks/import.rake +10 -0
- data/templates/project/test/tasks/test_import.rb +23 -0
- data/templates/project/test/test_helper.rb +8 -0
- data/templates/task/tasks/task.rake +4 -0
- data/templates/task/test/tasks/test_task.rb +22 -0
- metadata +14 -3
data/Rakefile
CHANGED
data/VERSION.yml
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
|
+
|
3
|
+
class Test<%= name.camelcase %> < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
get_db_conn(GTRON_ENV)
|
6
|
+
Gigantron.migrate_dbs
|
7
|
+
end
|
8
|
+
|
9
|
+
#replace with real tests
|
10
|
+
should "be true" do
|
11
|
+
assert true
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,31 @@
|
|
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
|
+
GTRON_ROOT = File.dirname(__FILE__)
|
9
|
+
|
10
|
+
#set up autoload paths
|
11
|
+
$: << "#{GTRON_ROOT}/lib/"
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'rake'
|
15
|
+
|
16
|
+
require 'active_record'
|
17
|
+
|
18
|
+
def get_db_conn(env)
|
19
|
+
env = env.to_sym
|
20
|
+
#set up logging
|
21
|
+
ActiveRecord::Base.logger = Logger.new("#{GTRON_ROOT}/log/#{env}.log")
|
22
|
+
|
23
|
+
#load in dbs from database.yml
|
24
|
+
ActiveRecord::Base.establish_connection(
|
25
|
+
YAML::load(File.read("#{GTRON_ROOT}/database.yml"))[env])
|
26
|
+
|
27
|
+
#load all models
|
28
|
+
Dir["#{GTRON_ROOT}/models/**/*.rb"].each {|r| load r }
|
29
|
+
|
30
|
+
nil
|
31
|
+
end
|
@@ -0,0 +1,10 @@
|
|
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
|
@@ -0,0 +1,23 @@
|
|
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
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
|
+
|
3
|
+
class Test<%= name.camelcase %> < 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/<%= name %>.rake'
|
9
|
+
end
|
10
|
+
|
11
|
+
should "be true" 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
|
+
assert true
|
17
|
+
end
|
18
|
+
|
19
|
+
def teardown
|
20
|
+
Rake.application = nil
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: michaelbarton-gigantron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Hughes
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-05-
|
12
|
+
date: 2009-05-18 00:00:00 -07:00
|
13
13
|
default_executable: gigantron
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -85,7 +85,18 @@ files:
|
|
85
85
|
- lib/gigantron/tasks/db.rb
|
86
86
|
- lib/gigantron/tasks/test.rb
|
87
87
|
- lib/gigantron/version.rb
|
88
|
-
|
88
|
+
- templates/migration/db/migrate/migration.rb
|
89
|
+
- templates/model/models/model.rb
|
90
|
+
- templates/model/test/models/test_model.rb
|
91
|
+
- templates/project/Rakefile
|
92
|
+
- templates/project/database.yml.example
|
93
|
+
- templates/project/initialize.rb
|
94
|
+
- templates/project/tasks/import.rake
|
95
|
+
- templates/project/test/tasks/test_import.rb
|
96
|
+
- templates/project/test/test_helper.rb
|
97
|
+
- templates/task/tasks/task.rake
|
98
|
+
- templates/task/test/tasks/test_task.rb
|
99
|
+
has_rdoc: false
|
89
100
|
homepage: http://github.com/schleyfox/gigantron
|
90
101
|
post_install_message:
|
91
102
|
rdoc_options:
|