wbzyl-sinatra-static-assets 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/TODO ADDED
File without changes
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 7
3
2
  :major: 0
4
3
  :minor: 0
4
+ :patch: 8
@@ -0,0 +1,14 @@
1
+ require 'mapp'
2
+
3
+ Mapp1 = Rack::Builder.new do
4
+ use Rack::ShowExceptions
5
+ use Rack::Lint
6
+
7
+ use Rack::Static, :urls => ["/stylesheets", "/images"], :root => "public"
8
+
9
+ map '/' do
10
+ run Sinatra::Mapp1.new
11
+ end
12
+ end
13
+
14
+ run Mapp1
@@ -0,0 +1,24 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require 'sinatra/base'
4
+
5
+ gem 'sinatra-static-assets'
6
+ require 'sinatra/static_assets'
7
+
8
+ module Sinatra
9
+ class Mapp1 < Sinatra::Base
10
+ helpers Sinatra::UrlForHelper
11
+ helpers Sinatra::StaticAssets
12
+
13
+ set :app_file, __FILE__
14
+ set :static, true
15
+
16
+ #set :root, File.dirname(__FILE__)
17
+ #set :views, Proc.new { File.join(root, "views") }
18
+
19
+ get '/' do
20
+ @title = "Tatra Mountains, Błyszcz (2159 m)"
21
+ erb :app
22
+ end
23
+ end
24
+ end
@@ -0,0 +1 @@
1
+ /* mapp1 */
@@ -0,0 +1,14 @@
1
+ html {
2
+ margin: 0;
3
+ padding: 0;
4
+ background: #ABA418 url(src/background.png);
5
+ }
6
+
7
+ body {
8
+ width: 600px;
9
+ margin: 1em auto;
10
+ padding: 1em 2em;
11
+ border: black solid 1px;
12
+ background-color: #D1C704;
13
+ font: normal 14px/1.6 Arial, Helvetica, sans-serif;
14
+ }
File without changes
@@ -0,0 +1,3 @@
1
+ <h2><%= @title %></h2>
2
+
3
+ <p><%= image_tag "/images/tatry1.jpg", :closed => true, :alt => @title, :title => @title %></p>
@@ -0,0 +1,23 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" http://www.w3.org/TR/html4/strict.dtd">
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
5
+
6
+ <!-- does not work
7
+
8
+ <link charset="utf-8" href="/stylesheets/mapp.css" media="screen" rel="stylesheet" type="text/css">
9
+
10
+ -->
11
+
12
+ <%= stylesheet_link_tag "/stylesheets/mapp.css" %>
13
+ <%= javascript_script_tag "/javascripts/mapp.js" %>
14
+
15
+ <title><%= @title %></title>
16
+ </head>
17
+
18
+ <body>
19
+
20
+ <%= yield %>
21
+
22
+ </body>
23
+ </html>
@@ -0,0 +1,14 @@
1
+ require 'mapp'
2
+
3
+ Mapp2 = Rack::Builder.new do
4
+ use Rack::ShowExceptions
5
+ use Rack::Lint
6
+
7
+ use Rack::Static, :urls => ["/stylesheets", "/images"], :root => "public"
8
+
9
+ map '/' do
10
+ run Sinatra::Mapp2.new
11
+ end
12
+ end
13
+
14
+ run Mapp2
@@ -0,0 +1,21 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require 'sinatra/base'
4
+
5
+ gem 'sinatra-static-assets'
6
+ require 'sinatra/static_assets'
7
+
8
+ module Sinatra
9
+ class Mapp2 < Sinatra::Base
10
+ helpers Sinatra::UrlForHelper
11
+ helpers Sinatra::StaticAssets
12
+
13
+ set :app_file, __FILE__
14
+ set :static, true
15
+
16
+ get '/' do
17
+ @title = "Tatra Mountains, Dolina Gąsienicowa (1500 m)"
18
+ erb :mapp
19
+ end
20
+ end
21
+ end
@@ -0,0 +1 @@
1
+ /* mapp.js */
@@ -0,0 +1,14 @@
1
+ html {
2
+ margin: 0;
3
+ padding: 0;
4
+ background: #ABA418 url(src/background.png);
5
+ }
6
+
7
+ body {
8
+ width: 600px;
9
+ margin: 1em auto;
10
+ padding: 1em 2em;
11
+ border: black solid 1px;
12
+ background-color: #D8E8FF;
13
+ font: normal 14px/1.6 Arial, Helvetica, sans-serif;
14
+ }
File without changes
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" http://www.w3.org/TR/html4/strict.dtd">
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
5
+ <%= stylesheet_link_tag "/stylesheets/mapp.css" %>
6
+ <%= javascript_script_tag "/javascripts/mapp.js" %>
7
+
8
+ <title><%= @title %></title>
9
+ </head>
10
+
11
+ <body>
12
+
13
+ <%= yield %>
14
+
15
+ </body>
16
+ </html>
@@ -0,0 +1,3 @@
1
+ <h2><%= @title %></h2>
2
+
3
+ <p><%= image_tag "/images/tatry2.jpg", :closed => true, :alt => @title, :title => @title %></p>
@@ -0,0 +1,19 @@
1
+ require 'mapp1/mapp'
2
+ require 'mapp2/mapp'
3
+
4
+ Mapp = Rack::Builder.new do
5
+ use Rack::ShowExceptions
6
+ use Rack::Lint
7
+
8
+ #use Rack::Static, :urls => ["/stylesheets", "/images"], :root => "public"
9
+
10
+ map '/mapp1' do
11
+ run Sinatra::Mapp1.new
12
+ end
13
+
14
+ map '/mapp2' do
15
+ run Sinatra::Mapp2.new
16
+ end
17
+ end
18
+
19
+ run Mapp
@@ -9,8 +9,8 @@ module Sinatra
9
9
  #
