プロジェクトの作成

C:\WINDOWS\system32>cd E:\tmp

C:\WINDOWS\system32>e:

E:\tmp>mkdir schduler

E:\tmp>cd schduler

E:\tmp\schduler>cd ../

E:\tmp>rmdir schduler

E:\tmp>rails scheduler --database=sqlite3
create
create app/controllers
create app/helpers
create app/models
create app/views/layouts
create config/environments
create components
create db
create doc
create lib
create lib/tasks
create log
create public/images
create public/javascripts
create public/stylesheets
create script/performance
create script/process
create test/fixtures
create test/functional
create test/integration
create test/mocks/development
create test/mocks/test
create test/unit
create vendor
create vendor/plugins
create tmp/sessions
create tmp/sockets
create tmp/cache
create tmp/pids
create Rakefile
create README
create app/controllers/application.rb
create app/helpers/application_helper.rb
create test/test_helper.rb
create config/database.yml
create config/routes.rb
create public/.htaccess
create config/boot.rb
create config/environment.rb
create config/environments/production.rb
create config/environments/development.rb
create config/environments/test.rb
create script/about
create script/breakpointer
create script/console
create script/destroy
create script/generate
create script/performance/benchmarker
create script/performance/profiler
create script/process/reaper
create script/process/spawner
create script/process/inspector
create script/runner
create script/server
create script/plugin
create public/dispatch.rb
create public/dispatch.cgi
create public/dispatch.fcgi
create public/404.html
create public/500.html
create public/index.html
create public/favicon.ico
create public/robots.txt
create public/images/rails.png
create public/javascripts/prototype.js
create public/javascripts/effects.js
create public/javascripts/dragdrop.js
create public/javascripts/controls.js
create public/javascripts/application.js
create doc/README_FOR_APP
create log/server.log
create log/production.log
create log/development.log
create log/test.log

E:\tmp>cd scheduler

プロジェクトのディレクトリは勝手に作ってくれるので、E:\tmp\schedulerとか作る必要はない。

E:\tmp\scheduler>dir
ドライブ E のボリューム ラベルは ローカル ディスク です
ボリューム シリアル番号は D048-737D です

E:\tmp\scheduler のディレクト

2007/07/20 08:44

. 2007/07/20 08:44 .. 2007/07/20 08:44 app 2007/07/20 08:44 components 2007/07/20 08:44 config 2007/07/20 08:44 db 2007/07/20 08:44 doc 2007/07/20 08:44 lib 2007/07/20 08:44 log 2007/07/20 08:44 public 2007/07/20 08:44 307 Rakefile 2007/07/20 08:44 8,001 README 2007/07/20 08:44 script 2007/07/20 08:44 test 2007/07/20 08:44 tmp 2007/07/20 08:44 vendor 2 個のファイル 8,308 バイト 14 個のディレクトリ 24,802,045,952 バイトの空き領域 E:\tmp\scheduler>take -T 'take' は、内部コマンドまたは外部コマンド、 操作可能なプログラムまたはバッチ ファイルとして認識されていません。 E:\tmp\scheduler>rake -T (in E:/tmp/scheduler) rake db:fixtures:load # Load fixtures into the current environment's d tabase. Load specific fixtures using FIXTURES=x,y rake db:migrate # Migrate the database through scripts in db/mig ate. Target specific version with VERSION=x rake db:schema:dump # Create a db/schema.rb file that can be portabl used against any DB supported by AR rake db:schema:load # Load a schema.rb file into the database rake db:sessions:clear # Clear the sessions table rake db:sessions:create # Creates a sessions table for use with CGI::Ses ion::ActiveRecordStore rake db:structure:dump # Dump the database structure to a SQL file rake db:test:clone # Recreate the test database from the current en ironment's database schema rake db:test:clone_structure # Recreate the test databases from the developme t structure rake db:test:prepare # Prepare the test database and load the schema rake db:test:purge # Empty the test database rake doc:app # Build the app HTML Files rake doc:clobber_app # Remove rdoc products rake doc:clobber_plugins # Remove plugin documentation rake doc:clobber_rails # Remove rdoc products rake doc:plugins # Generate documation for all installed plugins rake doc:rails # Build the rails HTML Files rake doc:reapp # Force a rebuild of the RDOC files rake doc:rerails # Force a rebuild of the RDOC files rake log:clear # Truncates all *.log files in log/ to zero byte rake rails:freeze:edge # Lock to latest Edge Rails or a specific revisi n with REVISION=X (ex: REVISION=4021) or a tag with TAG=Y (ex: TAG=rel_1-1-0) rake rails:freeze:gems # Lock this application to the current gems (by npacking them into vendor/rails) rake rails:unfreeze # Unlock this application from freeze of gems or edge and return to a fluid use of system gems rake rails:update # Update both configs, scripts and public/javasc ipts from Rails rake rails:update:configs # Update config/boot.rb from your current rails nstall rake rails:update:javascripts # Update your javascripts from your current rail install rake rails:update:scripts # Add new scripts to the application script/ dir ctory rake stats # Report code statistics (KLOCs, etc) from the a plication rake test # Test all units and functionals rake test:functionals # Run the functional tests in test/functional rake test:integration # Run the integration tests in test/integration rake test:plugins # Run the plugin tests in vendor/plugins/**/test (or specify with PLUGIN=name) rake test:recent # Test recent changes rake test:uncommitted # Test changes since last checkin (only Subversi n) rake test:units # Run the unit tests in test/unit rake tmp:cache:clear # Clears all files and directories in tmp/cache rake tmp:clear # Clear session, cache, and socket files from tm / rake tmp:create # Creates tmp directories for sessions, cache, a d sockets rake tmp:pids:clear # Clears all files in tmp/pids rake tmp:sessions:clear # Clears all files in tmp/sessions rake tmp:sockets:clear # Clears all files in tmp/sockets E:\tmp\scheduler>ruby script\generate migration create_schedules create db/migrate create db/migrate/001_create_schedules.rb

で、E:\tmp\scheduler\db\migrate\001_create_schedules.rbにDB定義を作成する。

class CreateSchedules < ActiveRecord::Migration
def self.up
create_table(:schedules) do |table|
table.column(:datatime, :timestamp)
table.column(:title, :string)
table.column(:content, :text)
end
end

def self.down
drop_table(:schedules)
end
end

 なんとなくはわかるのだけど、この、前に:のついた書き方って何なのでしょう?
わかっていなくても話が前に進むのがちょっと気持ち悪い。

E:\tmp\scheduler>rake db:migrate --trace
(in E:/tmp/scheduler)
E:0:Warning: require_gem is obsolete. Use gem instead.

Invoke db:migrate (first_time)

Invoke environment (first_time)

Execute environment

Execute db:migrate

== CreateSchedules: migrating =================================================

    • create_table(:schedules)

-> 0.0600s
== CreateSchedules: migrated (0.0600s) ========================================

Invoke db:schema:dump (first_time)

Invoke environment

Execute db:schema:dump

でもDBはできてしまう。SQLite_Database_Browserで覗いたら、ちゃんとできていました。

一日目、終わり。