scottmotte-merb-auth-slice-multisite 0.3.0 → 1.0.7.1

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.
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 scottmotte
1
+ Copyright (c) 2008 Scott Motte
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -17,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
17
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
18
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
19
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.textile CHANGED
@@ -4,11 +4,11 @@ This slice setups multisite capabilities in your merb application with an authen
4
4
 
5
5
  It works for subdomains (i.e. coolcars.yourapp.com) or for domains routed to your application via your server (i.e. coolcars.com).
6
6
 
7
- It has a check to make a user to the site he's trying to login to. If the user does not match than authentication fails.
7
+ It a check to make match a user to the site he's trying to login to.
8
8
 
9
- h2. Instructions for installation:
9
+ <object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=2844037&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=2844037&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object><br /><a href="http://vimeo.com/">merb-auth-slice-multisite installation</a> from <a href="http://vimeo.com/user1166117">Scott Motte</a> on <a href="http://vimeo.com">Vimeo</a>.
10
10
 
11
- 0. Check out the video. <a href="http://scottmotte.github.com/merb-auth-slice-multisite/">How to install merb-auth-slice-multisite in your application.</a>
11
+ h2. Instructions for installation:
12
12
 
13
13
  1. Download the gem and install.
14
14
  <pre><code># from your terminal
@@ -21,7 +21,7 @@ sudo rake install
21
21
  </code></pre>
22
22
 
23
23
  2. Setup your application to use the gem.* Add the following to the end of dependencies.rb.
24
- <pre><code>dependency "merb-auth-slice-multisite", "0.2"</code></pre>
24
+ <pre><code>dependency "merb-auth-slice-multisite", "1.0.7.1"</code></pre>
25
25
 
26
26
  3. Add in mixin. In your user model or in merb/merb-auth/setup.rb add the mixin
27
27
  include Merb::Authentication::Mixins::UserBelongsToSite and then migrate your database.
data/Rakefile ADDED
@@ -0,0 +1,56 @@
1
+ require 'rubygems'
2
+ require 'rake/gempackagetask'
3
+ require 'merb-core'
4
+ require 'merb-core/tasks/merb'
5
+
6
+ GEM_NAME = "merb-auth-slice-multisite"
7
+ AUTHOR = "Scott Motte"
8
+ EMAIL = "scott@scottmotte.com"
9
+ HOMEPAGE = "http://scottmotte.com/"
10
+ SUMMARY = "Merb Slice that adds basic multisite functionality to merb-auth."
11
+ GEM_VERSION = "1.0.7.1"
12
+
13
+ spec = Gem::Specification.new do |s|
14
+ s.rubyforge_project = 'merb'
15
+ s.name = GEM_NAME
16
+ s.version = GEM_VERSION
17
+ s.platform = Gem::Platform::RUBY
18
+ s.has_rdoc = true
19
+ s.extra_rdoc_files = ["README.textile", "LICENSE"]
20
+ s.summary = SUMMARY
21
+ s.description = s.summary
22
+ s.author = AUTHOR
23
+ s.email = EMAIL
24
+ s.homepage = HOMEPAGE
25
+ s.add_dependency('merb-slices', '>= 1.0')
26
+ s.add_dependency('merb-auth-core', '>= 1.0')
27
+ s.add_dependency('merb-auth-more', '>= 1.0')
28
+ s.require_path = 'lib'
29
+ s.files = %w(LICENSE README.textile Rakefile) + Dir.glob("{lib,spec,app,public,stubs}/**/*")
30
+ end
31
+
32
+ Rake::GemPackageTask.new(spec) do |pkg|
33
+ pkg.gem_spec = spec
34
+ end
35
+
36
+ desc "Install the gem"
37
+ task :install do
38
+ Merb::RakeHelper.install(GEM_NAME, :version => GEM_VERSION)
39
+ end
40
+
41
+ desc "Uninstall the gem"
42
+ task :uninstall do
43
+ Merb::RakeHelper.uninstall(GEM_NAME, :version => GEM_VERSION)
44
+ end
45
+
46
+ desc "Create a gemspec file"
47
+ task :gemspec do
48
+ File.open("#{GEM_NAME}.gemspec", "w") do |file|
49
+ file.puts spec.to_ruby
50
+ end
51
+ end
52
+
53
+ require 'spec/rake/spectask'
54
+ require 'merb-core/test/tasks/spectasks'
55
+ desc 'Default: run spec examples'
56
+ task :default => 'spec'
data/TODO ADDED
@@ -0,0 +1,3 @@
1
+ TODO:
2
+
3
+ - coming soon
@@ -0,0 +1,5 @@
1
+ class MerbAuthSliceMultisite::Application < Merb::Controller
2
+
3
+ controller_for_slice
4
+
5
+ end
@@ -0,0 +1,64 @@
1
+ module Merb
2
+ module MerbAuthSliceMultisite
3
+ module ApplicationHelper
4
+
5
+ # @param *segments<Array[#to_s]> Path segments to append.
6
+ #
7
+ # @return <String>
8
+ # A path relative to the public directory, with added segments.
9
+ def image_path(*segments)
10
+ public_path_for(:image, *segments)
11
+ end
12
+
13
+ # @param *segments<Array[#to_s]> Path segments to append.
14
+ #
15
+ # @return <String>
16
+ # A path relative to the public directory, with added segments.
17
+ def javascript_path(*segments)
18
+ public_path_for(:javascript, *segments)
19
+ end
20
+
21
+ # @param *segments<Array[#to_s]> Path segments to append.
22
+ #
23
+ # @return <String>
24
+ # A path relative to the public directory, with added segments.
25
+ def stylesheet_path(*segments)
26
+ public_path_for(:stylesheet, *segments)
27
+ end
28
+
29
+ # Construct a path relative to the public directory
30
+ #
31
+ # @param <Symbol> The type of component.
32
+ # @param *segments<Array[#to_s]> Path segments to append.
33
+ #
34
+ # @return <String>
35
+ # A path relative to the public directory, with added segments.
36
+ def public_path_for(type, *segments)
37
+ ::MerbAuthSliceMultisite.public_path_for(type, *segments)
38
+ end
39
+
40
+ # Construct an app-level path.
41
+ #
42
+ # @param <Symbol> The type of component.
43
+ # @param *segments<Array[#to_s]> Path segments to append.
44
+ #
45
+ # @return <String>
46
+ # A path within the host application, with added segments.
47
+ def app_path_for(type, *segments)
48
+ ::MerbAuthSliceMultisite.app_path_for(type, *segments)
49
+ end
50
+
51
+ # Construct a slice-level path.
52
+ #
53
+ # @param <Symbol> The type of component.
54
+ # @param *segments<Array[#to_s]> Path segments to append.
55
+ #
56
+ # @return <String>
57
+ # A path within the slice source (Gem), with added segments.
58
+ def slice_path_for(type, *segments)
59
+ ::MerbAuthSliceMultisite.slice_path_for(type, *segments)
60
+ end
61
+
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,37 @@
1
+ class Site
2
+ include DataMapper::Resource
3
+
4
+ # Schema
5
+ property :id, Serial
6
+ property :domain, String, :nullable => :false, :length => (1..40), :unique => true, :format => /(\.[a-z]{2,4})$/
7
+ property :folder, String, :nullable => :false, :length => (1..40), :unique => true
8
+ property :subdomain, String, :nullable => :false, :length => (1..40), :unique => true, :format => /^[a-zA-Z0-9\-]*?$/
9
+
10
+ # Relationships/Associates
11
+ has n, :users, :order => [:login.asc]
12
+
13
+ # Validations
14
+ validates_with_method :check_subdomain
15
+
16
+ ReservedSubdomains = %w[backstage admin blog dev ftp mail email pop pop3 imap smtp stage stats status www]
17
+ def check_subdomain
18
+ if ReservedSubdomains.include?(self.subdomain)
19
+ [false, "Subdomain '#{self.subdomain}' is reserved."]
20
+ else
21
+ true
22
+ end
23
+ end
24
+
25
+ # Hooks
26
+ before :valid?, :remove_http_and_www
27
+ def remove_http_and_www
28
+ domain.gsub!('http://', '')
29
+ domain.gsub!('www.', '')
30
+ end
31
+
32
+ before :save, :generate_folder
33
+ def generate_folder
34
+ self.folder = domain.gsub('.', '')
35
+ end
36
+
37
+ end
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
5
+ <title>Fresh MerbAuthSliceMultisite Slice</title>
6
+ <link href="<%= public_path_for :stylesheet, 'master.css' %>" type="text/css" charset="utf-8" rel="stylesheet" media="all" />
7
+ <script src="<%= public_path_for :javascript, 'master.js' %>" type="text/javascript" charset="utf-8"></script>
8
+ </head>
9
+ <!-- you can override this layout at slices/merb-auth-slice-multisite/app/views/layout/merb-auth-slice-multisite.html.erb -->
10
+ <body class="merb-auth-slice-multisite-slice">
11
+ <div id="container">
12
+ <h1>MerbAuthSliceMultisite Slice</h1>
13
+ <div id="main"><%= catch_content :for_layout %></div>
14
+ </div>
15
+ </body>
16
+ </html>
@@ -26,7 +26,7 @@ if defined?(Merb::Plugins)
26
26
 
27
27
  # Slice metadata
28
28
  self.description = "Merb Slice that adds basic multisite functionality to merb-auth."
29
- self.version = "0.2"
29
+ self.version = "1.0.7.1"
30
30
  self.author = "Scott Motte"
31
31
 
32
32
  # Stub classes loaded hook - runs before LoadClasses BootLoader
@@ -0,0 +1,2 @@
1
+ html, body { margin: 0; padding: 0; }
2
+ #container { width: 800px; margin: 4em auto; padding: 4em 4em 6em 4em; background: #DDDDDD; }
@@ -0,0 +1,2 @@
1
+ class MerbAuthSliceMultisite::Application < Merb::Controller
2
+ end
metadata CHANGED
@@ -1,19 +1,45 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scottmotte-merb-auth-slice-multisite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 1.0.7.1
5
5
  platform: ruby
6
6
  authors:
7
- - scottmotte
7
+ - Scott Motte
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-27 00:00:00 -07:00
12
+ date: 2009-01-15 00:00:00 -08:00
13
13
  default_executable:
14
- dependencies: []
15
-
16
- description:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: merb-slices
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: "1.0"
23
+ version:
24
+ - !ruby/object:Gem::Dependency
25
+ name: merb-auth-core
26
+ version_requirement:
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: "1.0"
32
+ version:
33
+ - !ruby/object:Gem::Dependency
34
+ name: merb-auth-more
35
+ version_requirement:
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: "1.0"
41
+ version:
42
+ description: Merb Slice that adds basic multisite functionality to merb-auth.
17
43
  email: scott@scottmotte.com
18
44
  executables: []
19
45
 
@@ -22,9 +48,21 @@ extensions: []
22
48
  extra_rdoc_files:
23
49
  - README.textile
24
50
  - LICENSE
51
+ - TODO
25
52
  files:
53
+ - LICENSE
26
54
  - README.textile
27
- - VERSION.yml
55
+ - Rakefile
56
+ - TODO
57
+ - app/controllers
58
+ - app/controllers/application.rb
59
+ - app/helpers
60
+ - app/helpers/application_helper.rb
61
+ - app/models
62
+ - app/models/site.rb
63
+ - app/views
64
+ - app/views/layout
65
+ - app/views/layout/merb-auth-slice-multisite.html.erb
28
66
  - lib/merb-auth-slice-multisite
29
67
  - lib/merb-auth-slice-multisite/merbtasks.rb
30
68
  - lib/merb-auth-slice-multisite/mixins
@@ -34,18 +72,20 @@ files:
34
72
  - lib/merb-auth-slice-multisite/slicetasks.rb
35
73
  - lib/merb-auth-slice-multisite/spectasks.rb
36
74
  - lib/merb-auth-slice-multisite.rb
37
- - lib/merb_auth_slice_multisite.rb
38
- - test/merb_auth_slice_multisite_test.rb
39
- - test/test_helper.rb
75
+ - public/javascripts
76
+ - public/javascripts/master.js
77
+ - public/stylesheets
78
+ - public/stylesheets/master.css
40
79
  - spec/merb-auth-slice-multisite_spec.rb
41
80
  - spec/spec_helper.rb
42
- - LICENSE
81
+ - stubs/app
82
+ - stubs/app/controllers
83
+ - stubs/app/controllers/application.rb
43
84
  has_rdoc: true
44
- homepage: http://github.com/scottmotte/merb-auth-slice-multisite
85
+ homepage: http://scottmotte.com/
45
86
  post_install_message:
46
- rdoc_options:
47
- - --inline-source
48
- - --charset=UTF-8
87
+ rdoc_options: []
88
+
49
89
  require_paths:
50
90
  - lib
51
91
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -62,10 +102,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
102
  version:
63
103
  requirements: []
64
104
 
65
- rubyforge_project:
105
+ rubyforge_project: merb
66
106
  rubygems_version: 1.2.0
67
107
  signing_key:
68
108
  specification_version: 2
69
- summary: Merb Slice that adds basic multisite functionality to merb-auth.
109
+ summary: Merb Slice that adds basic multi-site functionality to merb-auth.
70
110
  test_files: []
71
111
 
data/VERSION.yml DELETED
@@ -1,4 +0,0 @@
1
- ---
2
- :major: 0
3
- :minor: 3
4
- :patch: 0
@@ -1,7 +0,0 @@
1
- require 'test_helper'
2
-
3
- class MerbAuthSliceMultisiteTest < Test::Unit::TestCase
4
- should "probably rename this file and start testing for real" do
5
- flunk "hey buddy, you should probably rename this file and start testing for real"
6
- end
7
- end
data/test/test_helper.rb DELETED
@@ -1,10 +0,0 @@
1
- require 'rubygems'
2
- require 'test/unit'
3
- require 'shoulda'
4
-
5
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
- $LOAD_PATH.unshift(File.dirname(__FILE__))
7
- require 'merb_auth_slice_multisite'
8
-
9
- class Test::Unit::TestCase
10
- end