sinatra_more 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -37,11 +37,9 @@ different components based on which pieces are useful for your application.
37
37
  require 'sinatra_more'
38
38
 
39
39
  class Application < Sinatra::Base
40
- register SinatraMore
40
+ register SinatraMore::MarkupPlugin
41
+ register SinatraMore::RenderPlugin
41
42
  register SinatraMore::WardenPlugin
42
- # (Not yet) register SinatraMore::MarkupHelpers
43
- # (Not yet) register SinatraMore::RenderHelpers
44
- # (Not yet) register SinatraMore::FormHelpers
45
43
  end
46
44
 
47
45
  This will then allow you to use whichever components that have been registered. A breakdown is below:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
@@ -1,15 +1,5 @@
1
1
  require 'sinatra/base'
2
2
 
3
- require File.join(File.dirname(__FILE__) + '/sinatra_more/warden_helpers')
4
- require File.join(File.dirname(__FILE__) + '/sinatra_more/view_helpers')
5
- Dir.glob(File.dirname(__FILE__) + '/sinatra_more/form_builder/*.rb').each { |f| require f }
6
-
7
- module SinatraMore
8
- def self.registered(app)
9
- app.helpers TagHelpers
10
- app.helpers AssetTagHelpers
11
- app.helpers FormHelpers
12
- app.helpers FormatHelpers
13
- app.helpers RenderHelpers
14
- end
15
- end
3
+ require File.join(File.dirname(__FILE__) + '/sinatra_more/markup_plugin')
4
+ require File.join(File.dirname(__FILE__) + '/sinatra_more/render_plugin')
5
+ require File.join(File.dirname(__FILE__) + '/sinatra_more/warden_plugin')
@@ -0,0 +1,12 @@
1
+ Dir.glob(File.dirname(__FILE__) + '/markup_plugin/**/*.rb').each { |f| require f }
2
+
3
+ module SinatraMore
4
+ module MarkupPlugin
5
+ def self.registered(app)
6
+ app.helpers TagHelpers
7
+ app.helpers AssetTagHelpers
8
+ app.helpers FormHelpers
9
+ app.helpers FormatHelpers
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,9 @@
1
+ Dir.glob(File.dirname(__FILE__) + '/render_plugin/**/*.rb').each { |f| require f }
2
+
3
+ module SinatraMore
4
+ module RenderPlugin
5
+ def self.registered(app)
6
+ app.helpers RenderHelpers
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,24 @@
1
+ Dir.glob(File.dirname(__FILE__) + '/warden_plugin/**/*.rb').each { |f| require f }
2
+
3
+ module SinatraMore
4
+ module WardenPlugin
5
+ def self.registered(app)
6
+ app.helpers SinatraMore::WardenHelpers
7
+
8
+ # TODO Improve serializing methods
9
+ Warden::Manager.serialize_into_session{ |user| user.nil? ? nil : user.id }
10
+ Warden::Manager.serialize_from_session{ |id| id.nil? ? nil : User.find(id) }
11
+
12
+ Warden::Strategies.add(:password) do
13
+ def valid?
14
+ params['username'] || params['password']
15
+ end
16
+
17
+ def authenticate!
18
+ u = User.authenticate(params['username'], params['password'])
19
+ u.nil? ? fail!("Could not log in") : success!(u)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -42,25 +42,4 @@ module SinatraMore
42
42
  request.env['warden']
43
43
  end
44
44
  end
45
-
46
- module WardenPlugin
47
- def self.registered(app)
48
- app.helpers SinatraMore::WardenHelpers
49
-
50
- # TODO Improve serializing
51
- Warden::Manager.serialize_into_session{ |user| user.nil? ? nil : user.id }
52
- Warden::Manager.serialize_from_session{ |id| id.nil? ? nil : User.find(id) }
53
-
54
- Warden::Strategies.add(:password) do
55
- def valid?
56
- params['username'] || params['password']
57
- end
58
-
59
- def authenticate!
60
- u = User.authenticate(params['username'], params['password'])
61
- u.nil? ? fail!("Could not log in") : success!(u)
62
- end
63
- end
64
- end
65
- end
66
- end
45
+ end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sinatra_more}
8
- s.version = "0.0.4"
8
+ s.version = "0.0.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Nathan Esquenazi"]
@@ -25,15 +25,17 @@ Gem::Specification.new do |s|
25
25
  "TODO",
26
26
  "VERSION",
27
27
  "lib/sinatra_more.rb",
28
- "lib/sinatra_more/form_builder/abstract_form_builder.rb",
29
- "lib/sinatra_more/form_builder/standard_form_builder.rb",
30
- "lib/sinatra_more/view_helpers.rb",
31
- "lib/sinatra_more/view_helpers/asset_tag_helpers.rb",
32
- "lib/sinatra_more/view_helpers/form_helpers.rb",
33
- "lib/sinatra_more/view_helpers/format_helpers.rb",
34
- "lib/sinatra_more/view_helpers/render_helpers.rb",
35
- "lib/sinatra_more/view_helpers/tag_helpers.rb",
36
- "lib/sinatra_more/warden_helpers.rb",
28
+ "lib/sinatra_more/markup_plugin.rb",
29
+ "lib/sinatra_more/markup_plugin/asset_tag_helpers.rb",
30
+ "lib/sinatra_more/markup_plugin/form_builder/abstract_form_builder.rb",
31
+ "lib/sinatra_more/markup_plugin/form_builder/standard_form_builder.rb",
32
+ "lib/sinatra_more/markup_plugin/form_helpers.rb",
33
+ "lib/sinatra_more/markup_plugin/format_helpers.rb",
34
+ "lib/sinatra_more/markup_plugin/render_helpers.rb",
35
+ "lib/sinatra_more/markup_plugin/tag_helpers.rb",
36
+ "lib/sinatra_more/render_plugin.rb",
37
+ "lib/sinatra_more/warden_plugin.rb",
38
+ "lib/sinatra_more/warden_plugin/warden_helpers.rb",
37
39
  "sinatra_more.gemspec",
38
40
  "test/helper.rb",
39
41
  "test/test_sinatra_more.rb"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra_more
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Esquenazi
@@ -40,15 +40,17 @@ files:
40
40
  - TODO
41
41
  - VERSION
42
42
  - lib/sinatra_more.rb
43
- - lib/sinatra_more/form_builder/abstract_form_builder.rb
44
- - lib/sinatra_more/form_builder/standard_form_builder.rb
45
- - lib/sinatra_more/view_helpers.rb
46
- - lib/sinatra_more/view_helpers/asset_tag_helpers.rb
47
- - lib/sinatra_more/view_helpers/form_helpers.rb
48
- - lib/sinatra_more/view_helpers/format_helpers.rb
49
- - lib/sinatra_more/view_helpers/render_helpers.rb
50
- - lib/sinatra_more/view_helpers/tag_helpers.rb
51
- - lib/sinatra_more/warden_helpers.rb
43
+ - lib/sinatra_more/markup_plugin.rb
44
+ - lib/sinatra_more/markup_plugin/asset_tag_helpers.rb
45
+ - lib/sinatra_more/markup_plugin/form_builder/abstract_form_builder.rb
46
+ - lib/sinatra_more/markup_plugin/form_builder/standard_form_builder.rb
47
+ - lib/sinatra_more/markup_plugin/form_helpers.rb
48
+ - lib/sinatra_more/markup_plugin/format_helpers.rb
49
+ - lib/sinatra_more/markup_plugin/render_helpers.rb
50
+ - lib/sinatra_more/markup_plugin/tag_helpers.rb
51
+ - lib/sinatra_more/render_plugin.rb
52
+ - lib/sinatra_more/warden_plugin.rb
53
+ - lib/sinatra_more/warden_plugin/warden_helpers.rb
52
54
  - sinatra_more.gemspec
53
55
  - test/helper.rb
54
56
  - test/test_sinatra_more.rb
@@ -1 +0,0 @@
1
- Dir.glob(File.dirname(__FILE__) + '/view_helpers/*.rb').each { |f| require f }