sharp 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f14fd10ff351041624cc62b49aff7992cebeaf97
4
- data.tar.gz: 68c4c6646f5a5b7602b4e65e85714553bbf2e511
3
+ metadata.gz: 56a3c1b04900e2eac73293a6154091656f396064
4
+ data.tar.gz: d205ccaa90533b6cb4172acb4da134d80cd5bbc8
5
5
  SHA512:
6
- metadata.gz: 48f0fb545bbae6faee5fe3e3d0918e07870debc8a14c897757555c32902386e6c21194c014d946669d12c6389227a3e5b70449b3ec4f64678dbec04ce5801e26
7
- data.tar.gz: f4390112607d781dc05580b604b70856515263d55b26766ba3bde1a4de7026419e423b537cad1e2382dc0ae5075de79afbb400af2d11473990add70290de98ed
6
+ metadata.gz: f0053271cadaefdc097eac457834f5f87748c4bca1425fcbdc11ed462b86c628170a95d5babca035f5f541e0defcc84e63bde016d38e95dad1f091a5d2f171d6
7
+ data.tar.gz: 546ada98108d2cced8007707b6676f15fd120ea6171be1937b15c2cfb888c96cd269a4994b35bdaac0d4aa39e26a65f21a89a31d822af665e055645988bf6dfc
data/TUTORIAL.md CHANGED
@@ -124,8 +124,6 @@ end
124
124
 
125
125
  Huh, not much going on there, is there? That's because the default behavior of an action is to render the template that matches the name of the action. In this case, the action is `app/actions/root_action.rb`, so the template will be `templates/root.erb`. We'll cover actions in more depth later, but let's take a look at the template next.
126
126
 
127
- But in case you are curious now, Sharp actions are [Rack::Action][rack-action], so you can read up on the documentation for [Rack::Action][rack-action] to find out more about what you can do with actions.
128
-
129
127
  # Templates
130
128
 
131
129
  There is what the template that is used to generate our response, `templates/root.erb`, looks like:
@@ -246,6 +244,8 @@ end
246
244
 
247
245
  In this example, unless there is a param password equal to "secret", a redirect response will be generate, which prevents the action from calling the respond method and instead returns the redirect response.
248
246
 
247
+ Each Sharp action is an instance of `Rack::Action`, so you can read the documentation for [rack-action][rack-action] to find out more about what you can do with actions.
248
+
249
249
  # Custom Views
250
250
 
251
251
  Another way to make data available to the templates in Sharp is by creating a view object that corresponds to your action. Create a file at `app/views/root_view.rb` that looks like this:
@@ -267,7 +267,7 @@ end
267
267
 
268
268
  If you hit the root URL in your browser or with curl now, you will see the same result. It is a good practice to build up a hierarchy of view objects and use inheritance to share functionality between related views.
269
269
 
270
- The functionality for the view layer in Sharp is provided by [Curtain][curtain]. If you are looking for more information on what you can do with views, take a look at the documentation for [Curtain][curtain].
270
+ Each Sharp view is an instance of `Curtain::View`, so you read the documentation on [Curtain][curtain] to find out more about what you can do with views.
271
271
 
272
272
  # Console
273
273
 
data/lib/sharp.rb CHANGED
@@ -5,6 +5,7 @@ require 'pathname'
5
5
  require 'rack-action'
6
6
  require 'rack-router'
7
7
  require 'stringio'
8
+ require 'uri'
8
9
  require 'yaml'
9
10
  require 'sharp/action'
10
11
  require 'sharp/config'
@@ -74,11 +75,12 @@ module Sharp
74
75
  end
75
76
 
76
77
  # Generates a Rack env Hash
77
- def self.env(method, path, query={}, env={})
78
+ def self.env(method, path, env={})
79
+ uri = URI.parse(path)
78
80
  DEFAULT_ENV.merge(env || {}).merge(
79
81
  'REQUEST_METHOD' => method.to_s.upcase,
80
- 'PATH_INFO' => path,
81
- 'QUERY_STRING' => query.to_param,
82
+ 'PATH_INFO' => uri.path,
83
+ 'QUERY_STRING' => uri.query,
82
84
  'rack.input' => StringIO.new)
83
85
  end
84
86
 
data/lib/sharp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sharp
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
data/sharp.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = "sharp"
5
- gem.version = "0.3.2"
5
+ gem.version = "0.3.3"
6
6
  gem.authors = ["Paul Barry"]
7
7
  gem.email = ["mail@paulbarry.com"]
8
8
  gem.description = %q{A Ruby and Rack-based web framework}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sharp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Barry