diff --git a/History.rdoc b/History.rdoc deleted file mode 100644 index 8e49c76..0000000 --- a/History.rdoc +++ /dev/null @@ -1,23 +0,0 @@ -=== 0.10.1 / 2009-09-30 - -* No changes this version - -=== 0.10.0 / 2009-09-15 - -* Updated to work with dm-core 0.10.0 - -=== 0.9.11 / 2009-03-29 - -* No changes this version - -=== 0.9.10 / 2009-01-19 - -* No changes this version - -=== 0.9.9 / 2009-01-04 - -* No changes this version - -=== 0.9.8 / 2008-12-07 - -* No changes this version diff --git a/LICENSE b/LICENSE index baba120..0e8db7e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2007 Paul Sadauskas +Copyright (c) 2009 Paul Sadauskas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/Manifest.txt b/Manifest.txt deleted file mode 100644 index ca28625..0000000 --- a/Manifest.txt +++ /dev/null @@ -1,41 +0,0 @@ -History.rdoc -LICENSE -Manifest.txt -README.rdoc -Rakefile -TODO -db/migrations/1_create_people_table.rb -db/migrations/2_add_dob_to_people.rb -db/migrations/config.rb -examples/sample_migration.rb -examples/sample_migration_spec.rb -lib/dm-migrations.rb -lib/dm-migrations/migration.rb -lib/dm-migrations/migration_runner.rb -lib/dm-migrations/sql.rb -lib/dm-migrations/sql/column.rb -lib/dm-migrations/sql/mysql.rb -lib/dm-migrations/sql/postgresql.rb -lib/dm-migrations/sql/sqlite3.rb -lib/dm-migrations/sql/table.rb -lib/dm-migrations/sql/table_creator.rb -lib/dm-migrations/sql/table_modifier.rb -lib/dm-migrations/version.rb -lib/spec/example/migration_example_group.rb -lib/spec/matchers/migration_matchers.rb -spec/integration/migration_runner_spec.rb -spec/integration/migration_spec.rb -spec/integration/sql_spec.rb -spec/spec.opts -spec/spec_helper.rb -spec/unit/migration_spec.rb -spec/unit/sql/column_spec.rb -spec/unit/sql/postgresql_spec.rb -spec/unit/sql/sqlite3_extensions_spec.rb -spec/unit/sql/table_creator_spec.rb -spec/unit/sql/table_modifier_spec.rb -spec/unit/sql/table_spec.rb -spec/unit/sql_spec.rb -tasks/db.rb -tasks/install.rb -tasks/spec.rb diff --git a/Rakefile b/Rakefile index 6c0638f..da8bb44 100644 --- a/Rakefile +++ b/Rakefile @@ -1,24 +1,31 @@ -require 'pathname' +require 'rubygems' +require 'rake' -ROOT = Pathname(__FILE__).dirname.expand_path -JRUBY = RUBY_PLATFORM =~ /java/ -WINDOWS = Gem.win_platform? || (JRUBY && ENV_JAVA['os.name'] =~ /windows/i) -SUDO = WINDOWS ? '' : ('sudo' unless ENV['SUDOLESS']) +FileList['tasks/**/*.rake'].each { |task| load task } -require ROOT + 'lib/dm-migrations/version' +begin + require 'jeweler' -AUTHOR = 'Paul Sadauskas' -EMAIL = 'psadauskas [a] gmail [d] com' -GEM_NAME = 'dm-migrations' -GEM_VERSION = DataMapper::Migration::VERSION -GEM_DEPENDENCIES = [['dm-core', GEM_VERSION]] -GEM_CLEAN = %w[ log pkg coverage ] -GEM_EXTRAS = { :has_rdoc => true, :extra_rdoc_files => %w[ README.rdoc LICENSE TODO History.rdoc ] } + Jeweler::Tasks.new do |gem| + gem.name = 'dm-migrations' + gem.summary = 'DataMapper plugin for writing and speccing migrations' + gem.description = gem.summary + gem.email = 'psadauskas [a] gmail [d] com' + gem.homepage = 'http://github.com/datamapper/dm-more/tree/master/%s' % gem.name + gem.authors = [ 'Paul Sadauskas' ] -PROJECT_NAME = 'datamapper' -PROJECT_URL = "http://github.com/datamapper/dm-more/tree/master/#{GEM_NAME}" -PROJECT_DESCRIPTION = PROJECT_SUMMARY = 'DataMapper plugin for writing and speccing migrations' + gem.rubyforge_project = 'datamapper' -[ ROOT, ROOT.parent ].each do |dir| - Pathname.glob(dir.join('tasks/**/*.rb').to_s).each { |f| require f } + gem.add_dependency 'dm-core', '~>0.10.2' + + gem.add_development_dependency 'rspec', '>= 1.2.9' + gem.add_development_dependency 'yard', '>= 0.4.0' + end + + Jeweler::GemcutterTasks.new + Jeweler::RubyforgeTasks.new do |rubyforge| + rubyforge.doc_task = 'yardoc' + end +rescue LoadError + puts 'Jeweler (or a dependency) not available. Install it with: gem install jeweler' end diff --git a/TODO b/TODO deleted file mode 100644 index e69de29..0000000 diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..5eef0f1 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.10.2 diff --git a/dm-migrations.gemspec b/dm-migrations.gemspec new file mode 100644 index 0000000..6186e54 --- /dev/null +++ b/dm-migrations.gemspec @@ -0,0 +1,81 @@ +# Generated by jeweler +# DO NOT EDIT THIS FILE DIRECTLY +# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{dm-migrations} + s.version = "0.10.2" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Paul Sadauskas"] + s.date = %q{2009-11-23} + s.description = %q{DataMapper plugin for writing and speccing migrations} + s.email = %q{psadauskas [a] gmail [d] com} + s.extra_rdoc_files = [ + "LICENSE", + "README.rdoc" + ] + s.files = [ + "LICENSE", + "README.rdoc", + "Rakefile", + "db/migrations/1_create_people_table.rb", + "db/migrations/2_add_dob_to_people.rb", + "db/migrations/config.rb", + "examples/sample_migration.rb", + "examples/sample_migration_spec.rb", + "lib/dm-migrations.rb", + "lib/dm-migrations/migration.rb", + "lib/dm-migrations/migration_runner.rb", + "lib/dm-migrations/sql.rb", + "lib/dm-migrations/sql/column.rb", + "lib/dm-migrations/sql/mysql.rb", + "lib/dm-migrations/sql/postgresql.rb", + "lib/dm-migrations/sql/sqlite3.rb", + "lib/dm-migrations/sql/table.rb", + "lib/dm-migrations/sql/table_creator.rb", + "lib/dm-migrations/sql/table_modifier.rb", + "lib/spec/example/migration_example_group.rb", + "lib/spec/matchers/migration_matchers.rb", + "spec/integration/migration_runner_spec.rb", + "spec/integration/migration_spec.rb", + "spec/integration/sql_spec.rb", + "spec/spec.opts", + "spec/spec_helper.rb", + "spec/unit/migration_spec.rb", + "spec/unit/sql/column_spec.rb", + "spec/unit/sql/postgresql_spec.rb", + "spec/unit/sql/sqlite3_extensions_spec.rb", + "spec/unit/sql/table_creator_spec.rb", + "spec/unit/sql/table_modifier_spec.rb", + "spec/unit/sql/table_spec.rb", + "spec/unit/sql_spec.rb" + ] + s.homepage = %q{http://github.com/datamapper/dm-more/tree/master/dm-migrations} + s.rdoc_options = ["--charset=UTF-8"] + s.require_paths = ["lib"] + s.rubyforge_project = %q{datamapper} + s.rubygems_version = %q{1.3.5} + s.summary = %q{DataMapper plugin for writing and speccing migrations} + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then + s.add_runtime_dependency(%q, ["~> 0.10.2"]) + s.add_development_dependency(%q, [">= 1.2.9"]) + s.add_development_dependency(%q, [">= 0.4.0"]) + else + s.add_dependency(%q, ["~> 0.10.2"]) + s.add_dependency(%q, [">= 1.2.9"]) + s.add_dependency(%q, [">= 0.4.0"]) + end + else + s.add_dependency(%q, ["~> 0.10.2"]) + s.add_dependency(%q, [">= 1.2.9"]) + s.add_dependency(%q, [">= 0.4.0"]) + end +end + diff --git a/lib/dm-migrations/version.rb b/lib/dm-migrations/version.rb deleted file mode 100644 index 2bfa0a5..0000000 --- a/lib/dm-migrations/version.rb +++ /dev/null @@ -1,5 +0,0 @@ -module DataMapper - class Migration - VERSION = '0.10.2'.freeze - end -end diff --git a/spec/rcov.opts b/spec/rcov.opts new file mode 100644 index 0000000..126e4ea --- /dev/null +++ b/spec/rcov.opts @@ -0,0 +1,6 @@ +--exclude "spec" +--sort coverage +--callsites +--xrefs +--profile +--text-summary diff --git a/tasks/ci.rake b/tasks/ci.rake new file mode 100644 index 0000000..2c1fd97 --- /dev/null +++ b/tasks/ci.rake @@ -0,0 +1 @@ +task :ci => [ :verify_measurements, 'metrics:all' ] diff --git a/tasks/db.rb b/tasks/db.rb deleted file mode 100644 index 2dce33b..0000000 --- a/tasks/db.rb +++ /dev/null @@ -1,22 +0,0 @@ -namespace :db do - - # pass the relative path to the migrations directory by MIGRATION_DIR - task :setup_migration_dir do - unless defined?(MIGRATION_DIR) - migration_dir = ENV["MIGRATION_DIR"] || File.join("db", "migrations") - MIGRATION_DIR = File.expand_path(File.join(File.dirname(__FILE__), migration_dir)) - end - FileUtils.mkdir_p MIGRATION_DIR - end - - # set DIRECTION to migrate down - desc "Run your system's migrations" - task :migrate => [:setup_migration_dir] do - require 'dm-migrations/migration_runner.rb' - require File.expand_path(File.join(MIGRATION_DIR, "config.rb")) - - Dir[File.join(MIGRATION_DIR, "*.rb")].each { |file| require file } - - ENV["DIRECTION"] != "down" ? migrate_up! : migrate_down! - end -end diff --git a/tasks/install.rb b/tasks/install.rb deleted file mode 100644 index 11c59a5..0000000 --- a/tasks/install.rb +++ /dev/null @@ -1,13 +0,0 @@ -def sudo_gem(cmd) - sh "#{SUDO} #{RUBY} -S gem #{cmd}", :verbose => false -end - -desc "Install #{GEM_NAME} #{GEM_VERSION}" -task :install => [ :package ] do - sudo_gem "install pkg/#{GEM_NAME}-#{GEM_VERSION}" -end - -desc "Uninstall #{GEM_NAME} #{GEM_VERSION}" -task :uninstall => [ :clobber ] do - sudo_gem "uninstall #{GEM_NAME} -v#{GEM_VERSION} -Ix" -end diff --git a/tasks/metrics.rake b/tasks/metrics.rake new file mode 100644 index 0000000..f7e1ccc --- /dev/null +++ b/tasks/metrics.rake @@ -0,0 +1,36 @@ +begin + require 'metric_fu' +rescue LoadError + namespace :metrics do + task :all do + abort 'metric_fu is not available. In order to run metrics:all, you must: gem install metric_fu' + end + end +end + +begin + require 'reek/adapters/rake_task' + + Reek::RakeTask.new do |t| + t.fail_on_error = true + t.verbose = false + t.source_files = 'lib/**/*.rb' + end +rescue LoadError + task :reek do + abort 'Reek is not available. In order to run reek, you must: gem install reek' + end +end + +begin + require 'roodi' + require 'roodi_task' + + RoodiTask.new do |t| + t.verbose = false + end +rescue LoadError + task :roodi do + abort 'Roodi is not available. In order to run roodi, you must: gem install roodi' + end +end diff --git a/tasks/spec.rake b/tasks/spec.rake new file mode 100644 index 0000000..a81c155 --- /dev/null +++ b/tasks/spec.rake @@ -0,0 +1,25 @@ +require 'spec/rake/spectask' +require 'spec/rake/verify_rcov' + +spec_defaults = lambda do |spec| + spec.pattern = 'spec/**/*_spec.rb' + spec.libs << 'lib' << 'spec' + spec.spec_opts << '--options' << 'spec/spec.opts' +end + +Spec::Rake::SpecTask.new(:spec, &spec_defaults) + +Spec::Rake::SpecTask.new(:rcov) do |rcov| + spec_defaults.call(rcov) + rcov.rcov = true + rcov.rcov_opts = File.read('spec/rcov.opts').split(/\s+/) +end + +RCov::VerifyTask.new(:verify_rcov => :rcov) do |rcov| + rcov.threshold = 100 +end + +task :spec => :check_dependencies +task :rcov => :check_dependencies + +task :default => :spec diff --git a/tasks/spec.rb b/tasks/spec.rb deleted file mode 100644 index 166594c..0000000 --- a/tasks/spec.rb +++ /dev/null @@ -1,25 +0,0 @@ -begin - require 'spec/rake/spectask' - - task :default => [ :spec ] - - desc 'Run specifications' - Spec::Rake::SpecTask.new(:spec) do |t| - t.spec_opts << '--options' << 'spec/spec.opts' if File.exists?('spec/spec.opts') - t.libs << 'lib' << 'spec' # needed for CI rake spec task, duplicated in spec_helper - - begin - require 'rcov' - t.rcov = JRUBY ? false : (ENV.has_key?('NO_RCOV') ? ENV['NO_RCOV'] != 'true' : true) - t.rcov_opts << '--exclude' << 'spec' - t.rcov_opts << '--text-summary' - t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse' - rescue LoadError - # rcov not installed - rescue SyntaxError - # rcov syntax invalid - end - end -rescue LoadError - # rspec not installed -end diff --git a/tasks/yard.rake b/tasks/yard.rake new file mode 100644 index 0000000..a276870 --- /dev/null +++ b/tasks/yard.rake @@ -0,0 +1,9 @@ +begin + require 'yard' + + YARD::Rake::YardocTask.new +rescue LoadError + task :yard do + abort 'YARD is not available. In order to run yard, you must: gem install yard' + end +end diff --git a/tasks/yardstick.rake b/tasks/yardstick.rake new file mode 100644 index 0000000..8d954b0 --- /dev/null +++ b/tasks/yardstick.rake @@ -0,0 +1,19 @@ +begin + require 'pathname' + require 'yardstick/rake/measurement' + require 'yardstick/rake/verify' + + # yardstick_measure task + Yardstick::Rake::Measurement.new + + # verify_measurements task + Yardstick::Rake::Verify.new do |verify| + verify.threshold = 100 + end +rescue LoadError + %w[ yardstick_measure verify_measurements ].each do |name| + task name.to_s do + abort "Yardstick is not available. In order to run #{name}, you must: gem install yardstick" + end + end +end