rails_prune 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 132c99ee9944648ea408772bb08010e97ecdcd4e
4
- data.tar.gz: 0c8e0515ea5a1a21530b9da8fdab94bf5b8452e7
3
+ metadata.gz: 4681790020ec4c71f6ebfe61283306e810cac6df
4
+ data.tar.gz: 7212e85068eb9c4106965358a70342dd295b6c13
5
5
  SHA512:
6
- metadata.gz: cdf0b9779e5ce63f4442df85307fcbe73f40e42c8d668265518598f53533232cc3d81817180c5ee56e88b09cdcfe9804d95cbe390d7a00a6ea7b2e8ac1b60990
7
- data.tar.gz: 133d2f0ae52930691092cf045d6d159d5e48149bd673dd2d90805362cec0addb9323510ef67bcf070f6f499c22d9931d3da95cf2c5179554deb81df36c5827c0
6
+ metadata.gz: ce7aeffa17339c2ecea33fc21e70721c1c9ffe3489f870170f43250fcff4f725685bab63f6485260ca2279ff0c86d67538726aa735523adfa7a32c9a84903b02
7
+ data.tar.gz: a29ff9d8db343ca6fcb87e362516947fc2f8446551127f822864fbefac98540f3063699ff967b5beffe271326805b5b97b3f5e74fad5cc28f30821d4808ed8e2
@@ -11,8 +11,15 @@ namespace :db do
11
11
  Rails.application.eager_load!
12
12
 
13
13
  connection = ActiveRecord::Base.connection
14
- quoted_table_names = (ActiveRecord::Base.descendants - [ActiveRecord::SchemaMigration]).map(&:quoted_table_name)
14
+ quoted_table_names = (ActiveRecord::Base.descendants - [ActiveRecord::SchemaMigration])
15
+ .select(&:table_exists?)
16
+ .map(&:quoted_table_name)
15
17
 
16
- connection.execute("TRUNCATE TABLE #{quoted_table_names.join(",")} CASCADE")
18
+ sql = <<-SQL.strip_heredoc
19
+ TRUNCATE TABLE #{quoted_table_names.join(",")}
20
+ SQL
21
+
22
+ $stderr.puts sql
23
+ connection.execute(sql)
17
24
  end
18
25
  end
@@ -1,3 +1,3 @@
1
1
  module RailsPrune
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
data/rails_prune.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "rails", "~> 4"
21
+ spec.add_dependency "rails", ">= 4"
22
22
 
23
23
  spec.add_development_dependency "bundler", "~> 1.12"
24
24
  spec.add_development_dependency "rake", "~> 10.0"
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_prune
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kim Burge Strand
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-01 00:00:00.000000000 Z
11
+ date: 2016-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4'
27
27
  - !ruby/object:Gem::Dependency
@@ -93,3 +93,4 @@ signing_key:
93
93
  specification_version: 4
94
94
  summary: A rake task for Rails to truncate your database.
95
95
  test_files: []
96
+ has_rdoc: