slim_migrations 3.0.1 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2011-2012 Jan Lelis
1
+ Copyright 2011 Jan Lelis
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.rdoc CHANGED
@@ -12,7 +12,7 @@ Turns
12
12
  end
13
13
  end
14
14
 
15
- into
15
+ into:
16
16
 
17
17
  migration do
18
18
  def up
@@ -31,36 +31,29 @@ into
31
31
 
32
32
  === Install
33
33
 
34
- ==== Rails 3.2
35
-
36
- # in your Gemfile
37
- gem 'slim_migrations', '~> 3.2.1'
38
-
39
34
  ==== Rails 3.1
40
35
 
41
36
  # as plugin:
42
37
  rails plugin install git://github.com/janlelis/slim_migrations.git -r 3.1
43
- # or in your Gemfile:
44
- gem 'slim_migrations', '~> 3.1.1'
38
+ # or in Gemfile:
39
+ gem 'slim_migrations', '~> 3.1.0'
45
40
 
46
41
  ==== Rails 3.0
47
42
 
48
43
  # as plugin:
49
44
  rails plugin install git://github.com/janlelis/slim_migrations.git -r 3.0
50
- # or in your Gemfile:
51
- gem 'slim_migrations', '~> 3.0.1'
45
+ # or in Gemfile:
46
+ gem 'slim_migrations', '~> 3.0.0'
52
47
 
53
48
  ==== Rails 2.3
54
49
 
55
50
  # as plugin:
56
- script/plugin install git://github.com/janlelis/slim_migrations.git -r 2.3
57
- # or in your config/environment.rb
58
- config.gem 'slim_migrations', :version => '~> 2.3.1'
51
+ rails plugin install git://github.com/janlelis/slim_migrations.git -r 2.3
52
+ # or in Gemfile:
53
+ gem 'slim_migrations', '~> 2.3.0'
59
54
 
60
55
  === Credits
61
56
 
62
- Blog post: http://rbjl.net/53-three-little-tips-for-slimmer-rails-migrations
63
-
64
- Thanks to contributions from: Manuel Meurer
57
+ Blog post: http://rbjl.net
65
58
 
66
- MIT-LICENSE, J-_-L
59
+ J-_-L
@@ -1,4 +1,11 @@
1
1
  migration do
2
+ <%- if migration_action == 'add' -%>
3
+ def change
4
+ <% attributes.each do |attribute| -%>
5
+ add_column :<%= table_name %>, :<%= attribute.name %>, :<%= attribute.type %>
6
+ <%- end -%>
7
+ end
8
+ <%- else -%>
2
9
  def up
3
10
  <% attributes.each do |attribute| -%>
4
11
  <%- if migration_action -%>
@@ -14,4 +21,5 @@ migration do
14
21
  <%- end -%>
15
22
  <%- end -%>
16
23
  end
24
+ <%- end -%>
17
25
  end
@@ -1,3 +1,3 @@
1
1
  module SlimMigrations
2
- VERSION = '3.0.1'
2
+ VERSION = '3.1.0'
3
3
  end
@@ -1,5 +1,3 @@
1
- require 'slim_migrations/version'
2
-
3
1
  module SlimMigrations
4
2
  class Railtie < Rails::Railtie
5
3
  rake_tasks do
@@ -13,9 +11,9 @@ module Kernel
13
11
 
14
12
  # initialize migrations with <tt>migration do</tt> instead of <tt>class SomeMigration < ActiveRecord::Migration</tt>
15
13
  def migration(&block)
16
- if caller[0].rindex(/\/(?:[0-9]+)_([_a-z0-9]*).rb:\d+(?::in `.*')?$/)
14
+ if caller[0].rindex(/(?:[0-9]+)_([_a-z0-9]*).rb:\d+(?::in `.*')?$/)
17
15
  m = Object.const_set $1.camelize, Class.new(ActiveRecord::Migration)
18
- m.instance_eval(&block) # 3.0
16
+ m.class_eval(&block) # 3.1
19
17
  else
20
18
  raise ArgumentError, "Could not create migration at: #{caller[0]}"
21
19
  end
metadata CHANGED
@@ -1,69 +1,77 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: slim_migrations
3
- version: !ruby/object:Gem::Version
4
- version: 3.0.1
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
5
+ version: 3.1.0
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Jan Lelis
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-29 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
12
+
13
+ date: 2011-07-15 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
15
16
  name: rails
16
- requirement: &21449980 !ruby/object:Gem::Requirement
17
+ requirement: &id001 !ruby/object:Gem::Requirement
17
18
  none: false
18
- requirements:
19
+ requirements:
19
20
  - - ~>
20
- - !ruby/object:Gem::Version
21
- version: 3.0.0
21
+ - !ruby/object:Gem::Version
22
+ version: 3.1.0.rc4
22
23
  type: :runtime
23
24
  prerelease: false
24
- version_requirements: *21449980
25
+ version_requirements: *id001
25
26
  description: Let's you write even slimmer migrations.
26
27
  email: mail@janlelis.de
27
28
  executables: []
29
+
28
30
  extensions: []
31
+
29
32
  extra_rdoc_files: []
30
- files:
33
+
34
+ files:
31
35
  - lib/slim_migrations.rb
32
36
  - lib/slim_migrations/version.rb
33
- - lib/tasks/slim_migrations_tasks.rake
34
- - lib/rails/generators/active_record/migration/templates/migration.rb
35
37
  - lib/rails/generators/active_record/migration/migration_generator.rb
38
+ - lib/rails/generators/active_record/migration/templates/migration.rb
39
+ - lib/tasks/slim_migrations_tasks.rake
36
40
  - MIT-LICENSE
37
41
  - Rakefile
38
42
  - README.rdoc
39
43
  homepage: https://github.com/janlelis/slim_migrations
40
44
  licenses: []
45
+
41
46
  post_install_message:
42
47
  rdoc_options: []
43
- require_paths:
48
+
49
+ require_paths:
44
50
  - lib
45
- required_ruby_version: !ruby/object:Gem::Requirement
51
+ required_ruby_version: !ruby/object:Gem::Requirement
46
52
  none: false
47
- requirements:
48
- - - ! '>='
49
- - !ruby/object:Gem::Version
50
- version: '0'
51
- segments:
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ hash: -550716623
57
+ segments:
52
58
  - 0
53
- hash: 115165297047775359
54
- required_rubygems_version: !ruby/object:Gem::Requirement
59
+ version: "0"
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
61
  none: false
56
- requirements:
57
- - - ! '>='
58
- - !ruby/object:Gem::Version
59
- version: '0'
60
- segments:
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ hash: -550716623
66
+ segments:
61
67
  - 0
62
- hash: 115165297047775359
68
+ version: "0"
63
69
  requirements: []
70
+
64
71
  rubyforge_project:
65
- rubygems_version: 1.8.11
72
+ rubygems_version: 1.8.1
66
73
  signing_key:
67
74
  specification_version: 3
68
75
  summary: Let's you write even slimmer migrations.
69
76
  test_files: []
77
+