rateaux 1.3.0 → 1.4.0

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: 8d35a40979ebccab6d39c121caf02501c5a3d88e
4
- data.tar.gz: f623f92d286d5f9891660f44f326c6538f3db62f
3
+ metadata.gz: 831bdcfa82f2706d981274d18485c3c4dc6a8bf0
4
+ data.tar.gz: 0a542daacec901fd95f16f85142ce551a05cffeb
5
5
  SHA512:
6
- metadata.gz: 4f5d1279645b765c2fbdae49b5816ac606d388c05eb130363d5af09549604b027c42f16eb73625cce658251b9d0c4e21f1134fe93c3e2c505d68316e8da81e90
7
- data.tar.gz: b2a003b6e0b3d5375295cc33e04ddf6c636032079dafc5e0d62ac7d61ea606eba1de3d1777458aeebba102b7489aaf7caddbb4d4c18dfc00387a7f1b5d0c2b44
6
+ metadata.gz: d4c9f33a270cbea0b406462e9a843ec87a47135df087d82eecb64e495889dd66b3cb9f17b1287575e5e3a4aeb8b9f0c1128a961d274f3ecdb3aa3be18d5719db
7
+ data.tar.gz: a43eb8728446d115c6dbab96d8034223e3c978e7e82c0c5508b2135af0d1eb39edea00e6c45ee5a80674b79111694b5062876d1fd328d4e017e8be9ca9626298
data/README.md CHANGED
@@ -22,6 +22,14 @@ Truncate all data from the current SQL database. This removes all the data but k
22
22
  $ rake db:truncate
23
23
  ```
24
24
 
25
+ ### Delete
26
+
27
+ Delete all data from the current SQL database. This removes all the data and the tables.
28
+
29
+ ```sh
30
+ $ rake db:delete
31
+ ```
32
+
25
33
  ### Encoding headers
26
34
 
27
35
  Add the `# encoding: UTF-8` header to all ruby files in the project. Useful before Ruby 2.
@@ -1,3 +1,3 @@
1
1
  module Rateaux
2
- VERSION = "1.3.0"
2
+ VERSION = "1.4.0"
3
3
  end
@@ -0,0 +1,30 @@
1
+ # encoding: UTF-8
2
+ #
3
+ # Truncate or delete all data from an SQL database.
4
+ #
5
+ # $ rake db:truncate
6
+
7
+ require 'database_cleaner'
8
+
9
+ namespace :db do
10
+ desc "Truncate all tables"
11
+ task :truncate => :establish_connection do
12
+ DatabaseCleaner.strategy = :truncation
13
+ DatabaseCleaner.clean
14
+ end
15
+
16
+ desc "Delete all tables"
17
+ task :delete => :establish_connection do
18
+ DatabaseCleaner.strategy = :deletion
19
+ DatabaseCleaner.clean
20
+ end
21
+
22
+ # Faster than depending on :environment
23
+ task :establish_connection => "db:load_config" do
24
+ config = ActiveRecord::Base.configurations[::Rails.env]
25
+ ActiveRecord::Base.establish_connection
26
+ end
27
+
28
+ # Undocumented alias. This is a joke, don't use this.
29
+ task :sandra => :delete
30
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rateaux
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sunny Ripert
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-03 00:00:00.000000000 Z
11
+ date: 2014-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.2.17
27
+ - !ruby/object:Gem::Dependency
28
+ name: database_cleaner
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: sqlite3
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -79,7 +93,7 @@ files:
79
93
  - lib/rateaux.rb
80
94
  - lib/tasks/rateaux_cache_clear.rake
81
95
  - lib/tasks/rateaux_copy_non_digested_assets.rake
82
- - lib/tasks/rateaux_db_truncate.rake
96
+ - lib/tasks/rateaux_db.rake
83
97
  - lib/tasks/rateaux_encoding_headers.rake
84
98
  - lib/tasks/rateaux_git_checkout.rake
85
99
  - lib/tasks/rateaux_notes_mine.rake
@@ -1,33 +0,0 @@
1
- # encoding: UTF-8
2
- #
3
- # Truncate all data from an SQL database.
4
- #
5
- # $ rake db:truncate
6
-
7
- namespace :db do
8
- # http://stackoverflow.com/questions/7755389/rake-task-to-truncate-all-tables-in-rails-3/7792243#comment16456061_7792243
9
- desc "Truncate all existing data"
10
- task :truncate => "db:load_config" do
11
- begin
12
- config = ActiveRecord::Base.configurations[::Rails.env]
13
- ActiveRecord::Base.establish_connection
14
-
15
- tables = ActiveRecord::Base.connection.tables.reject { |t| t == "schema_migrations" }
16
- case config["adapter"]
17
- when "mysql", "postgresql"
18
- tables.each do |table|
19
- ActiveRecord::Base.connection.execute("TRUNCATE #{table}")
20
- end
21
- when "sqlite", "sqlite3"
22
- tables.each do |table|
23
- ActiveRecord::Base.connection.execute("DELETE FROM #{table}")
24
- ActiveRecord::Base.connection.execute("DELETE FROM sqlite_sequence where name='#{table}'")
25
- end
26
- ActiveRecord::Base.connection.execute("VACUUM")
27
- end
28
- end
29
- end
30
-
31
- desc "Alias to db:truncate"
32
- task sandra: :truncate
33
- end