landlady 0.0.1 → 0.0.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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OTgxYWFkZmE2MWUzZjhmYzcxNTA1YzhjOTk2NGUzN2Y0OTUyNTBjMg==
4
+ NzYyYjNlM2JhNDAxMjk2Mjk4YWI4NGE1MGE4MTJlZmU3YTlmNmQzYw==
5
5
  data.tar.gz: !binary |-
6
- YWYyNGQ4ZDRjNjE5M2JhODc2ZTJlMWYxOTU0Y2NjMWE4OTY0YTdlNw==
6
+ Y2VmNzAzZmJiYTJjMTMzYjEyNjE2ZDJhYmJkYTc5MDNlYWIwZjQ5NA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MjNmNWNiMGExOTJlMDVlYzUxN2UyZjEzMDdiM2Y3M2JiZjg1ZjUxODc1MTkz
10
- M2I2ZjJjZWM0ZGQ2MTZkNzA3Mzg3NWFjNmZlZTM1OTliYzg2MzFkMjM3MGVi
11
- MGFhZjk2MTk5ZTQyNjVjNzllMmJjZGRjODliNDViYmFkNTM1MDk=
9
+ Y2QxNTBkNGM2Y2IwZGM3N2QyMGZmYTNmZDlhNDZiNDY1NGJlNGE5ODMxZTA1
10
+ ZThiZjU2Yzg3MDg0N2JkNTYyMjQwMzdkYzRhOTljZDQ5YjcxNzYzMzY0MThj
11
+ MWFkMzlmOTM3MjY1ZGY4ZTI1Mzc5OWYyNGEyZGI1ODEyZjM2ZGY=
12
12
  data.tar.gz: !binary |-
13
- ZTY5YmNlODZjOWE4ZGQ3OTAzNWFiNjg4N2UyNTIzYmQwNGQ2NDY5YmM4MTll
14
- OTAwYWQxY2JlNzE3YjY3NmY2Y2MxYTQ5MDhlMjhjYTBlNjJlMmEzNTgzMTJi
15
- M2RjZjk2MjdmYzJjYTM1YWZmZDMxNWQ5MzA1YWE4YzZhYTRmYjg=
13
+ ZWExMDIzODVhZWE0MGFhYzQ5YzFjZWI4ZjFiMGI4NWVhNThlNWU2ZTkwNzgy
14
+ ODUwYzcwOTAzYjQyNjNlMmVmMTU5YmQ1NWUzMWMwMGNmNjUzZGEyMzk3MzEw
15
+ YmVmM2QzNWQ5YTAwOGNhMmM3M2MyYWFiYjRmZmFkMTBlODIxMGE=
data/README.md CHANGED
@@ -1,5 +1,4 @@
1
-
2
- # landlady
1
+ # Landlady
3
2
 
4
3
  super easy postgres multitenancy
5
4
 
@@ -17,9 +16,18 @@ Or install it yourself as:
17
16
 
18
17
  $ gem install landlady
19
18
 
19
+ Then Install and run the migrations:
20
+
21
+ $ rails g my_gem:install
22
+ $ rake db:migrate
23
+
24
+
20
25
  ## Usage
21
26
 
22
- TODO: Write usage instructions here
27
+ ### Tenant migrations
28
+ Landlady will set up Tenants, then because she is a good land lady will update each of the tenants with the required migrations with:
29
+
30
+ $ rake tenants:db:migrate
23
31
 
24
32
  ## Contributing
25
33
 
@@ -28,5 +36,3 @@ TODO: Write usage instructions here
28
36
  3. Commit your changes (`git commit -am 'Add some feature'`)
29
37
  4. Push to the branch (`git push origin my-new-feature`)
30
38
  5. Create new Pull Request
31
-
32
-
@@ -0,0 +1,25 @@
1
+ require 'rails/generators/migration'
2
+
3
+ module Landlady
4
+ module Generators
5
+ class InstallGenerator < ::Rails::Generators::Base
6
+ include Rails::Generators::Migration
7
+ source_root File.expand_path('../templates', __FILE__)
8
+ desc "add the migrations"
9
+
10
+ def self.next_migration_number(path)
11
+ unless @prev_migration_nr
12
+ @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
13
+ else
14
+ @prev_migration_nr += 1
15
+ end
16
+ @prev_migration_nr.to_s
17
+ end
18
+
19
+ def copy_migrations
20
+ migration_template "create_tenants.rb", "db/migrate/create_tenants.rb"
21
+ end
22
+
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,13 @@
1
+ class CreateTenants < ActiveRecord::Migration
2
+ def change
3
+ create_table :tenants do |t|
4
+ t.string :subdomain
5
+ t.string :name
6
+ t.string :description
7
+ t.string :code
8
+ t.string :locale
9
+
10
+ t.timestamps
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module Landlady
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: landlady
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kym McInerney
@@ -52,6 +52,8 @@ files:
52
52
  - README.md
53
53
  - Rakefile
54
54
  - landlady.gemspec
55
+ - lib/generators/landlady/install/install_generator.rb
56
+ - lib/generators/landlady/install/templates/create_tenants.rb
55
57
  - lib/landlady.rb
56
58
  - lib/landlady/railtie.rb
57
59
  - lib/landlady/version.rb