Commits

dav...@IMSOELMPC102912  committed e13028a

moved to netbeans for editing

  • Participants
  • Parent commits 3b39026

Comments (0)

Files changed (9)

File StatusWriter/Rakefile

 require 'rake/gempackagetask'
 require 'rake/rdoctask'
 require 'rake/testtask'
+require "rubygems"
+require "active_record"
+require "yaml"
 
 spec = Gem::Specification.new do |s|
   s.name = 'StatusWriter'
 Rake::TestTask.new do |t|
   t.test_files = FileList['test/**/*.rb']
 end
+
+desc "Migrate the database through scripts in migrations"
+task :migrate => :initdb do
+  ActiveRecord::Migrator.migrate("./migrations", ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
+end
+
+task :initdb do
+  dbconfig = YAML::load(File.open( "lib/database.yml" ))
+  ActiveRecord::Base.establish_connection(dbconfig)
+end

File StatusWriter/lib/database.yml

+## YAML Template.
+adapter: sqlite3
+database: projects.db
+

File StatusWriter/lib/database_connection.rb

 require "rubygems"
 require "active_record"
+require "yaml"
 
-ActiveRecord::Base.establish_connection(
-  :adapter => "sqlite3",
-  :database => "../db/task.db"
-)
+dbconfig = YAML::load(File.open( "database.yml"))
+ActiveRecord::Base.establish_connection(dbconfig)

File StatusWriter/migrations/001_create_projects.rb

+# To change this template, choose Tools | Templates
+# and open the template in the editor.
+class CreateProjects < ActiveRecord::Migration
+  def self.up
+    create_table :projects do |t|
+      t.string :name
+      t.text :description      
+    end
+  end
+  def self.down
+    drop_table :projects
+  end
+end

File StatusWriter/nbproject/private/.LCKrake-d.txt~

-C:\ADData\projects\rubylearning\StatusWriter\nbproject\private\rake-d.txt

File StatusWriter/nbproject/private/rake-d.txt

-clean=Remove any temporary products.
-clobber=Remove any generated file.
-clobber_package=Remove package products
-clobber_rdoc=Remove rdoc products
-doc=
-doc/rdoc=
-doc/rdoc/index.html=
-gem=Build the gem file StatusWriter-0.0.1.gem
-package=Build all the packages
-pkg=
-pkg/StatusWriter-0.0.1=
-pkg/StatusWriter-0.0.1.gem=
-pkg/StatusWriter-0.0.1.tgz=
-pkg/StatusWriter-0.0.1.zip=
-rdoc=Build the rdoc HTML Files
-repackage=Force a rebuild of the package files
-rerdoc=Force a rebuild of the RDOC files
-test=Run tests

File StatusWriter/nbproject/project.properties

 source.encoding=UTF-8
 spec.src.dir=spec
 src.dir=lib
+src.migrations.dir=migrations
 test.src.dir=test

File StatusWriter/nbproject/project.xml

         <data xmlns="http://www.netbeans.org/ns/ruby-project/1">
             <name>StatusWriter</name>
             <source-roots>
+                <root id="src.migrations.dir"/>
                 <root id="src.dir"/>
             </source-roots>
             <test-roots>

File StatusWriter/projects.db

Binary file added.