apartment 0.24.1 → 0.24.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cb625bf45d3f3ca29dd49ac3f05831ad27670cea
4
- data.tar.gz: 9ce79d1937a2873416fc766c65dcdc676976c0d0
3
+ metadata.gz: 7e43eac9d72c72d2d6dca348f7a1a1dd9a4ef841
4
+ data.tar.gz: 6be09e40dec6b3c712295c42b7c1eb3e99bdc151
5
5
  SHA512:
6
- metadata.gz: 89328d8209fd287e8c3a60a927a6e9a6c2795127ae67e5bf6035810e584e22484c12a5d8c92eb9e24bec895655e7a6fab4f7009d48c2805228367cff5246e854
7
- data.tar.gz: 3c4a316a8d26c42c00b7baf3513015e6e154a92fcb7ae359aba750a75ad887a6c6420595cc41921f60f4822ae32a9ae43de5ce7ac4d1bb3a998a45bd9436f098
6
+ metadata.gz: 1e5de55c95c3cded373c7a06836c4e07b05c86be0d93f5e7ecf4ec2649c296590346b3ae7177b1899e4e12f5dd2904f9c3e9f6b85130a3150effe8ebab96f112
7
+ data.tar.gz: dce9320056113ce252f4f6df8ab779ce65db47978dc5a421ed20f33b5850008ebcb03cb0b0edc4766fb8763614ffd548dfb561a737338ac3054978340d67d714
data/HISTORY.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 0.24.2
2
+ * February 24, 2014
3
+
4
+ - Better warnings if `apartment:migrate` is run
5
+
1
6
  # 0.24.1
2
7
  * February 21, 2014
3
8
 
@@ -1,3 +1,3 @@
1
1
  module Apartment
2
- VERSION = "0.24.1"
2
+ VERSION = "0.24.2"
3
3
  end
@@ -16,6 +16,8 @@ apartment_namespace = namespace :apartment do
16
16
 
17
17
  desc "Migrate all tenants"
18
18
  task :migrate do
19
+ warn_if_tenants_empty
20
+
19
21
  tenants.each do |tenant|
20
22
  begin
21
23
  puts("Migrating #{tenant} tenant")
@@ -28,6 +30,8 @@ apartment_namespace = namespace :apartment do
28
30
 
29
31
  desc "Seed all tenants"
30
32
  task :seed do
33
+ warn_if_tenants_empty
34
+
31
35
  tenants.each do |tenant|
32
36
  begin
33
37
  puts("Seeding #{tenant} tenant")
@@ -42,6 +46,8 @@ apartment_namespace = namespace :apartment do
42
46
 
43
47
  desc "Rolls the migration back to the previous version (specify steps w/ STEP=n) across all tenants."
44
48
  task :rollback do
49
+ warn_if_tenants_empty
50
+
45
51
  step = ENV['STEP'] ? ENV['STEP'].to_i : 1
46
52
 
47
53
  tenants.each do |tenant|
@@ -57,6 +63,8 @@ apartment_namespace = namespace :apartment do
57
63
  namespace :migrate do
58
64
  desc 'Runs the "up" for a given migration VERSION across all tenants.'
59
65
  task :up do
66
+ warn_if_tenants_empty
67
+
60
68
  version = ENV['VERSION'] ? ENV['VERSION'].to_i : nil
61
69
  raise 'VERSION is required' unless version
62
70
 
@@ -72,6 +80,8 @@ apartment_namespace = namespace :apartment do
72
80
 
73
81
  desc 'Runs the "down" for a given migration VERSION across all tenants.'
74
82
  task :down do
83
+ warn_if_tenants_empty
84
+
75
85
  version = ENV['VERSION'] ? ENV['VERSION'].to_i : nil
76
86
  raise 'VERSION is required' unless version
77
87
 
@@ -98,6 +108,20 @@ apartment_namespace = namespace :apartment do
98
108
  end
99
109
 
100
110
  def tenants
101
- ENV['DB'] ? ENV['DB'].split(',').map { |s| s.strip } : Apartment.tenant_names
111
+ ENV['DB'] ? ENV['DB'].split(',').map { |s| s.strip } : Apartment.tenant_names || []
112
+ end
113
+
114
+ def warn_if_tenants_empty
115
+ if tenants.empty?
116
+ puts <<-WARNING
117
+ [WARNING] - The list of tenants to migrate appears to be empty. This could mean a few things:
118
+
119
+ 1. You may not have created any, in which case you can ignore this message
120
+ 2. You've run `apartment:migrate` directly without loading the Rails environment
121
+ * `apartment:migrate` is now deprecated. Tenants will automatically be migrated with `db:migrate`
122
+
123
+ Note that your tenants currently haven't been migrated. You'll need to run `db:migrate` to rectify this.
124
+ WARNING
125
+ end
102
126
  end
103
127
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apartment
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.24.1
4
+ version: 0.24.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Brunner
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-21 00:00:00.000000000 Z
12
+ date: 2014-02-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord