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 CHANGED
@@ -9,6 +9,8 @@ begin
9
9
 
10
10
  s.authors = ["Ben Hughes"]
11
11
  s.email = "ben@pixelmachine.org"
12
+
13
+ s.files = FileList["[A-Z]*", "{bin,templates,lib,test}/**/*","README.markdown"]
12
14
 
13
15
  s.add_dependency('activesupport', '>= 2.0.2')
14
16
  s.add_dependency('templater', '>= 0.5.0')
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :minor: 1
3
- :patch: 6
3
+ :patch: 7
4
4
  :major: 0
@@ -0,0 +1,7 @@
1
+ class <%= name.camelcase %> < ActiveRecord::Migration
2
+ def self.up
3
+ end
4
+
5
+ def self.down
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ class <%= name.camelcase %> < ActiveRecord::Base
2
+
3
+ end
@@ -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,12 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'fileutils'
4
+
5
+ GTRON_ENV = :real
6
+ require 'initialize'
7
+
8
+ require 'gigantron/tasks/test'
9
+ require 'gigantron/tasks/db'
10
+
11
+ Dir['tasks/**/*.rake'].each {|r| load r }
12
+
@@ -0,0 +1,9 @@
1
+ # JRuby
2
+ #:test:
3
+ # :adapter: jdbcsqlite3
4
+ # :url: jdbc:sqlite:db/test.sqlite3
5
+
6
+ # Ruby 1.8
7
+ #:test:
8
+ # :adapter: sqlite3
9
+ # :database: db/test.sqlite3
@@ -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,8 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+
5
+ require 'gigantron/migrator'
6
+ require File.dirname(__FILE__) + '/../initialize'
7
+ silence_warnings { GTRON_ENV = :test }
8
+ ENV['GTRON_ENV'] = 'test'
@@ -0,0 +1,4 @@
1
+ desc "Write a task description and write it good!"
2
+ task :<%= name %> do
3
+ get_db_conn(GTRON_ENV)
4
+ 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.6
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-17 00:00:00 -07:00
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
- has_rdoc: true
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: