sinatra-authentication 0.3.0 → 0.3.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/Rakefile +1 -1
- data/lib/models/dm_adapter.rb +3 -2
- data/readme.markdown +20 -0
- data/sinatra-authentication.gemspec +3 -3
- data/test/lib/dm_extend_app.rb +2 -1
- metadata +54 -33
    
        data/Rakefile
    CHANGED
    
    | @@ -6,7 +6,7 @@ begin | |
| 6 6 |  | 
| 7 7 | 
             
              Jeweler::Tasks.new do |gemspec|
         | 
| 8 8 | 
             
                gemspec.name           = 'sinatra-authentication'
         | 
| 9 | 
            -
                gemspec.version        = '0.3. | 
| 9 | 
            +
                gemspec.version        = '0.3.1'
         | 
| 10 10 | 
             
                gemspec.description    = "Simple authentication plugin for sinatra."
         | 
| 11 11 | 
             
                gemspec.summary        = "Simple authentication plugin for sinatra."
         | 
| 12 12 | 
             
                gemspec.homepage       = "http://github.com/maxjustus/sinatra-authentication"
         | 
    
        data/lib/models/dm_adapter.rb
    CHANGED
    
    
    
        data/readme.markdown
    CHANGED
    
    | @@ -192,6 +192,7 @@ The signup and edit form fields are named so they pass a hash called 'user' to t | |
| 192 192 | 
             
                   Admin
         | 
| 193 193 | 
             
                 %option{:value => 1, :selected => @user.permission_level == 1}
         | 
| 194 194 | 
             
                   Authenticated user
         | 
| 195 | 
            +
              #if you add attributes to the User class and pass them in the user hash your new attributes will be set along with the others.
         | 
| 195 196 |  | 
| 196 197 | 
             
            The login form fields just pass a field called email and a field called password:
         | 
| 197 198 |  | 
| @@ -205,6 +206,25 @@ To add methods or properties to the User class, you have to access the underlyin | |
| 205 206 | 
             
                  property :has_dog, Boolean, :default => false
         | 
| 206 207 | 
             
                end
         | 
| 207 208 |  | 
| 209 | 
            +
            And then to access/update your newly defined attributes you the User class:
         | 
| 210 | 
            +
             | 
| 211 | 
            +
                current_user.name
         | 
| 212 | 
            +
                current_user.has_dog
         | 
| 213 | 
            +
             | 
| 214 | 
            +
                current_user.update({:has_dog => true})
         | 
| 215 | 
            +
             | 
| 216 | 
            +
                new_user = User.set({:email => 'max@max.com' :password => 'hi', :password_confirmation => 'hi', :name => 'Max', :has_dog => false})
         | 
| 217 | 
            +
             | 
| 218 | 
            +
                User.all(:has_dog => true).each do |user|
         | 
| 219 | 
            +
                  user.update({has_dog => false})
         | 
| 220 | 
            +
                end
         | 
| 221 | 
            +
             | 
| 222 | 
            +
                User.all(:has_dog => false).each do |user|
         | 
| 223 | 
            +
                  user.delete
         | 
| 224 | 
            +
                end
         | 
| 225 | 
            +
             | 
| 226 | 
            +
            the User class passes additional method calls along to the interfacing database class, so calls to Datamapper/Mongomapper/RufusTokyo functions should work as expected.
         | 
| 227 | 
            +
             | 
| 208 228 | 
             
            The database user classes are named as follows:
         | 
| 209 229 |  | 
| 210 230 | 
             
            * for Datamapper:
         | 
| @@ -5,11 +5,11 @@ | |
| 5 5 |  | 
| 6 6 | 
             
            Gem::Specification.new do |s|
         | 
| 7 7 | 
             
              s.name = %q{sinatra-authentication}
         | 
| 8 | 
            -
              s.version = "0.3. | 
| 8 | 
            +
              s.version = "0.3.1"
         | 
| 9 9 |  | 
| 10 10 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 11 | 
             
              s.authors = ["Max Justus Spransy"]
         | 
| 12 | 
            -
              s.date = %q{2010-04- | 
| 12 | 
            +
              s.date = %q{2010-04-18}
         | 
| 13 13 | 
             
              s.description = %q{Simple authentication plugin for sinatra.}
         | 
| 14 14 | 
             
              s.email = %q{maxjustus@gmail.com}
         | 
| 15 15 | 
             
              s.extra_rdoc_files = [
         | 
| @@ -66,7 +66,7 @@ Gem::Specification.new do |s| | |
| 66 66 | 
             
              s.homepage = %q{http://github.com/maxjustus/sinatra-authentication}
         | 
| 67 67 | 
             
              s.rdoc_options = ["--charset=UTF-8"]
         | 
| 68 68 | 
             
              s.require_paths = ["lib"]
         | 
| 69 | 
            -
              s.rubygems_version = %q{1.3. | 
| 69 | 
            +
              s.rubygems_version = %q{1.3.6}
         | 
| 70 70 | 
             
              s.summary = %q{Simple authentication plugin for sinatra.}
         | 
| 71 71 | 
             
              s.test_files = [
         | 
| 72 72 | 
             
                "test/lib/dm_sinbook.rb",
         | 
    
        data/test/lib/dm_extend_app.rb
    CHANGED
    
    | @@ -13,7 +13,7 @@ end | |
| 13 13 | 
             
            DataMapper.setup(:default, "sqlite3://#{Dir.pwd}/test.db")
         | 
| 14 14 | 
             
            DataMapper.auto_migrate!
         | 
| 15 15 |  | 
| 16 | 
            -
            set : | 
| 16 | 
            +
            set :sinatra_authentication_view_path, Pathname(__FILE__).dirname.expand_path + "extend_views/"
         | 
| 17 17 | 
             
            use Rack::Session::Cookie, :secret => "heyhihello"
         | 
| 18 18 | 
             
            use Rack::Flash
         | 
| 19 19 |  | 
| @@ -22,5 +22,6 @@ set :public, 'public' | |
| 22 22 | 
             
            set :views,  'views'
         | 
| 23 23 |  | 
| 24 24 | 
             
            get '/' do
         | 
| 25 | 
            +
              puts User.all(:name => 'max')
         | 
| 25 26 | 
             
              haml "= render_login_logout", :layout => :layout
         | 
| 26 27 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,12 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: sinatra-authentication
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
               | 
| 4 | 
            +
              prerelease: false
         | 
| 5 | 
            +
              segments: 
         | 
| 6 | 
            +
              - 0
         | 
| 7 | 
            +
              - 3
         | 
| 8 | 
            +
              - 1
         | 
| 9 | 
            +
              version: 0.3.1
         | 
| 5 10 | 
             
            platform: ruby
         | 
| 6 11 | 
             
            authors: 
         | 
| 7 12 | 
             
            - Max Justus Spransy
         | 
| @@ -9,79 +14,93 @@ autorequire: | |
| 9 14 | 
             
            bindir: bin
         | 
| 10 15 | 
             
            cert_chain: []
         | 
| 11 16 |  | 
| 12 | 
            -
            date: 2010-04- | 
| 17 | 
            +
            date: 2010-04-18 00:00:00 -05:00
         | 
| 13 18 | 
             
            default_executable: 
         | 
| 14 19 | 
             
            dependencies: 
         | 
| 15 20 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 16 21 | 
             
              name: sinatra
         | 
| 17 | 
            -
               | 
| 18 | 
            -
               | 
| 19 | 
            -
              version_requirements: !ruby/object:Gem::Requirement 
         | 
| 22 | 
            +
              prerelease: false
         | 
| 23 | 
            +
              requirement: &id001 !ruby/object:Gem::Requirement 
         | 
| 20 24 | 
             
                requirements: 
         | 
| 21 25 | 
             
                - - ">="
         | 
| 22 26 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 27 | 
            +
                    segments: 
         | 
| 28 | 
            +
                    - 0
         | 
| 23 29 | 
             
                    version: "0"
         | 
| 24 | 
            -
             | 
| 30 | 
            +
              type: :runtime
         | 
| 31 | 
            +
              version_requirements: *id001
         | 
| 25 32 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 26 33 | 
             
              name: dm-core
         | 
| 27 | 
            -
               | 
| 28 | 
            -
               | 
| 29 | 
            -
              version_requirements: !ruby/object:Gem::Requirement 
         | 
| 34 | 
            +
              prerelease: false
         | 
| 35 | 
            +
              requirement: &id002 !ruby/object:Gem::Requirement 
         | 
| 30 36 | 
             
                requirements: 
         | 
| 31 37 | 
             
                - - ">="
         | 
| 32 38 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 39 | 
            +
                    segments: 
         | 
| 40 | 
            +
                    - 0
         | 
| 33 41 | 
             
                    version: "0"
         | 
| 34 | 
            -
             | 
| 42 | 
            +
              type: :runtime
         | 
| 43 | 
            +
              version_requirements: *id002
         | 
| 35 44 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 36 45 | 
             
              name: dm-validations
         | 
| 37 | 
            -
               | 
| 38 | 
            -
               | 
| 39 | 
            -
              version_requirements: !ruby/object:Gem::Requirement 
         | 
| 46 | 
            +
              prerelease: false
         | 
| 47 | 
            +
              requirement: &id003 !ruby/object:Gem::Requirement 
         | 
| 40 48 | 
             
                requirements: 
         | 
| 41 49 | 
             
                - - ">="
         | 
| 42 50 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 51 | 
            +
                    segments: 
         | 
| 52 | 
            +
                    - 0
         | 
| 43 53 | 
             
                    version: "0"
         | 
| 44 | 
            -
             | 
| 54 | 
            +
              type: :runtime
         | 
| 55 | 
            +
              version_requirements: *id003
         | 
| 45 56 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 46 57 | 
             
              name: dm-timestamps
         | 
| 47 | 
            -
               | 
| 48 | 
            -
               | 
| 49 | 
            -
              version_requirements: !ruby/object:Gem::Requirement 
         | 
| 58 | 
            +
              prerelease: false
         | 
| 59 | 
            +
              requirement: &id004 !ruby/object:Gem::Requirement 
         | 
| 50 60 | 
             
                requirements: 
         | 
| 51 61 | 
             
                - - ">="
         | 
| 52 62 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 63 | 
            +
                    segments: 
         | 
| 64 | 
            +
                    - 0
         | 
| 53 65 | 
             
                    version: "0"
         | 
| 54 | 
            -
             | 
| 66 | 
            +
              type: :runtime
         | 
| 67 | 
            +
              version_requirements: *id004
         | 
| 55 68 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 56 69 | 
             
              name: rufus-tokyo
         | 
| 57 | 
            -
               | 
| 58 | 
            -
               | 
| 59 | 
            -
              version_requirements: !ruby/object:Gem::Requirement 
         | 
| 70 | 
            +
              prerelease: false
         | 
| 71 | 
            +
              requirement: &id005 !ruby/object:Gem::Requirement 
         | 
| 60 72 | 
             
                requirements: 
         | 
| 61 73 | 
             
                - - ">="
         | 
| 62 74 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 75 | 
            +
                    segments: 
         | 
| 76 | 
            +
                    - 0
         | 
| 63 77 | 
             
                    version: "0"
         | 
| 64 | 
            -
             | 
| 78 | 
            +
              type: :runtime
         | 
| 79 | 
            +
              version_requirements: *id005
         | 
| 65 80 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 66 81 | 
             
              name: sinbook
         | 
| 67 | 
            -
               | 
| 68 | 
            -
               | 
| 69 | 
            -
              version_requirements: !ruby/object:Gem::Requirement 
         | 
| 82 | 
            +
              prerelease: false
         | 
| 83 | 
            +
              requirement: &id006 !ruby/object:Gem::Requirement 
         | 
| 70 84 | 
             
                requirements: 
         | 
| 71 85 | 
             
                - - ">="
         | 
| 72 86 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 87 | 
            +
                    segments: 
         | 
| 88 | 
            +
                    - 0
         | 
| 73 89 | 
             
                    version: "0"
         | 
| 74 | 
            -
             | 
| 90 | 
            +
              type: :runtime
         | 
| 91 | 
            +
              version_requirements: *id006
         | 
| 75 92 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 76 93 | 
             
              name: rack-flash
         | 
| 77 | 
            -
               | 
| 78 | 
            -
               | 
| 79 | 
            -
              version_requirements: !ruby/object:Gem::Requirement 
         | 
| 94 | 
            +
              prerelease: false
         | 
| 95 | 
            +
              requirement: &id007 !ruby/object:Gem::Requirement 
         | 
| 80 96 | 
             
                requirements: 
         | 
| 81 97 | 
             
                - - ">="
         | 
| 82 98 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 99 | 
            +
                    segments: 
         | 
| 100 | 
            +
                    - 0
         | 
| 83 101 | 
             
                    version: "0"
         | 
| 84 | 
            -
             | 
| 102 | 
            +
              type: :runtime
         | 
| 103 | 
            +
              version_requirements: *id007
         | 
| 85 104 | 
             
            description: Simple authentication plugin for sinatra.
         | 
| 86 105 | 
             
            email: maxjustus@gmail.com
         | 
| 87 106 | 
             
            executables: []
         | 
| @@ -150,18 +169,20 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 150 169 | 
             
              requirements: 
         | 
| 151 170 | 
             
              - - ">="
         | 
| 152 171 | 
             
                - !ruby/object:Gem::Version 
         | 
| 172 | 
            +
                  segments: 
         | 
| 173 | 
            +
                  - 0
         | 
| 153 174 | 
             
                  version: "0"
         | 
| 154 | 
            -
              version: 
         | 
| 155 175 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement 
         | 
| 156 176 | 
             
              requirements: 
         | 
| 157 177 | 
             
              - - ">="
         | 
| 158 178 | 
             
                - !ruby/object:Gem::Version 
         | 
| 179 | 
            +
                  segments: 
         | 
| 180 | 
            +
                  - 0
         | 
| 159 181 | 
             
                  version: "0"
         | 
| 160 | 
            -
              version: 
         | 
| 161 182 | 
             
            requirements: []
         | 
| 162 183 |  | 
| 163 184 | 
             
            rubyforge_project: 
         | 
| 164 | 
            -
            rubygems_version: 1.3. | 
| 185 | 
            +
            rubygems_version: 1.3.6
         | 
| 165 186 | 
             
            signing_key: 
         | 
| 166 187 | 
             
            specification_version: 3
         | 
| 167 188 | 
             
            summary: Simple authentication plugin for sinatra.
         |