10
10
  # TODO
11
11
  #
12
- # option: html -> closed == false
13
- # option: xhtml -> closed == true
12
+ # option: doctype => html -> closed == false
13
+ # option: doctype => xhtml -> closed == true
14
14
  #
15
15
  # In HTML the <img> tag has no end tag:
16
16
  #
@@ -44,7 +44,11 @@ module Sinatra
44
44
  list, options = extract_options(sources)
45
45
  list.collect { |source| javascript_tag(source, options) }.join("\n")
46
46
  end
47
-
47
+
48
+ def link_to(desc, url)
49
+ "<a href='#{url_for url}'>#{desc}</a>"
50
+ end
51
+
48
52
  private
49
53
 
50
54
  def tag(name, options = {}, closed = false)
metadata CHANGED
@@ -1,17 +1,37 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wbzyl-sinatra-static-assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
- - "W\xC5\x82odek Bzyl"
7
+ - Wlodek Bzyl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-24 00:00:00 -07:00
12
+ date: 2009-05-31 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rack
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.0.0
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: sinatra
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
15
35
  - !ruby/object:Gem::Dependency
16
36
  name: emk-sinatra-url-for
17
37
  type: :runtime
@@ -22,7 +42,17 @@ dependencies:
22
42
  - !ruby/object:Gem::Version
23
43
  version: 0.2.1
24
44
  version:
25
- description: Sinatra extension providing helper methods to output tags for static assets.
45
+ - !ruby/object:Gem::Dependency
46
+ name: rack-test
47
+ type: :development
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 0.3.0
54
+ version:
55
+ description: "This Sinatra extensions provides following helper methods: - image_tag - stylesheet_link_tag - javascript_script_tag"
26
56
  email: matwb@univ.gda.pl
27
57
  executables: []
28
58
 
@@ -32,10 +62,7 @@ extra_rdoc_files:
32
62
  - LICENSE
33
63
  - README.markdown
34
64
  files:
35
- - .gitignore
36
- - LICENSE
37
- - README.markdown
38
- - Rakefile
65
+ - TODO
39
66
  - VERSION.yml
40
67
  - examples/app1/app1.rb
41
68
  - examples/app1/config.ru
@@ -55,12 +82,31 @@ files:
55
82
  - examples/app2/tmp/always_restart.txt
56
83
  - examples/app2/views/index.erb
57
84
  - examples/app2/views/layout.erb
85
+ - examples/mapp1/config.ru
86
+ - examples/mapp1/mapp.rb
87
+ - examples/mapp1/public/images/tatry1.jpg
88
+ - examples/mapp1/public/javascripts/mapp.js
89
+ - examples/mapp1/public/stylesheets/mapp.css
90
+ - examples/mapp1/public/stylesheets/src/background.png
91
+ - examples/mapp1/tmp/always_restart.txt
92
+ - examples/mapp1/views/app.erb
93
+ - examples/mapp1/views/layout.erb
94
+ - examples/mapp2/config.ru
95
+ - examples/mapp2/mapp.rb
96
+ - examples/mapp2/public/images/tatry2.jpg
97
+ - examples/mapp2/public/javascripts/mapp.js
98
+ - examples/mapp2/public/stylesheets/mapp.css
99
+ - examples/mapp2/public/stylesheets/src/background.png
100
+ - examples/mapp2/tmp/always_restart.txt
101
+ - examples/mapp2/views/layout.erb
102
+ - examples/mapp2/views/mapp.erb
103
+ - examples/mconfig.ru
58
104
  - examples/sinatra.conf
59
- - lib/sinatra/extract_options.rb
60
105
  - lib/sinatra/static_assets.rb
61
- - sinatra-static-assets.gemspec
62
106
  - test/sinatra_static_assets_test.rb
63
107
  - test/test_helper.rb
108
+ - LICENSE
109
+ - README.markdown
64
110
  has_rdoc: false
65
111
  homepage: http://github.com/wbzyl/sinatra-static-assets
66
112
  post_install_message:
@@ -82,13 +128,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
128
  version:
83
129
  requirements: []
84
130
 
85
- rubyforge_project:
131
+ rubyforge_project: sinatra-static-assets
86
132
  rubygems_version: 1.2.0
87
133
  signing_key:
88
134
  specification_version: 3
89
- summary: Sinatra extension providing helper methods to output tags for static assets.
135
+ summary: Sinatra extension providing helper methods to output tags for static assetgemspec.
90
136
  test_files:
91
137
  - test/test_helper.rb
92
138
  - test/sinatra_static_assets_test.rb
93
139
  - examples/app2/app2.rb
140
+ - examples/mapp2/mapp.rb
141
+ - examples/mapp1/mapp.rb
94
142
  - examples/app1/app1.rb
