application_seeds 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md
CHANGED
data/LICENSE
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
namespace :deploy do
|
2
|
+
desc "Populate the application's database with application_seed data"
|
3
|
+
task :application_seeds do
|
4
|
+
on roles(:all) do
|
5
|
+
if fetch(:rails_env) == 'production'
|
6
|
+
raise "You cannot run this task in the production environment"
|
7
|
+
end
|
8
|
+
|
9
|
+
within "#{current_path}" do
|
10
|
+
with rails_env: fetch(:rails_env) do
|
11
|
+
if fetch(:dataset) == "" || fetch(:dataset).nil?
|
12
|
+
execute :rake, 'db:seed'
|
13
|
+
else
|
14
|
+
execute :rake, "application_seeds:load\[#{fetch(:dataset)}\]"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
@@ -1,30 +1,7 @@
|
|
1
1
|
require 'capistrano'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
configuration.load do
|
8
|
-
set :dataset, ""
|
9
|
-
|
10
|
-
namespace :deploy do
|
11
|
-
task :application_seeds do
|
12
|
-
raise "You cannot run this task in the production environment" if rails_env == "production"
|
13
|
-
|
14
|
-
if dataset == ""
|
15
|
-
run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} db:seed}
|
16
|
-
else
|
17
|
-
run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} application_seeds:load\[#{dataset}\]}
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
3
|
+
if defined?(Capistrano::VERSION) && Gem::Version.new(Capistrano::VERSION).release >= Gem::Version.new('3.0.0')
|
4
|
+
load File.expand_path('capistrano/tasks/application_seeds.rake', File.dirname(__FILE__))
|
5
|
+
else
|
6
|
+
require_relative 'capistrano2'
|
25
7
|
end
|
26
|
-
|
27
|
-
if Capistrano::Configuration.instance
|
28
|
-
ApplicationSeeds::Capistrano.load_into(Capistrano::Configuration.instance)
|
29
|
-
end
|
30
|
-
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module ApplicationSeeds
|
2
|
+
module Capistrano
|
3
|
+
|
4
|
+
def self.load_into(configuration)
|
5
|
+
configuration.load do
|
6
|
+
set :dataset, ""
|
7
|
+
|
8
|
+
namespace :deploy do
|
9
|
+
desc "Populate the application's database with application_seed data"
|
10
|
+
task :application_seeds do
|
11
|
+
raise "You cannot run this task in the production environment" if rails_env == "production"
|
12
|
+
|
13
|
+
if dataset == ""
|
14
|
+
run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} db:seed}
|
15
|
+
else
|
16
|
+
run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} application_seeds:load\[#{dataset}\]}
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
if Capistrano::Configuration.instance
|
27
|
+
ApplicationSeeds::Capistrano.load_into(Capistrano::Configuration.instance)
|
28
|
+
end
|
29
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: application_seeds
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-01-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -92,6 +92,8 @@ files:
|
|
92
92
|
- lib/application_seeds.rb
|
93
93
|
- lib/application_seeds/attributes.rb
|
94
94
|
- lib/application_seeds/capistrano.rb
|
95
|
+
- lib/application_seeds/capistrano/tasks/application_seeds.rake
|
96
|
+
- lib/application_seeds/capistrano2.rb
|
95
97
|
- lib/application_seeds/database.rb
|
96
98
|
- lib/application_seeds/version.rb
|
97
99
|
- spec/application_seeds_spec.rb
|
@@ -114,7 +116,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
114
116
|
version: '0'
|
115
117
|
segments:
|
116
118
|
- 0
|
117
|
-
hash:
|
119
|
+
hash: 1780168384698824643
|
118
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
121
|
none: false
|
120
122
|
requirements:
|
@@ -123,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
125
|
version: '0'
|
124
126
|
segments:
|
125
127
|
- 0
|
126
|
-
hash:
|
128
|
+
hash: 1780168384698824643
|
127
129
|
requirements: []
|
128
130
|
rubyforge_project:
|
129
131
|
rubygems_version: 1.8.23
|