wbzyl-sinatra-math 0.0.1 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 1
2
+ :patch: 4
3
3
  :major: 0
4
4
  :minor: 0
@@ -1,2 +1,3 @@
1
+ gem 'sinatra-math'
1
2
  require 'sinatra-math'
2
3
  run Sinatra::Pi.new
@@ -1,2 +1,3 @@
1
+ gem 'sinatra-math'
1
2
  require 'sinatra-math'
2
3
  run Sinatra::Sqrt2.new
@@ -0,0 +1,14 @@
1
+ html {
2
+ margin: 0;
3
+ padding: 0;
4
+ background: white 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: #EEE;
13
+ font: normal 14px/1.6 Arial, Helvetica, sans-serif;
14
+ }
@@ -19,8 +19,8 @@ module Sinatra
19
19
  end
20
20
 
21
21
  class Sqrt2 < Sinatra::Base
22
- set :views, Proc.new { File.join(root, "lib/views") }
23
- set :public, Proc.new { File.join(root, "lib/public") }
24
- set :static, true
22
+ # layout uses CSS
23
+ set :app_file, __FILE__
24
+ set :static, true
25
25
  end
26
26
  end
@@ -4,13 +4,11 @@ include BigMath
4
4
 
5
5
  module Sinatra
6
6
  class Pi < Sinatra::Base
7
-
8
7
  get '/?' do
9
8
  prec = params[:prec].to_i
10
9
  @pi = PI(prec + 1).to_s("10F")
11
10
  @cname = 'PI'
12
- erb :pi, :layout => :layout2
11
+ erb :pi
13
12
  end
14
-
15
13
  end
16
14
  end
@@ -1,16 +1,21 @@
1
+ gem 'sinatra-static-assets'
2
+ require 'sinatra/static_assets'
3
+
1
4
  require 'bigdecimal'
2
5
  require 'bigdecimal/math'
3
6
  include BigMath
4
7
 
5
8
  module Sinatra
6
9
  class Sqrt2 < Sinatra::Base
7
-
10
+ helpers Sinatra::UrlForHelper
11
+ helpers Sinatra::StaticAssets
12
+
8
13
  get '/?' do
9
14
  prec = params[:prec].to_i
10
15
  @sqrt2 = BigDecimal('2').sqrt(prec + 1).to_s("10F")
11
16
  @cname = 'square root of 2'
12
- erb :sqrt2
13
- end
17
+ erb :sqrt2, :layout => :layout2
18
+ end
14
19
 
15
20
  end
16
21
  end
@@ -0,0 +1,22 @@
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/aapp.css" media="screen" rel="stylesheet" type="text/css">
9
+
10
+ -->
11
+
12
+ <%= stylesheet_link_tag "/stylesheets/app.css" %>
13
+
14
+ <title><%= @title %></title>
15
+ </head>
16
+
17
+ <body>
18
+
19
+ <%= yield %>
20
+
21
+ </body>
22
+ </html>
@@ -0,0 +1,83 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{sinatra-math}
5
+ s.version = "0.0.4"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Wlodek Bzyl"]
9
+ s.date = %q{2009-05-25}
10
+ s.description = %q{This gem contains four modular Sinatra applications:
11
+ Pi, Euler, Sqrt2, Phi (golden ratio).
12
+
13
+ These applications can be used to play with:
14
+ * experiment with new and existing Rack Middleware
15
+ * combine modular Sinatra app with Rack::Builder
16
+ * embed one Rack application into another Rack application
17
+ }
18
+ s.email = %q{matwb@univ.gda.pl}
19
+ s.extra_rdoc_files = [
20
+ "README.markdown"
21
+ ]
22
+ s.files = [
23
+ ".gitignore",
24
+ "README.markdown",
25
+ "Rakefile",
26
+ "VERSION.yml",
27
+ "config.rb",
28
+ "config.ru",
29
+ "examples/app.rb",
30
+ "examples/euler.ru",
31
+ "examples/mathlobster.rb",
32
+ "examples/mathlobster.ru",
33
+ "examples/menagerie.rb",
34
+ "examples/phi.ru",
35
+ "examples/pi.ru",
36
+ "examples/rapp.ru",
37
+ "examples/sqrt2.ru",
38
+ "lib/public/stylesheets/app.css",
39
+ "lib/public/stylesheets/src/background.png",
40
+ "lib/sinatra-math.rb",
41
+ "lib/sinatra-math/euler.rb",
42
+ "lib/sinatra-math/phi.rb",
43
+ "lib/sinatra-math/pi.rb",
44
+ "lib/sinatra-math/sqrt2.rb",
45
+ "lib/views/euler.erb",
46
+ "lib/views/index.erb",
47
+ "lib/views/layout.erb",
48
+ "lib/views/layout2.erb",
49
+ "lib/views/phi.erb",
50
+ "lib/views/pi.erb",
51
+ "lib/views/sqrt2.erb",
52
+ "sinatra-math.gemspec"
53
+ ]
54
+ s.homepage = %q{http://github.com/wbzyl/sinatra-math}
55
+ s.rdoc_options = ["--charset=UTF-8"]
56
+ s.require_paths = ["lib"]
57
+ s.rubygems_version = %q{1.3.3}
58
+ s.summary = %q{Several modular Sinatra apps to play with and iteratively construct new Rack apps.}
59
+ s.test_files = [
60
+ "examples/menagerie.rb",
61
+ "examples/app.rb",
62
+ "examples/mathlobster.rb"
63
+ ]
64
+
65
+ if s.respond_to? :specification_version then
66
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
67
+ s.specification_version = 3
68
+
69
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
70
+ s.add_runtime_dependency(%q<sinatra>, [">= 0.9.2"])
71
+ s.add_runtime_dependency(%q<rack>, [">= 1.0.0"])
72
+ s.add_development_dependency(%q<rack-test>, [">= 0.3.0"])
73
+ else
74
+ s.add_dependency(%q<sinatra>, [">= 0.9.2"])
75
+ s.add_dependency(%q<rack>, [">= 1.0.0"])
76
+ s.add_dependency(%q<rack-test>, [">= 0.3.0"])
77
+ end
78
+ else
79
+ s.add_dependency(%q<sinatra>, [">= 0.9.2"])
80
+ s.add_dependency(%q<rack>, [">= 1.0.0"])
81
+ s.add_dependency(%q<rack-test>, [">= 0.3.0"])
82
+ end
83
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wbzyl-sinatra-math
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wlodek Bzyl
@@ -66,6 +66,8 @@ files:
66
66
  - examples/pi.ru
67
67
  - examples/rapp.ru
68
68
  - examples/sqrt2.ru
69
+ - lib/public/stylesheets/app.css
70
+ - lib/public/stylesheets/src/background.png
69
71
  - lib/sinatra-math.rb
70
72
  - lib/sinatra-math/euler.rb
71
73
  - lib/sinatra-math/phi.rb
@@ -74,9 +76,11 @@ files:
74
76
  - lib/views/euler.erb
75
77
  - lib/views/index.erb
76
78
  - lib/views/layout.erb
79
+ - lib/views/layout2.erb
77
80
  - lib/views/phi.erb
78
81
  - lib/views/pi.erb
79
82
  - lib/views/sqrt2.erb
83
+ - sinatra-math.gemspec
80
84
  has_rdoc: false
81
85
  homepage: http://github.com/wbzyl/sinatra-math
82
86
  post_install_message: