georgedrummond_sinatra_helpers 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Rakefile +1 -0
- data/georgedrummond_sinatra_helpers.gemspec +24 -0
- data/lib/georgedrummond_sinatra_helpers.rb +36 -0
- data/lib/georgedrummond_sinatra_helpers/version.rb +3 -0
- metadata +71 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "georgedrummond_sinatra_helpers/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "georgedrummond_sinatra_helpers"
|
7
|
+
s.version = GeorgedrummondSinatraHelpers::VERSION
|
8
|
+
s.authors = ["George Drummond"]
|
9
|
+
s.email = ["george@accountsapp.com"]
|
10
|
+
s.homepage = ""
|
11
|
+
s.summary = %q{Common helper methods}
|
12
|
+
s.description = %q{Some common helper methods I use in my apps}
|
13
|
+
|
14
|
+
s.rubyforge_project = "georgedrummond_sinatra_helpers"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
# s.add_development_dependency "rspec"
|
23
|
+
# s.add_runtime_dependency "rest-client"
|
24
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require "georgedrummond_sinatra_helpers/version"
|
2
|
+
|
3
|
+
module GeorgeDrummond
|
4
|
+
module Sinatra
|
5
|
+
module Helpers
|
6
|
+
|
7
|
+
def stylesheet_link_tag(*sources)
|
8
|
+
html = []
|
9
|
+
sources.each do |stylesheet|
|
10
|
+
path = "/css/#{stylesheet}.css"
|
11
|
+
html << "<link href=\"#{ url(path) }\" type=\"text/css\" />"
|
12
|
+
end
|
13
|
+
return html.join("\n")
|
14
|
+
end
|
15
|
+
|
16
|
+
def javascript_include_tag(*sources)
|
17
|
+
html = []
|
18
|
+
sources.each do |javascript|
|
19
|
+
path = "/js/#{javascript}.js"
|
20
|
+
html << "<script type=\"text/javascript\" src=\"#{ url(path) }\"></script>"
|
21
|
+
end
|
22
|
+
return html.join("\n")
|
23
|
+
end
|
24
|
+
|
25
|
+
def image_tag(image)
|
26
|
+
path = "/images/#{image}"
|
27
|
+
return "<img src=\"#{url(path)}\" />\n"
|
28
|
+
end
|
29
|
+
|
30
|
+
def link_to(title, path)
|
31
|
+
return "<a href=\"#{url(path)}\">#{title}</a>"
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: georgedrummond_sinatra_helpers
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- George Drummond
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-10-16 00:00:00 Z
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: Some common helper methods I use in my apps
|
22
|
+
email:
|
23
|
+
- george@accountsapp.com
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files: []
|
29
|
+
|
30
|
+
files:
|
31
|
+
- .gitignore
|
32
|
+
- Gemfile
|
33
|
+
- Rakefile
|
34
|
+
- georgedrummond_sinatra_helpers.gemspec
|
35
|
+
- lib/georgedrummond_sinatra_helpers.rb
|
36
|
+
- lib/georgedrummond_sinatra_helpers/version.rb
|
37
|
+
homepage: ""
|
38
|
+
licenses: []
|
39
|
+
|
40
|
+
post_install_message:
|
41
|
+
rdoc_options: []
|
42
|
+
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
none: false
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
hash: 3
|
51
|
+
segments:
|
52
|
+
- 0
|
53
|
+
version: "0"
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 3
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
version: "0"
|
63
|
+
requirements: []
|
64
|
+
|
65
|
+
rubyforge_project: georgedrummond_sinatra_helpers
|
66
|
+
rubygems_version: 1.8.10
|
67
|
+
signing_key:
|
68
|
+
specification_version: 3
|
69
|
+
summary: Common helper methods
|
70
|
+
test_files: []
|
71
|
+
|