ratpack 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,18 +1,31 @@
1
1
  = ratpack
2
2
 
3
- Description goes here.
4
-
5
- == Note on Patches/Pull Requests
6
-
7
- * Fork the project.
8
- * Make your feature addition or bug fix.
9
- * Add tests for it. This is important so I don't break it in a
10
- future version unintentionally.
11
- * Commit, do not mess with rakefile, version, or history.
12
- (if you want to have your own version, that is fine but
13
- bump version in a commit by itself I can ignore when I pull)
14
- * Send me a pull request. Bonus points for topic branches.
3
+ Common Rails view helpers, rewritten and wrapped up in a gem for use in your Sinatra app.
4
+
5
+ == Installation
6
+
7
+ Install {gemcutter}[http://gemcutter.org] if you haven't already:
8
+
9
+ sudo gem install gemcutter
10
+ gem tumble
11
+
12
+ Install the ratpack gem:
13
+
14
+ sudo gem install ratpack
15
+
16
+ Drop this line in your app:
17
+
18
+ require 'sinatra/ratpack'
19
+
20
+ == Usage
21
+
22
+ See auto-generated documentation at {rdoc.info/projects/zeke/ratpack}[http://rdoc.info/projects/zeke/ratpack]
23
+
24
+ == Colophon
25
+
26
+ Thanks to the Sinatra page {Writing Extensions}[http://www.sinatrarb.com/extensions.html]
27
+ Gem built with http://github.com/technicalpickles/jeweler/
15
28
 
16
29
  == Copyright
17
30
 
18
- Copyright (c) 2009 Zeke Sikelianos. See LICENSE for details.
31
+ Copyright (c) 2009 Zeke Sikelianos. See LICENSE for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -15,7 +15,6 @@ module Sinatra
15
15
 
16
16
  # Accepts a single filename or an array of filenames (with or without .css extension)
17
17
  # Assumes stylesheets are in public/stylesheets
18
- # TODO: allow for media type to specified
19
18
  def stylesheet_link_tag(string_or_array)
20
19
  files = string_or_array.is_a?(Array) ? string_or_array : [string_or_array]
21
20
  files.map do |file|
@@ -24,21 +23,26 @@ module Sinatra
24
23
  end.join("\n")
25
24
  end
26
25
 
27
- def image(src,options={})
28
- options[:src] = src.include?("/") ? src : "/images/#{src}"
26
+ # Accepts a full URL, an image filename, or a path underneath /public/images/
27
+ def image_tag(src,options={})
28
+ options[:src] = src.include?("://") ? src : "/images/#{src}"
29
29
  tag(:img, options)
30
30
  end
31
-
32
- def link(content,href,options={})
31
+
32
+ # Works like link_to, but href is optional. If no href supplied, content is used as href
33
+ def link_to(content,href=nil,options={})
34
+ href ||= content
33
35
  options.update :href => href
34
36
  content_tag :a, content, options
35
37
  end
36
38
 
39
+ # Just like Rails' content_tag
37
40
  def content_tag(name,content,options={})
38
41
  options = options.map{ |k,v| "#{k}='#{v}'" }.join(" ")
39
42
  "<#{name} #{options}>#{content}</#{name}>"
40
43
  end
41
44
 
45
+ # Just like Rails' tag
42
46
  def tag(name,options={})
43
47
  options = options.map{ |k,v| "#{k}='#{v}'" }.join(" ")
44
48
  "<#{name} #{options} />"
@@ -47,7 +51,6 @@ module Sinatra
47
51
  # Give this helper an array, and get back a string of <li> elements.
48
52
  # The first item gets a class of first and the last, well.. last.
49
53
  # This makes it easier to apply CSS styles to lists, be they ordered or unordered.
50
- # http://zeke.tumblr.com/post/98025647/a-nice-little-view-helper-for-generating-list-items
51
54
  def convert_to_list_items(items)
52
55
  items.inject([]) do |all, item|
53
56
  css = []
data/ratpack.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ratpack}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Zeke Sikelianos"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ratpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zeke Sikelianos