versioned_seeds 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Rails
|
4
|
+
module Generators
|
5
|
+
class SeedFileGenerator < ::Rails::Generators::NamedBase
|
6
|
+
source_root File.expand_path("../../templates", __FILE__)
|
7
|
+
|
8
|
+
desc "Generates a seed file with a timestamped name"
|
9
|
+
def create_seed_file
|
10
|
+
template 'seed_file.rb', "db/seeds/#{script_name}.rb"
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def script_name
|
16
|
+
ts = Time.now.utc.strftime("%Y%m%d%H%M%S")
|
17
|
+
"#{ts}_#{name}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
File without changes
|
@@ -1,22 +1,13 @@
|
|
1
|
-
require 'rails/
|
1
|
+
require 'generators/rails/seed_file_generator'
|
2
2
|
|
3
3
|
module VersionedSeeds
|
4
|
-
class SeedFileGenerator < Rails::Generators::
|
5
|
-
|
6
|
-
source_root File.expand_path("../templates", __FILE__)
|
4
|
+
class SeedFileGenerator < ::Rails::Generators::SeedFileGenerator
|
5
|
+
source_root File.expand_path('../../templates', __FILE__)
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
template 'seed_file.rb', "db/seeds/#{script_name}.rb"
|
13
|
-
end
|
14
|
-
|
15
|
-
private
|
16
|
-
|
17
|
-
def script_name
|
18
|
-
ts = Time.now.utc.strftime("%Y%m%d%H%M%S")
|
19
|
-
"#{ts}_#{name}"
|
7
|
+
def say_deprecated
|
8
|
+
say "====> This generator is now DEPRECATED. <====", :red
|
9
|
+
say "Please use:"
|
10
|
+
say " rails g seed_file #{name}"
|
20
11
|
end
|
21
12
|
end
|
22
13
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: versioned_seeds
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-04-11 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement: &
|
16
|
+
requirement: &70119511455460 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0.9'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70119511455460
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &70119511454960 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '2'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70119511454960
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rails
|
38
|
-
requirement: &
|
38
|
+
requirement: &70119511454500 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '3'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70119511454500
|
47
47
|
description: Manage your seed scripts by versioning them
|
48
48
|
email:
|
49
49
|
- scourtois@cubyx.fr
|
@@ -57,8 +57,9 @@ files:
|
|
57
57
|
- Gemfile
|
58
58
|
- README.mdown
|
59
59
|
- Rakefile
|
60
|
+
- lib/generators/rails/seed_file_generator.rb
|
61
|
+
- lib/generators/templates/seed_file.rb
|
60
62
|
- lib/generators/versioned_seeds/seed_file_generator.rb
|
61
|
-
- lib/generators/versioned_seeds/templates/seed_file.rb
|
62
63
|
- lib/tasks/versioned_seeds.rake
|
63
64
|
- lib/versioned_seeds.rb
|
64
65
|
- lib/versioned_seeds/railtie.rb
|