milia 1.2.1 → 1.3.1.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/confirmations_controller.rb +7 -7
  3. data/app/controllers/registrations_controller.rb +13 -19
  4. data/app/views/devise/registrations/new.html.haml +53 -0
  5. data/lib/generators/milia/install_generator.rb +44 -41
  6. data/lib/generators/milia/templates/devise_permitted_parameters.rb +18 -0
  7. data/lib/generators/milia/templates/initializer.rb +3 -9
  8. data/lib/milia.rb +3 -22
  9. data/lib/milia/base.rb +88 -109
  10. data/lib/milia/control.rb +25 -25
  11. data/lib/milia/invite_member.rb +6 -6
  12. data/lib/milia/version.rb +1 -1
  13. metadata +16 -184
  14. data/.document +0 -5
  15. data/.gitignore +0 -94
  16. data/.ruby-gemset +0 -1
  17. data/.ruby-version +0 -1
  18. data/.slugignore +0 -2
  19. data/.travis.yml +0 -4
  20. data/Gemfile +0 -4
  21. data/LICENSE.txt +0 -20
  22. data/README.md +0 -1207
  23. data/Rakefile +0 -1
  24. data/doc/gemfile_addition.txt +0 -28
  25. data/doc/manual_sample.sh +0 -816
  26. data/doc/ref_notes.txt +0 -155
  27. data/doc/sample.sh +0 -276
  28. data/markdown.rb +0 -38
  29. data/milia.gemspec +0 -29
  30. data/test/.ruby-gemset +0 -1
  31. data/test/.ruby-version +0 -1
  32. data/test/Gemfile +0 -81
  33. data/test/Gemfile.lock +0 -223
  34. data/test/README.md +0 -83
  35. data/test/Rakefile +0 -6
  36. data/test/app/assets/javascripts/application.js +0 -16
  37. data/test/app/assets/stylesheets/application.css +0 -13
  38. data/test/app/controllers/application_controller.rb +0 -13
  39. data/test/app/controllers/home_controller.rb +0 -10
  40. data/test/app/helpers/application_helper.rb +0 -2
  41. data/test/app/models/member.rb +0 -34
  42. data/test/app/models/post.rb +0 -14
  43. data/test/app/models/team.rb +0 -9
  44. data/test/app/models/team_asset.rb +0 -6
  45. data/test/app/models/tenant.rb +0 -54
  46. data/test/app/models/user.rb +0 -14
  47. data/test/app/models/zine.rb +0 -8
  48. data/test/app/views/home/index.html.erb +0 -2
  49. data/test/app/views/home/show.html.erb +0 -2
  50. data/test/app/views/layouts/application.html.erb +0 -14
  51. data/test/bin/bundle +0 -3
  52. data/test/bin/rails +0 -4
  53. data/test/bin/rake +0 -4
  54. data/test/config/application.rb +0 -36
  55. data/test/config/boot.rb +0 -4
  56. data/test/config/database.yml +0 -25
  57. data/test/config/environment.rb +0 -5
  58. data/test/config/environments/development.rb +0 -48
  59. data/test/config/environments/production.rb +0 -95
  60. data/test/config/environments/test.rb +0 -42
  61. data/test/config/initializers/backtrace_silencers.rb +0 -7
  62. data/test/config/initializers/devise.rb +0 -254
  63. data/test/config/initializers/filter_parameter_logging.rb +0 -4
  64. data/test/config/initializers/inflections.rb +0 -16
  65. data/test/config/initializers/milia.rb +0 -51
  66. data/test/config/initializers/mime_types.rb +0 -5
  67. data/test/config/initializers/secret_token.rb +0 -12
  68. data/test/config/initializers/session_store.rb +0 -3
  69. data/test/config/initializers/wrap_parameters.rb +0 -14
  70. data/test/config/locales/en.yml +0 -23
  71. data/test/config/routes.rb +0 -77
  72. data/test/db/migrate/20111012050200_add_sessions_table.rb +0 -12
  73. data/test/db/migrate/20111012050340_devise_create_users.rb +0 -48
  74. data/test/db/migrate/20111012050532_create_tenants.rb +0 -11
  75. data/test/db/migrate/20111012050600_create_tenants_users_join_table.rb +0 -8
  76. data/test/db/migrate/20111012050650_create_members.rb +0 -12
  77. data/test/db/migrate/20111012231923_create_posts.rb +0 -12
  78. data/test/db/migrate/20111013050657_create_zines.rb +0 -10
  79. data/test/db/migrate/20111013050753_create_teams.rb +0 -10
  80. data/test/db/migrate/20111013050837_create_team_assets.rb +0 -11
  81. data/test/db/schema.rb +0 -126
  82. data/test/db/seeds.rb +0 -7
  83. data/test/test/controllers/home_controller_test.rb +0 -132
  84. data/test/test/ctlr_test_helper.rb +0 -11
  85. data/test/test/fixtures/members.yml +0 -35
  86. data/test/test/fixtures/posts.yml +0 -96
  87. data/test/test/fixtures/team_assets.yml +0 -30
  88. data/test/test/fixtures/teams.yml +0 -17
  89. data/test/test/fixtures/tenants.yml +0 -12
  90. data/test/test/fixtures/tenants_users.yml +0 -15
  91. data/test/test/fixtures/users.yml +0 -33
  92. data/test/test/fixtures/zines.yml +0 -25
  93. data/test/test/models/member_test.rb +0 -75
  94. data/test/test/models/post_test.rb +0 -66
  95. data/test/test/models/team_test.rb +0 -49
  96. data/test/test/models/tenant_test.rb +0 -228
  97. data/test/test/models/user_test.rb +0 -182
  98. data/test/test/models/zine_test.rb +0 -40
  99. data/test/test/test_helper.rb +0 -31
@@ -1,13 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the top of the
9
- * compiled file, but it's generally better to create a new file per style scope.
10
- *
11
- *= require_self
12
- *= require_tree .
13
- */
@@ -1,13 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- # Prevent CSRF attacks by raising an exception.
3
- # For APIs, you may want to use :null_session instead.
4
- protect_from_forgery with: :exception
5
-
6
- before_action :authenticate_tenant!
7
-
8
- ## milia defines a default max_tenants, invalid_tenant exception handling
9
- ## but you can override these if you wish to handle directly
10
- rescue_from ::Milia::Control::MaxTenantExceeded, :with => :max_tenants
11
- rescue_from ::Milia::Control::InvalidTenantAccess, :with => :invalid_tenant
12
-
13
- end
@@ -1,10 +0,0 @@
1
- class HomeController < ApplicationController
2
- skip_before_action :authenticate_tenant!, :only => [ :index ]
3
-
4
- def index
5
- end
6
-
7
- def show
8
- end
9
-
10
- end
@@ -1,2 +0,0 @@
1
- module ApplicationHelper
2
- end
@@ -1,34 +0,0 @@
1
- class Member < ActiveRecord::Base
2
- acts_as_tenant
3
-
4
- belongs_to :user
5
- has_many :team_assets
6
- has_many :teams, :through => :team_assets, :source => 'team'
7
- has_many :posts
8
- has_many :zines, :through => :posts, :source => 'zine'
9
-
10
-
11
- DEFAULT_ADMIN = {
12
- first_name: "Admin",
13
- last_name: "Please edit me"
14
- }
15
-
16
- def self.create_new_member(user, params)
17
- # add any other initialization for a new member
18
- return user.create_member( params )
19
- end
20
-
21
- def self.create_org_admin(user)
22
- new_member = create_new_member(user, DEFAULT_ADMIN)
23
- unless new_member.errors.empty?
24
- raise ArgumentError, new_member.errors.full_messages.uniq.join(", ")
25
- end
26
-
27
- return new_member
28
-
29
- end
30
-
31
-
32
-
33
- end # class
34
-
@@ -1,14 +0,0 @@
1
- class Post < ActiveRecord::Base
2
- acts_as_tenant
3
-
4
- belongs_to :member
5
- belongs_to :zine
6
- has_one :team, :through => :zine
7
-
8
-
9
- def self.get_team_posts( team_id )
10
- # Post.where( where_restrict_tenant(Zine, Member) )\
11
- # .order("members.last_name")
12
- end
13
-
14
- end
@@ -1,9 +0,0 @@
1
- class Team < ActiveRecord::Base
2
- acts_as_tenant
3
-
4
- has_many :team_assets
5
- has_many :team_members, :through => :team_assets, :source => 'member'
6
- has_many :posts, :through => :zines
7
- has_many :zines
8
-
9
- end
@@ -1,6 +0,0 @@
1
- class TeamAsset < ActiveRecord::Base
2
- acts_as_tenant
3
-
4
- belongs_to :member
5
- belongs_to :team
6
- end
@@ -1,54 +0,0 @@
1
- class Tenant < ActiveRecord::Base
2
- acts_as_universal_and_determines_tenant
3
-
4
- has_many :members, dependent: :destroy
5
- has_many :posts, dependent: :destroy
6
- has_many :zines, dependent: :destroy
7
- has_many :teams, dependent: :destroy
8
- has_many :team_assets, dependent: :destroy
9
-
10
- # ------------------------------------------------------------------------
11
- # ------------------------------------------------------------------------
12
- # ------------------------------------------------------------------------
13
- def self.create_new_tenant(tenant_params, user_params, coupon_params)
14
-
15
- tenant = Tenant.new(:name => tenant_params[:name])
16
-
17
- if new_signups_not_permitted?(coupon_params)
18
-
19
- raise ::Milia::Control::MaxTenantExceeded, "Sorry, new accounts not permitted at this time"
20
-
21
- else
22
- tenant.save # create the tenant
23
- end
24
- return tenant
25
- end
26
-
27
- # ------------------------------------------------------------------------
28
- # new_signups_not_permitted? -- returns true if no further signups allowed
29
- # args: params from user input; might contain a special 'coupon' code
30
- # used to determine whether or not to allow another signup
31
- # ------------------------------------------------------------------------
32
- def self.new_signups_not_permitted?(params)
33
- return false
34
- end
35
-
36
- # ------------------------------------------------------------------------
37
- # tenant_signup -- setup a new tenant in the system
38
- # CALLBACK from devise RegistrationsController (milia override)
39
- # AFTER user creation and current_tenant established
40
- # args:
41
- # user -- new user obj
42
- # tenant -- new tenant obj
43
- # other -- any other parameter string from initial request
44
- # ------------------------------------------------------------------------
45
- def self.tenant_signup(user, tenant, other = nil)
46
- # StartupJob.queue_startup( tenant, user, other )
47
- # any special seeding required for a new organizational tenant
48
- #
49
- Member.create_org_admin(user)
50
- #
51
- end
52
-
53
-
54
- end
@@ -1,14 +0,0 @@
1
- class User < ActiveRecord::Base
2
- acts_as_universal_and_determines_account
3
-
4
- # Include default devise modules. Others available are:
5
- # :lockable, :encryptable, and :omniauthable
6
- devise :database_authenticatable, :registerable, :confirmable,
7
- :recoverable, :rememberable, :trackable, :validatable
8
-
9
- has_one :member, :dependent => :destroy
10
- has_many :tenanted_members, :dependent => :destroy,
11
- :class_name => "Member", :foreign_key => 'user_id'
12
-
13
-
14
- end
@@ -1,8 +0,0 @@
1
- class Zine < ActiveRecord::Base
2
- acts_as_tenant
3
-
4
- belongs_to :team
5
- has_many :posts
6
- has_many :members, :through => :posts
7
-
8
- end
@@ -1,2 +0,0 @@
1
- <h1>Home#index</h1>
2
- <p>Find me in app/views/home/index.html.erb</p>
@@ -1,2 +0,0 @@
1
- <h1>Home#show</h1>
2
- <p>Find me in app/views/home/show.html.erb</p>
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Miliatest</title>
5
- <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
6
- <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
-
11
- <%= yield %>
12
-
13
- </body>
14
- </html>
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
- load Gem.bin_path('bundler', 'bundle')
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../../config/application', __FILE__)
3
- require_relative '../config/boot'
4
- require 'rails/commands'
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require_relative '../config/boot'
3
- require 'rake'
4
- Rake.application.run
@@ -1,36 +0,0 @@
1
- require File.expand_path('../boot', __FILE__)
2
-
3
- require 'rails/all'
4
-
5
- # Require the gems listed in Gemfile, including any gems
6
- # you've limited to :test, :development, or :production.
7
- Bundler.require(:default, Rails.env)
8
-
9
- module Miliatest
10
- class Application < Rails::Application
11
- # Settings in config/environments/* take precedence over those specified here.
12
- # Application configuration should go into files in config/initializers
13
- # -- all .rb files in that directory are automatically loaded.
14
- # uncomment to ensure a common layout for devise forms
15
-
16
- config.to_prepare do # Devise
17
- Devise::SessionsController.layout "sign"
18
- Devise::RegistrationsController.layout "sign"
19
- Devise::ConfirmationsController.layout "sign"
20
- Devise::PasswordsController.layout "sign"
21
- end # Devise
22
-
23
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
24
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
25
- config.time_zone = 'Pacific Time (US & Canada)'
26
-
27
- # if you want to skip the locale validation or don't care about locales
28
- # set this to false
29
- config.i18n.enforce_available_locales = false
30
-
31
-
32
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
33
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
34
- # config.i18n.default_locale = :de
35
- end
36
- end
@@ -1,4 +0,0 @@
1
- # Set up gems listed in the Gemfile.
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
-
4
- require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -1,25 +0,0 @@
1
- # SQLite version 3.x
2
- # gem install sqlite3
3
- #
4
- # Ensure the SQLite 3 gem is defined in your Gemfile
5
- # gem 'sqlite3'
6
- development:
7
- adapter: sqlite3
8
- database: db/development.sqlite3
9
- pool: 5
10
- timeout: 5000
11
-
12
- # Warning: The database defined as "test" will be erased and
13
- # re-generated from your development database when you run "rake".
14
- # Do not set this db to the same as development or production.
15
- test:
16
- adapter: sqlite3
17
- database: db/test.sqlite3
18
- pool: 5
19
- timeout: 5000
20
-
21
- production:
22
- adapter: sqlite3
23
- database: db/production.sqlite3
24
- pool: 5
25
- timeout: 5000
@@ -1,5 +0,0 @@
1
- # Load the Rails application.
2
- require File.expand_path('../application', __FILE__)
3
-
4
- # Initialize the Rails application.
5
- Miliatest::Application.initialize!
@@ -1,48 +0,0 @@
1
- Miliatest::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
3
-
4
- # devise says to define default url
5
- config.action_mailer.default_url_options = { :host => 'localhost:3000' }
6
-
7
- # set up for email sending even in dev mode
8
- # Don't care if the mailer can't send
9
- config.action_mailer.raise_delivery_errors = false
10
-
11
- config.action_mailer.delivery_method = :smtp
12
-
13
- ActionMailer::Base.smtp_settings = {
14
- :address => "smtp.gmail.com",
15
- :port => "587",
16
- :authentication => :plain,
17
- :user_name => "sender@example.com",
18
- :password => ENV["SMTP_ENTRY"],
19
- :enable_starttls_auto => true
20
- }
21
-
22
-
23
- # In the development environment your application's code is reloaded on
24
- # every request. This slows down response time but is perfect for development
25
- # since you don't have to restart the web server when you make code changes.
26
- config.cache_classes = false
27
-
28
- # Do not eager load code on boot.
29
- config.eager_load = false
30
-
31
- # Show full error reports and disable caching.
32
- config.consider_all_requests_local = true
33
- config.action_controller.perform_caching = false
34
-
35
- # Don't care if the mailer can't send.
36
- config.action_mailer.raise_delivery_errors = false
37
-
38
- # Print deprecation notices to the Rails logger.
39
- config.active_support.deprecation = :log
40
-
41
- # Raise an error on page load if there are pending migrations
42
- config.active_record.migration_error = :page_load
43
-
44
- # Debug mode disables concatenation and preprocessing of assets.
45
- # This option may cause significant delays in view rendering with a large
46
- # number of complex assets.
47
- config.assets.debug = true
48
- end
@@ -1,95 +0,0 @@
1
- Miliatest::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
3
-
4
- # devise says to define default url
5
- config.action_mailer.default_url_options = { :host => 'secure.simple-milia-app.com', :protocol => 'https' }
6
-
7
- ActionMailer::Base.delivery_method = :smtp
8
-
9
- ActionMailer::Base.smtp_settings = {
10
- :address => 'smtp.sendgrid.net',
11
- :port => '587',
12
- :authentication => :plain,
13
- :user_name => ENV['SENDGRID_USERNAME'],
14
- :password => ENV['SENDGRID_PASSWORD'],
15
- :domain => 'heroku.com'
16
- }
17
-
18
-
19
- # Code is not reloaded between requests.
20
- config.cache_classes = true
21
-
22
- # Eager load code on boot. This eager loads most of Rails and
23
- # your application in memory, allowing both thread web servers
24
- # and those relying on copy on write to perform better.
25
- # Rake tasks automatically ignore this option for performance.
26
- config.eager_load = true
27
-
28
- # Full error reports are disabled and caching is turned on.
29
- config.consider_all_requests_local = false
30
- config.action_controller.perform_caching = true
31
-
32
- # Enable Rack::Cache to put a simple HTTP cache in front of your application
33
- # Add `rack-cache` to your Gemfile before enabling this.
34
- # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
35
- # config.action_dispatch.rack_cache = true
36
-
37
- # Disable Rails's static asset server (Apache or nginx will already do this).
38
- config.serve_static_files = false
39
-
40
- # Compress JavaScripts and CSS.
41
- config.assets.js_compressor = :uglifier
42
- # config.assets.css_compressor = :sass
43
-
44
- # Do not fallback to assets pipeline if a precompiled asset is missed.
45
- config.assets.compile = false
46
-
47
- # Generate digests for assets URLs.
48
- config.assets.digest = true
49
-
50
- # Version of your assets, change this if you want to expire all your assets.
51
- config.assets.version = '1.0'
52
-
53
- # Specifies the header that your server uses for sending files.
54
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
55
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
56
-
57
- # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
58
- # config.force_ssl = true
59
-
60
- # Set to :debug to see everything in the log.
61
- config.log_level = :info
62
-
63
- # Prepend all log lines with the following tags.
64
- # config.log_tags = [ :subdomain, :uuid ]
65
-
66
- # Use a different logger for distributed setups.
67
- # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
68
-
69
- # Use a different cache store in production.
70
- # config.cache_store = :mem_cache_store
71
-
72
- # Enable serving of images, stylesheets, and JavaScripts from an asset server.
73
- # config.action_controller.asset_host = "http://assets.example.com"
74
-
75
- # Precompile additional assets.
76
- # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
77
- # config.assets.precompile += %w( search.js )
78
-
79
- # Ignore bad email addresses and do not raise email delivery errors.
80
- # Set this to true and configure the email server for immediate delivery to raise delivery errors.
81
- # config.action_mailer.raise_delivery_errors = false
82
-
83
- # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
84
- # the I18n.default_locale when a translation can not be found).
85
- config.i18n.fallbacks = true
86
-
87
- # Send deprecation notices to registered listeners.
88
- config.active_support.deprecation = :notify
89
-
90
- # Disable automatic flushing of the log to improve performance.
91
- # config.autoflush_log = false
92
-
93
- # Use default logging formatter so that PID and timestamp are not suppressed.
94
- config.log_formatter = ::Logger::Formatter.new
95
- end