data/.gitignore DELETED
@@ -1,5 +0,0 @@
1
- pkg/*
2
- *~
3
- \#*
4
- .\#*
5
-
data/Rakefile DELETED
@@ -1,29 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- require 'rake'
4
- require 'rake/testtask'
5
- require "rake/clean"
6
-
7
- begin
8
- require 'jeweler'
9
- Jeweler::Tasks.new do |s|
10
- s.name = "sinatra-static-assets"
11
- s.summary = "Sinatra extension providing helper methods to output tags for static assets."
12
- s.email = "matwb@univ.gda.pl"
13
- s.homepage = "http://github.com/wbzyl/sinatra-static-assets"
14
- s.description = s.summary
15
- s.authors = ["Włodek Bzyl"]
16
-
17
- s.add_dependency 'emk-sinatra-url-for', '>=0.2.1'
18
- end
19
- rescue LoadError
20
- puts "Jeweler not available."
21
- puts "Install it with:"
22
- puts " sudo gem install technicalpickles-jeweler -s http://gems.github.com"
23
- end
24
-
25
- Rake::TestTask.new(:test) do |t|
26
- t.libs << 'lib' << 'test'
27
- t.pattern = 'test/**/*_test.rb'
28
- t.verbose = false
29
- end
@@ -1,18 +0,0 @@
1
- #
2
- # file borrowed from Ruby on Rails:
3
- # activesupport/lib/active_support/core_ext/array/extract_options.rb
4
- #
5
- class Array
6
- # Extracts options from a set of arguments. Removes and returns the last
7
- # element in the array if it's a hash, otherwise returns a blank hash.
8
- #
9
- # def options(*args)
10
- # args.extract_options!
11
- # end
12
- #
13
- # options(1, 2) # => {}
14
- # options(1, 2, :a => :b) # => {:a=>:b}
15
- def extract_options!
16
- last.is_a?(::Hash) ? pop : {}
17
- end
18
- end
@@ -1,71 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- Gem::Specification.new do |s|
4
- s.name = %q{sinatra-static-assets}
5
- s.version = "0.0.7"
6
-
7
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["W\305\202odek Bzyl"]
9
- s.date = %q{2009-05-24}
10
- s.description = %q{Sinatra extension providing helper methods to output tags for static assets.}
11
- s.email = %q{matwb@univ.gda.pl}
12
- s.extra_rdoc_files = [
13
- "LICENSE",
14
- "README.markdown"
15
- ]
16
- s.files = [
17
- ".gitignore",
18
- "LICENSE",
19
- "README.markdown",
20
- "Rakefile",
21
- "VERSION.yml",
22
- "examples/app1/app1.rb",
23
- "examples/app1/config.ru",
24
- "examples/app1/public/images/tatry1.jpg",
25
- "examples/app1/public/javascripts/app1.js",
26
- "examples/app1/public/stylesheets/app1.css",
27
- "examples/app1/public/stylesheets/src/bronzed_olive.png",
28
- "examples/app1/tmp/always_restart.txt",
29
- "examples/app1/views/index.erb",
30
- "examples/app1/views/layout.erb",
31
- "examples/app2/app2.rb",
32
- "examples/app2/config.ru",
33
- "examples/app2/public/images/tatry2.jpg",
34
- "examples/app2/public/javascripts/app2.js",
35
- "examples/app2/public/stylesheets/app2.css",
36
- "examples/app2/public/stylesheets/src/skating.png",
37
- "examples/app2/tmp/always_restart.txt",
38
- "examples/app2/views/index.erb",
39
- "examples/app2/views/layout.erb",
40
- "examples/sinatra.conf",
41
- "lib/sinatra/extract_options.rb",
42
- "lib/sinatra/static_assets.rb",
43
- "sinatra-static-assets.gemspec",
44
- "test/sinatra_static_assets_test.rb",
45
- "test/test_helper.rb"
46
- ]
47
- s.homepage = %q{http://github.com/wbzyl/sinatra-static-assets}
48
- s.rdoc_options = ["--charset=UTF-8"]
49
- s.require_paths = ["lib"]
50
- s.rubygems_version = %q{1.3.3}
51
- s.summary = %q{Sinatra extension providing helper methods to output tags for static assets.}
52
- s.test_files = [
53
- "test/test_helper.rb",
54
- "test/sinatra_static_assets_test.rb",
55
- "examples/app2/app2.rb",
56
- "examples/app1/app1.rb"
57
- ]
58
-
59
- if s.respond_to? :specification_version then
60
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
61
- s.specification_version = 3
62
-
63
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
64
- s.add_runtime_dependency(%q<emk-sinatra-url-for>, [">= 0.2.1"])
65
- else
66
- s.add_dependency(%q<emk-sinatra-url-for>, [">= 0.2.1"])
67
- end
68
- else
69
- s.add_dependency(%q<emk-sinatra-url-for>, [">= 0.2.1"])
70
- end
71
- end