牌語備忘録 -pygo

あくまでもメモです。なるべくオフィシャルの情報を参照してください。

牌語備忘録 -pygo

Railsコマンドを高速化するらしいgem『Commands』を使ってみるメモ

(Rails3.2.13)

ほかに Spring や Zeus とかありますが、あえて DHH の Commands を使ってみた。

ちなみに Commands は rails console の中で使うものらしい。

確認用下準備

$ rails new commands -T --skip-bundle
$ cd commands
Gemfile
group :development, :test do
  gem 'rspec-rails'
  gem 'commands'
end
$bundle install
$ rails generate scaffold Book title price:integer

普通にrakeコマンドを試してみる

 $ rake routes
 :
 $ rake db:migrate
 :
 $ rake db:rollback

routes も db:migrate も表示されるまで3秒くらいかかった。

Commands 使ってみる。

$ rails console
> rake "routes"
:
> rake "db:migrate"
rake "db:migrate"
   (0.1ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" 
Migrating to CreateBooks (20130519032156)
   (0.1ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" 
=> "Completed"

どちらのコマンドも一瞬で表示された。1秒かからなかった。

Rspec
> generate "rspec:install"
generate "rspec:install"
      create  .rspec
       exist  spec
      create  spec/spec_helper.rb
=> "Completed"
> rake "spec"
rake "spec"
:
Finished in 0.28643 seconds
30 examples, 0 failures, 2 pending

Randomized with seed 34888

=> "Completed"
Rake Tasks
> rake
rake
rake about              # List versions of all Rails frameworks and the env...
rake assets:clean       # Remove compiled assets
rake assets:precompile  # Compile all the assets named in config.assets.pre...
rake db:create          # Create the database from DATABASE_URL or config/d...
rake db:drop            # Drops the database using DATABASE_URL or the curr...
rake db:fixtures:load   # Load fixtures into the current environment's data...
rake db:migrate         # Migrate the database (options: VERSION=x, VERBOSE...
rake db:migrate:status  # Display status of migrations
rake db:rollback        # Rolls the schema back to the previous version (sp...
rake db:schema:dump     # Create a db/schema.rb file that can be portably u...
rake db:schema:load     # Load a schema.rb file into the database
rake db:seed            # Load the seed data from db/seeds.rb
rake db:setup           # Create the database, load the schema, and initial...
rake db:structure:dump  # Dump the database structure to db/structure.sql. ...
rake db:version         # Retrieves the current schema version number
rake doc:app            # Generate docs for the app -- also available doc:r...
rake log:clear          # Truncates all *.log files in log/ to zero bytes
rake middleware         # Prints out your Rack middleware stack
rake notes              # Enumerate all annotations (use notes:optimize, :f...
rake notes:custom       # Enumerate a custom annotation, specify with ANNOT...
rake rails:template     # Applies the template supplied by LOCATION=(/path/...
rake rails:update       # Update configs and some other initially generated...
rake routes             # Print out all defined routes in match order, with...
rake secret             # Generate a cryptographically secure secret key (t...
rake spec               # Run all specs in spec directory (excluding plugin...
rake spec:controllers   # Run the code examples in spec/controllers
rake spec:helpers       # Run the code examples in spec/helpers
rake spec:models        # Run the code examples in spec/models
rake spec:requests      # Run the code examples in spec/requests
rake spec:routing       # Run the code examples in spec/routing
rake spec:views         # Run the code examples in spec/views
rake stats              # Report code statistics (KLOCs, etc) from the appl...
rake time:zones:all     # Displays all time zones, also available: time:zon...
rake tmp:clear          # Clear session, cache, and socket files from tmp/ ...
rake tmp:create         # Creates tmp directories for sessions, cache, sock...
=> "Completed"

感想

シンプルでクールな感じ?
思ったよりいい感じな気がする。