sinatra-helpers 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,6 +1,27 @@
1
1
  = sinatra-helpers
2
2
 
3
- Description goes here.
3
+ Bare minimum, close to the metal helpers for your average sinatra application.
4
+
5
+ == Examples
6
+
7
+ %select(name='card[month'])
8
+ != month_choices
9
+
10
+ %select(name='card[year'])
11
+ != year_choices
12
+
13
+ %select(name='address[country]')
14
+ != country_choices
15
+
16
+ # If you have an ohm model which you want to present the errors of:
17
+ # (this is taken from the reddit-clone courtesy of citrusbyte)
18
+
19
+ # This should be put in your HAML file
20
+
21
+ - errors_on @user do |e|
22
+ - e.on [:email, :not_present] "You must supply an email address"
23
+ - e.on [:password, :not_present] "A password is required"
24
+ - e.on [:password, :not_confirmed] "You must confirm your password"
4
25
 
5
26
  == Note on Patches/Pull Requests
6
27
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -1,4 +1,5 @@
1
1
  require 'date'
2
+ require 'sinatra/helpers/compat-1.8.6'
2
3
 
3
4
  module Sinatra
4
5
  module Helpers
@@ -11,7 +12,7 @@ module Sinatra
11
12
 
12
13
  def month_choices
13
14
  Date::MONTHNAMES.map.
14
- with_index { |month, i| ["%d - %s" % [i, month], i] }.
15
+ with_index { |month, idx| ["%d - %s" % [idx, month], idx] }.
15
16
  tap { |arr| arr.shift }
16
17
  end
17
18
 
@@ -0,0 +1,27 @@
1
+ # Taken from ohm
2
+
3
+ unless "".respond_to?(:lines)
4
+ class String
5
+
6
+ # This version of String#lines is almost fully compatible with that
7
+ # of Ruby 1.9. If a zero-length record separator is supplied in Ruby
8
+ # 1.9, the string is split into paragraphs delimited by multiple
9
+ # successive newlines. This replacement ignores that feature in
10
+ # favor of code simplicity.
11
+ def lines(separator = $/)
12
+ result = split(separator).map { |part| "#{part}#{separator}" }
13
+ result.each { |r| yield r } if block_given?
14
+ result
15
+ end
16
+ end
17
+ end
18
+
19
+ unless respond_to?(:tap)
20
+ class Object
21
+ def tap
22
+ yield(self)
23
+ self
24
+ end
25
+ end
26
+ end
27
+
@@ -0,0 +1,55 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{sinatra-helpers}
8
+ s.version = "0.1.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Cyril David"]
12
+ s.date = %q{2010-05-06}
13
+ s.description = %q{Includes month_choices, year_choices, country_choices}
14
+ s.email = %q{cyx.ucron@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "LICENSE",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "lib/sinatra/helpers.rb",
27
+ "lib/sinatra/helpers/compat-1.8.6.rb",
28
+ "lib/sinatra/helpers/country.rb",
29
+ "lib/sinatra/helpers/haml_error_presenter.rb",
30
+ "sinatra-helpers.gemspec",
31
+ "test/helper.rb"
32
+ ]
33
+ s.homepage = %q{http://github.com/sinefunc/sinatra-helpers}
34
+ s.rdoc_options = ["--charset=UTF-8"]
35
+ s.require_paths = ["lib"]
36
+ s.rubygems_version = %q{1.3.6}
37
+ s.summary = %q{Some generic helpers for the view layer}
38
+ s.test_files = [
39
+ "test/helper.rb"
40
+ ]
41
+
42
+ if s.respond_to? :specification_version then
43
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
44
+ s.specification_version = 3
45
+
46
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
47
+ s.add_development_dependency(%q<contest>, [">= 0"])
48
+ else
49
+ s.add_dependency(%q<contest>, [">= 0"])
50
+ end
51
+ else
52
+ s.add_dependency(%q<contest>, [">= 0"])
53
+ end
54
+ end
55
+
data/test/helper.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'test/unit'
3
- require 'shoulda'
3
+ require 'contest'
4
4
 
5
5
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
6
  $LOAD_PATH.unshift(File.dirname(__FILE__))
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Cyril David
@@ -46,10 +46,11 @@ files:
46
46
  - Rakefile
47
47
  - VERSION
48
48
  - lib/sinatra/helpers.rb
49
+ - lib/sinatra/helpers/compat-1.8.6.rb
49
50
  - lib/sinatra/helpers/country.rb
50
51
  - lib/sinatra/helpers/haml_error_presenter.rb
52
+ - sinatra-helpers.gemspec
51
53
  - test/helper.rb
52
- - test/test_sinatra-helpers.rb
53
54
  has_rdoc: true
54
55
  homepage: http://github.com/sinefunc/sinatra-helpers
55
56
  licenses: []
@@ -82,4 +83,3 @@ specification_version: 3
82
83
  summary: Some generic helpers for the view layer
83
84
  test_files:
84
85
  - test/helper.rb
85
- - test/test_sinatra-helpers.rb
@@ -1,7 +0,0 @@
1
- require 'helper'
2
-
3
- class TestSinatraHelpers < 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