migrate-well 0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ .rvmrc
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in migratewell.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,18 @@
1
+ Copyright (c) 2011 Florent Guilleux
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7
+ the Software, and to permit persons to whom the Software is furnished to do so,
8
+ subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,26 @@
1
+ migrate-well
2
+ ============
3
+
4
+ migrate-well is a very simple gem for Rails 3. It adds a rake task `db:migrate:well` that runs `rake db:migrate`, `rake db:migrate:redo`, `rake db:test:prepare` and `annotate`.
5
+
6
+ It has been tested with Rails 3.0.3.
7
+
8
+ To install: add `gem "migrate-well"` in your `Gemfile` and run `bundle install`
9
+
10
+ To run: `rake db:migrate:well`
11
+
12
+ Options:
13
+
14
+ * `without_redo=true` or `wr=true`: don't run the `db:migrate:redo` task
15
+ * `without_test_prepare=true` or `wt=true`: don't run the `db:test:prepare` task
16
+ * `without_annotate=true` or `wa=true`: don't run the `annotate` command
17
+
18
+ Examples:
19
+
20
+ * run without annotating: `rake db:migrate:well wa=true`
21
+ * run without annotating and without redoing the migration: `rake db:migrate:well wr=true wa=true`
22
+
23
+ TODO
24
+
25
+ * allow passing of options to the annotate command
26
+ * tests...
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,3 @@
1
+ module MigrateWell
2
+ require 'migrate-well/railtie' if defined?(Rails)
3
+ end
@@ -0,0 +1,12 @@
1
+ require 'migrate-well'
2
+ require 'rails'
3
+
4
+ module MigrateWell
5
+ class Railtie < Rails::Railtie
6
+ # railtie_name :migratewell
7
+
8
+ rake_tasks do
9
+ load "tasks/migrate-well.rake"
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,3 @@
1
+ module MigrateWell
2
+ VERSION = "0.1"
3
+ end
@@ -0,0 +1,30 @@
1
+ namespace :db do
2
+ namespace :migrate do
3
+ desc 'Run migration (db:migrate), redo it (db:redo), prepare test db (db:test:prepare) and annotate models (annotate). Options: "wr=true": without db:redo; "wt=true": without db:test:prepare; "wa=true": without annotate.'
4
+ task :well do
5
+ system_with_echo "rake db:migrate"
6
+
7
+ unless ENV["without_redo"] == "true" || ENV["wr"] == "true"
8
+ system_with_echo "rake db:migrate:redo"
9
+ end
10
+
11
+ unless ENV["without_test_prepare"] == "true" || ENV["wt"] == "true"
12
+ system_with_echo "rake db:test:prepare"
13
+ end
14
+
15
+ unless ENV["without_annotate"] == "true" || ENV["wa"] == "true"
16
+ begin
17
+ require "annotate"
18
+ system_with_echo "bundle exec annotate"
19
+ rescue LoadError
20
+ end
21
+ end
22
+ end
23
+
24
+ def system_with_echo(command)
25
+ puts "\n\n*** Running: #{command}"
26
+ abort unless system(command)
27
+ end
28
+
29
+ end
30
+ end
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "migrate-well/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "migrate-well"
7
+ s.version = MigrateWell::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Florent Guilleux"]
10
+ s.email = ["florent2@gmail.com"]
11
+ s.homepage = %q{http://github.com/Florent2/migrate-well}
12
+ s.summary = %q{Adds a rake task that runs "rake db:migrate", "rake db:migrate:redo", "rake db:test:prepare" and "annotate".}
13
+ s.description = %q{Adds a rake task "db:migrate:well" that runs "rake db:migrate", "rake db:migrate:redo", "rake db:test:prepare" and "annotate". Options: "wr=true": without db:redo; "wt=true": without db:test:prepare; "wa=true": without annotate.}
14
+ s.licenses = ["MIT"]
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency "activerecord", ">= 3.0"
22
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: migrate-well
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: "0.1"
6
+ platform: ruby
7
+ authors:
8
+ - Florent Guilleux
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-02-09 00:00:00 -05:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: activerecord
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: "3.0"
25
+ type: :runtime
26
+ version_requirements: *id001
27
+ description: "Adds a rake task \"db:migrate:well\" that runs \"rake db:migrate\", \"rake db:migrate:redo\", \"rake db:test:prepare\" and \"annotate\". Options: \"wr=true\": without db:redo; \"wt=true\": without db:test:prepare; \"wa=true\": without annotate."
28
+ email:
29
+ - florent2@gmail.com
30
+ executables: []
31
+
32
+ extensions: []
33
+
34
+ extra_rdoc_files: []
35
+
36
+ files:
37
+ - .gitignore
38
+ - Gemfile
39
+ - LICENSE
40
+ - README.md
41
+ - Rakefile
42
+ - lib/migrate-well.rb
43
+ - lib/migrate-well/railtie.rb
44
+ - lib/migrate-well/version.rb
45
+ - lib/tasks/migrate-well.rake
46
+ - migrate-well.gemspec
47
+ has_rdoc: true
48
+ homepage: http://github.com/Florent2/migrate-well
49
+ licenses:
50
+ - MIT
51
+ post_install_message:
52
+ rdoc_options: []
53
+
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: "0"
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: "0"
68
+ requirements: []
69
+
70
+ rubyforge_project:
71
+ rubygems_version: 1.5.0
72
+ signing_key:
73
+ specification_version: 3
74
+ summary: Adds a rake task that runs "rake db:migrate", "rake db:migrate:redo", "rake db:test:prepare" and "annotate".
75
+ test_files: []
76
+