aws-sdk-ruby 確認
なんか buldler ってソレで gem 作れまっせ的情報を確認しつつこちらの実装確認したりなど。vpc を云々するソレを gem にしたいなぁ、とか思っているのでそれを意識しつつ掘削してみることに。
テストドリブンで作りたいよな、と言いつつ aws-sdk-ruby な rake -T を確認。あ、bundle exec rake -T なのかな。
$ rake -T rake docs:package # Builds a distributable documentation zip file at ./pkg/aws-docs.zip rake docs:yard # Generate YARD Documentation rake features # Run Cucumber features rake spec # Run RSpec code examples rake suite # Runs tests across RVM Rubies: 1.8.7,ree,1.9.3,1.9.2,jruby rake suite:deps # Installs dependencies in Gemfile using Bundler for suite $ bundle exec rake -T rake docs:package # Builds a distributable documentation zip file at ./pkg/aws-docs.zip rake docs:yard # Generate YARD Documentation rake features # Run Cucumber features rake spec # Run RSpec code examples rake suite # Runs tests across RVM Rubies: 1.8.7,ree,1.9.3,1.9.2,jruby rake suite:deps # Installs dependencies in Gemfile using Bundler for suite
ま、同じか。で、このルールはどこで何が、ということで Rakefile 確認。以下な記述になっていますね。
root = File.dirname(__FILE__) tasks_dir = File.join(root, "tasks") $:.unshift(tasks_dir) $:.unshift(File.join(root, "lib")) require 'aws/core' # for the version number Dir[File.join(tasks_dir, "**", "*.rake")].each do |task_file| load task_file end # Vendor tasks Dir[File.join(root, 'vendor', '*', 'Rakefile')].each do |vendor_rakefile| load vendor_rakefile end task :default => :spec
tasks_dir は tasks でデフォな task は :spec となってます。読み込み対象なのは
- tasks 配下の *.rake
- vendor 配下の Rakefile
なのかな。unshift がなんちゃらとかなあたりが微妙。で、tasks 配下が以下らしい。
$ ls tasks cucumber.rake docs.rake rspec.rake rvm_tester.rake
tasks/rspec.rake の中身が以下か。
desc 'Run RSpec code examples' task :spec do opts = ['rspec', '-c'] if ENV['DEBUG'] $DEBUG = true opts += ['-d'] end opts += FileList["spec/**/*_spec.rb"].sort cmd = opts.join(' ') puts cmd if Rake.application.options.trace system(cmd) raise "Command failed with status (#{$?.to_i}): #{cmd}" if $?.to_i != 0 end
むむ、なんとなく微妙だな。で、bundle exec rake したらもの凄い量の試験が云々されている出力が容赦なく出てきてびっくり。11962 examples らしい。
ちなみに
bundle で新規作成したらどんな Rakefile が出てくるのかな。
$ bundle gem test create test/Gemfile create test/Rakefile create test/LICENSE.txt create test/README.md create test/.gitignore create test/test.gemspec create test/lib/test.rb create test/lib/test/version.rb $ cat test/Rakefile require "bundler/gem_tasks"
README は .md なあたりがアレですね。つうか、上記の Rakefile だと rake release で公開されてしまうのでそれを避けるために云々な know-how が共有されてたりしてorz
でも aws-sdk-ruby もそうなってるのかどうなのか。つうか rake -T で見たとおり、rake release はないですね。。