wbzyl-datamapper-tutorial 0.0.8

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.
data/README.markdown ADDED
@@ -0,0 +1,17 @@
1
+ # Samouczek do Datamappera
2
+
3
+ 1. [pastie](http://www.dzone.com/links/datamapper_sinatra_tutorial.html),
4
+ [pastie2](http://blog.zerosum.org/2008/7/2/clone-pastie-with-sinatra-datamapper-redux).
5
+ 2. [ apps written in sinatra, uses datamapper](http://github.com/zapnap/mogo/)
6
+ 3. [A simple Twitter application template, built in Ruby with
7
+ Sinatra and DataMapper](http://github.com/zapnap/retweet/)
8
+
9
+
10
+ ## Gotowce ze świata ActiveRecord
11
+
12
+ 1. Wczytywanie dużych zbiorów danych testowych:
13
+ gem faker.
14
+
15
+ Wczytujemy: 10_000 rekordów: czas?
16
+ 1_000_000 : czas?
17
+
data/Rakefile ADDED
@@ -0,0 +1,38 @@
1
+ require 'rake'
2
+
3
+ begin
4
+ require 'jeweler'
5
+ Jeweler::Tasks.new do |s|
6
+ s.name = "datamapper-tutorial"
7
+ s.author = "Wlodek Bzyl"
8
+ s.email = "matwb@univ.gda.pl"
9
+ s.homepage = "http://github.com/wbzyl/datamapper-tutorial"
10
+
11
+ s.description = <<-EOF
12
+ Moje notatki do Datamappera.
13
+ EOF
14
+ s.summary = "Prosta aplikacja Sinatry."
15
+
16
+ s.files = %w[TODO Rakefile config.ru VERSION.yml] + FileList["lib/**/*"]
17
+
18
+ s.add_dependency 'rack'
19
+ s.add_dependency 'sinatra'
20
+ s.add_dependency 'rdiscount'
21
+ s.add_dependency 'sinatra-rdiscount'
22
+ s.add_dependency 'codehighlighter-middleware'
23
+ s.add_dependency 'coderay'
24
+
25
+ s.rubyforge_project = 'datamapper-tutorial'
26
+ s.extra_rdoc_files = ['README.markdown', 'TODO']
27
+ end
28
+ rescue LoadError
29
+ puts "Jeweler not available."
30
+ puts "Install it with:"
31
+ puts " sudo gem install technicalpickles-jeweler -s http://gems.github.com"
32
+ end
33
+
34
+ Rake::TestTask.new(:test) do |t|
35
+ t.libs << 'lib' << 'test'
36
+ t.pattern = 'test/**/*_test.rb'
37
+ t.verbose = false
38
+ end
data/TODO ADDED
File without changes
data/config.ru ADDED
@@ -0,0 +1,13 @@
1
+ #\ -p 3000 -s thin
2
+
3
+ $LOAD_PATH.unshift("#{File.dirname(__FILE__)}/lib")
4
+ require 'config'
5
+
6
+ #FileUtils.mkdir_p 'log' unless File.exists?('log')
7
+ #log = File.new("log/sinatra.log", "a")
8
+ #STDOUT.reopen(log)
9
+ #STDERR.reopen(log)
10
+
11
+ # require 'rack/cache'
12
+ # use Rack::Cache
13
+ run WB_DatamapperTutorial
@@ -0,0 +1,56 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ # Zobacz przykład: http://gist.github.com/38605
4
+
5
+ gem 'rdiscount'
6
+ gem 'sinatra'
7
+ gem 'wbzyl-sinatra-rdiscount'
8
+
9
+ require 'rdiscount'
10
+ require 'sinatra/base'
11
+ require 'sinatra/rdiscount'
12
+
13
+ module WB
14
+ class DatamapperTutorial < Sinatra::Base
15
+ # disable overriding public and views dirs
16
+ set :app_file, __FILE__
17
+ set :static, true
18
+
19
+ # the middleware stack can be used internally as well. I'm using it for
20
+ # sessions, logging, and methodoverride. This lets us move stuff out of
21
+ # Sinatra if it's better handled by a middleware component.
22
+ set :logging, true # use Rack::CommonLogger
23
+
24
+ helpers Sinatra::RDiscount
25
+
26
+ # configure blocks:
27
+ # configure :production do
28
+ # end
29
+
30
+ #before do
31
+ # mime :sql, 'text/plain; charset="UTF-8"' # when served by Sinatra itself
32
+ #end
33
+
34
+ # helper methods
35
+
36
+ attr_accessor :title
37
+
38
+ get '/' do
39
+ rdiscount :main
40
+ end
41
+
42
+ get '/:section' do
43
+ rdiscount :"#{params[:section]}"
44
+ end
45
+
46
+ error do
47
+ e = request.env['sinatra.error']
48
+ Kernel.puts e.backtrace.join("\n")
49
+ 'Application error'
50
+ end
51
+
52
+ # each Sinatra::Base subclass has its own private middleware stack:
53
+ use Rack::Lint
54
+ end
55
+ end
56
+
@@ -0,0 +1,122 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
+ <title>COLOURlovers - Onyx Mother O Pearl</title>
6
+ <style type="text/css"><!--
7
+
8
+ html {
9
+ padding: 0px;
10
+ margin: 0px;
11
+ }
12
+
13
+ body {
14
+ background-color: #161616;
15
+ font-size: 10px;
16
+ font-family: Verdana, Arial, SunSans-Regular, Sans-Serif;
17
+ color: #cccccc;
18
+ padding: 0px;
19
+ margin: 0px;
20
+ margin-top: 20px;
21
+ }
22
+
23
+ h1 {
24
+ font-size: 16px;
25
+ text-align: center;
26
+ }
27
+
28
+ a {
29
+ font-size: 12px;
30
+ }
31
+ a:link {
32
+ color: #cccccc;
33
+ }
34
+
35
+ a:visited {
36
+ color: #cccccc;
37
+ }
38
+
39
+ a:hover {
40
+ color: #cccccc;
41
+ }
42
+
43
+ a:active {
44
+ color: #cccccc;
45
+ }
46
+
47
+ .border
48
+ {
49
+ border: 1px solid #cccccc;
50
+ float: left;
51
+ margin: 5px;
52
+ padding: 1px;
53
+ }
54
+
55
+ .center {
56
+ text-align: center;
57
+ }
58
+
59
+ .color
60
+ {
61
+ display: block;
62
+ height: 120px;
63
+ width: 120px;
64
+ }
65
+
66
+ .colorcontainer {
67
+ margin: 0px auto;
68
+ width: 670px;
69
+ text-align: center;
70
+ }
71
+
72
+ .colorname {
73
+ text-align: left;
74
+ }
75
+
76
+ --></style>
77
+ </head>
78
+ <body>
79
+ <h1>COLOURlovers - Onyx Mother O Pearl</h1>
80
+ <div class="center">
81
+ <div class="colorcontainer">
82
+ <span class="border" title="#0B030C">
83
+ <span class="color" style="background-color: #0B030C"></span>
84
+ <span class="colorname">
85
+ RGB: 11, 3, 12<br>
86
+ Hex: #0B030C
87
+ </span>
88
+ </span>
89
+ <span class="border" title="#E3E6F7">
90
+ <span class="color" style="background-color: #E3E6F7"></span>
91
+ <span class="colorname">
92
+ RGB: 227, 230, 247<br>
93
+ Hex: #E3E6F7
94
+ </span>
95
+ </span>
96
+ <span class="border" title="#FEF9F0">
97
+ <span class="color" style="background-color: #FEF9F0"></span>
98
+ <span class="colorname">
99
+ RGB: 254, 249, 240<br>
100
+ Hex: #FEF9F0
101
+ </span>
102
+ </span>
103
+ <span class="border" title="#FFE9FD">
104
+ <span class="color" style="background-color: #FFE9FD"></span>
105
+ <span class="colorname">
106
+ RGB: 255, 233, 253<br>
107
+ Hex: #FFE9FD
108
+ </span>
109
+ </span>
110
+ <span class="border" title="#FCE5C0">
111
+ <span class="color" style="background-color: #FCE5C0"></span>
112
+ <span class="colorname">
113
+ RGB: 252, 229, 192<br>
114
+ Hex: #FCE5C0
115
+ </span>
116
+ </span>
117
+
118
+ <a href="http://www.colourlovers.com/palette//Onyx Mother O Pearl" title="Colourlovers Onyx Mother O Pearl">Colourlovers 'Onyx Mother O Pearl' palette</a>
119
+ </div>
120
+ </div>
121
+ </body>
122
+ </html>
File without changes
Binary file
@@ -0,0 +1,113 @@
1
+ html {
2
+ background: #121621 url(src/shattered_mirror.png);
3
+ }
4
+
5
+ body {
6
+ width: 913px;
7
+ margin: 40px 0px 0px 42px;
8
+ padding: 0 0 11px 22px;
9
+ line-height: 1.6;
10
+ -moz-border-radius: 11px;
11
+ border-color: black;
12
+ border-right: 4px inset;
13
+ border-bottom: 4px inset;
14
+ background-color: red;
15
+ background: transparent url(src/body.png) repeat-y;
16
+ }
17
+
18
+ .container {
19
+ width: 561px;
20
+ -moz-border-radius: 11px;
21
+ background-color: rgb(254, 249, 240);
22
+ }
23
+
24
+ h1 {
25
+ width: 880px;
26
+ margin: 0 0 22px -11px;
27
+ padding: 22px 22px 22px 11px;
28
+ font-family: Airmole Stripe, Times, serif;
29
+ font-weight: normal;
30
+ letter-spacing: 2px;
31
+ text-transform: uppercase;
32
+ /* font-variant: small-caps; */
33
+ background-color: #121621;
34
+ color: rgb(237,0,86);
35
+ -moz-border-radius-topright: 7px;
36
+ }
37
+
38
+ h2, h3, h4 {
39
+ margin-right: 11px;
40
+ color: black;
41
+ }
42
+
43
+ h2 {
44
+ border-bottom: 2px dotted black;
45
+ }
46
+
47
+ blockquote {
48
+ /*
49
+ width: 341px;
50
+ margin-left: 561px;
51
+ */
52
+ width: 275px;
53
+ margin: 0 0 0 583px;
54
+ padding: 11px 11px 0 11px;
55
+ position: absolute;
56
+ background: rgb(252, 229, 192);
57
+ -moz-border-radius: 8px;
58
+ }
59
+
60
+ blockquote img {
61
+ margin: 0 auto 11px auto;
62
+ display: block;
63
+ }
64
+
65
+ blockquote p.author {
66
+ margin-top: -1.5em;
67
+ padding-right: 44px;
68
+ color: black;
69
+ font-style: italic;
70
+ text-align: right;
71
+ }
72
+
73
+ pre, code {
74
+ font-family: Andale Mono, monospace;
75
+ }
76
+
77
+ pre {
78
+ margin-left: -33px;
79
+ padding-left: 33px;
80
+ border-left: 22px solid rgb(237,0,86);
81
+ }
82
+
83
+ pre code, li pre {
84
+ margin: 0;
85
+ padding: 0;
86
+ border: none;
87
+ }
88
+
89
+ code {
90
+ margin: 0 2px;
91
+ padding: 0.06em 0.125em;
92
+ border: 1px solid #403B33;
93
+ }
94
+
95
+ caption {
96
+ text-align: right;
97
+ }
98
+
99
+ thead th {
100
+ background-color: #ADD8C7;
101
+ }
102
+
103
+ .table1 {
104
+ background-color: #EB7C7C;
105
+ }
106
+
107
+ .table2 {
108
+ background-color: #ECB39F;
109
+ }
110
+
111
+ li ul {
112
+ margin-bottom: 1.5em;
113
+ }
@@ -0,0 +1,99 @@
1
+ .CodeRay .code pre { overflow: auto }
2
+
3
+ .CodeRay .debug { color:white ! important; background:blue ! important; }
4
+
5
+ .CodeRay .af { color:#00C }
6
+ .CodeRay .an { color:#007 }
7
+ .CodeRay .at { color:#f08 }
8
+ .CodeRay .av { color:#700 }
9
+ .CodeRay .aw { color:#C00 }
10
+ .CodeRay .bi { color:#509; font-weight:bold }
11
+ .CodeRay .c { color:#888; }
12
+
13
+ .CodeRay .ch { color:#04D }
14
+ .CodeRay .ch .k { color:#04D }
15
+ .CodeRay .ch .dl { color:#039 }
16
+
17
+ .CodeRay .cl { color:#B06; font-weight:bold }
18
+ .CodeRay .co { color:#036; font-weight:bold }
19
+ .CodeRay .cr { color:#0A0 }
20
+ .CodeRay .cv { color:#369 }
21
+ .CodeRay .df { color:#099; font-weight:bold }
22
+ .CodeRay .di { color:#088; font-weight:bold }
23
+ .CodeRay .dl { color:black }
24
+ .CodeRay .do { color:#970 }
25
+ .CodeRay .dt { color:#34b }
26
+ .CodeRay .ds { color:#D42; font-weight:bold }
27
+ .CodeRay .e { color:#666; font-weight:bold }
28
+ .CodeRay .en { color:#800; font-weight:bold }
29
+ .CodeRay .er { color:#F00; background-color:#FAA }
30
+ .CodeRay .ex { color:#F00; font-weight:bold }
31
+ .CodeRay .fl { color:#60E; font-weight:bold }
32
+ .CodeRay .fu { color:#06B; font-weight:bold }
33
+ .CodeRay .gv { color:#d70; font-weight:bold }
34
+ .CodeRay .hx { color:#058; font-weight:bold }
35
+ .CodeRay .i { color:#00D; font-weight:bold }
36
+ .CodeRay .ic { color:#B44; font-weight:bold }
37
+
38
+ .CodeRay .il { background: #eee; color: black }
39
+ .CodeRay .il .il { background: #ddd }
40
+ .CodeRay .il .il .il { background: #ccc }
41
+ .CodeRay .il .idl { font-weight: bold; color: #777 }
42
+
43
+ .CodeRay .im { color:#f00; }
44
+ .CodeRay .in { color:#B2B; font-weight:bold }
45
+ .CodeRay .iv { color:#33B }
46
+ .CodeRay .la { color:#970; font-weight:bold }
47
+ .CodeRay .lv { color:#963 }
48
+ .CodeRay .oc { color:#40E; font-weight:bold }
49
+ .CodeRay .of { color:#000; font-weight:bold }
50
+ .CodeRay .op { }
51
+ .CodeRay .pc { color:#038; font-weight:bold }
52
+ .CodeRay .pd { color:#369; font-weight:bold }
53
+ .CodeRay .pp { color:#579; }
54
+ .CodeRay .ps { color:#00C; font-weight: bold; }
55
+ .CodeRay .pt { color:#349; font-weight:bold }
56
+ .CodeRay .r, .kw { color:#080; font-weight:bold }
57
+
58
+ .CodeRay .ke { color: #808; }
59
+ .CodeRay .ke .dl { color: #606; }
60
+ .CodeRay .ke .ch { color: #80f; }
61
+ .CodeRay .vl { color: #088; }
62
+
63
+ .CodeRay .rx { background-color:#fff0ff }
64
+ .CodeRay .rx .k { color:#808 }
65
+ .CodeRay .rx .dl { color:#404 }
66
+ .CodeRay .rx .mod { color:#C2C }
67
+ .CodeRay .rx .fu { color:#404; font-weight: bold }
68
+
69
+ .CodeRay .s { background-color:#fff0f0; color: #D20; }
70
+ .CodeRay .s .s { background-color:#ffe0e0 }
71
+ .CodeRay .s .s .s { background-color:#ffd0d0 }
72
+ .CodeRay .s .k { }
73
+ .CodeRay .s .ch { color: #b0b; }
74
+ .CodeRay .s .dl { color: #710; }
75
+
76
+ .CodeRay .sh { background-color:#f0fff0; color:#2B2 }
77
+ .CodeRay .sh .k { }
78
+ .CodeRay .sh .dl { color:#161 }
79
+
80
+ .CodeRay .sy { color:#A60 }
81
+ .CodeRay .sy .k { color:#A60 }
82
+ .CodeRay .sy .dl { color:#630 }
83
+
84
+ .CodeRay .ta { color:#070 }
85
+ .CodeRay .tf { color:#070; font-weight:bold }
86
+ .CodeRay .ts { color:#D70; font-weight:bold }
87
+ .CodeRay .ty { color:#339; font-weight:bold }
88
+ .CodeRay .v { color:#036 }
89
+ .CodeRay .xt { color:#444 }
90
+
91
+ .CodeRay .ins { background: #afa; }
92
+ .CodeRay .del { background: #faa; }
93
+ .CodeRay .chg { color: #aaf; background: #007; }
94
+ .CodeRay .head { color: #f8f; background: #505 }
95
+
96
+ .CodeRay .ins .ins { color: #080; font-weight:bold }
97
+ .CodeRay .del .del { color: #800; font-weight:bold }
98
+ .CodeRay .chg .chg { color: #66f; }
99
+ .CodeRay .head .head { color: #f4f; }
Binary file
@@ -0,0 +1,26 @@
1
+ /* -----------------------------------------------------------------------
2
+
3
+
4
+ Blueprint CSS Framework 0.8
5
+ http://blueprintcss.org
6
+
7
+ * Copyright (c) 2007-Present. See LICENSE for more info.
8
+ * See README for instructions on how to use Blueprint.
9
+ * For credits and origins, see AUTHORS.
10
+ * This is a compressed file. See the sources in the 'src' directory.
11
+
12
+ ----------------------------------------------------------------------- */
13
+
14
+ /* ie.css */
15
+ body {text-align:center;}
16
+ .container {text-align:left;}
17
+ * html .column, * html div.span-1, * html div.span-2, * html div.span-3, * html div.span-4, * html div.span-5, * html div.span-6, * html div.span-7, * html div.span-8, * html div.span-9, * html div.span-10, * html div.span-11, * html div.span-12, * html div.span-13, * html div.span-14, * html div.span-15, * html div.span-16, * html div.span-17, * html div.span-18, * html div.span-19, * html div.span-20, * html div.span-21, * html div.span-22, * html div.span-23, * html div.span-24 {overflow-x:hidden;}
18
+ * html legend {margin:0px -8px 16px 0;padding:0;}
19
+ ol {margin-left:2em;}
20
+ sup {vertical-align:text-top;}
21
+ sub {vertical-align:text-bottom;}
22
+ html>body p code {*white-space:normal;}
23
+ hr {margin:-8px auto 11px;}
24
+ .clearfix, .container {display:inline-block;}
25
+ * html .clearfix, * html .container {height:1%;}
26
+ fieldset {padding-top:0;}
@@ -0,0 +1,30 @@
1
+ /* -----------------------------------------------------------------------
2
+
3
+
4
+ Blueprint CSS Framework 0.8
5
+ http://blueprintcss.org
6
+
7
+ * Copyright (c) 2007-Present. See LICENSE for more info.
8
+ * See README for instructions on how to use Blueprint.
9
+ * For credits and origins, see AUTHORS.
10
+ * This is a compressed file. See the sources in the 'src' directory.
11
+
12
+ ----------------------------------------------------------------------- */
13
+
14
+ /* print.css */
15
+ body {line-height:1.5;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;color:#000;background:none;font-size:10pt;}
16
+ .container {background:none;}
17
+ hr {background:#ccc;color:#ccc;width:100%;height:2px;margin:2em 0;padding:0;border:none;}
18
+ hr.space {background:#fff;color:#fff;}
19
+ h1, h2, h3, h4, h5, h6 {font-family:"Helvetica Neue", Arial, "Lucida Grande", sans-serif;}
20
+ code {font:.9em "Courier New", Monaco, Courier, monospace;}
21
+ img {float:left;margin:1.5em 1.5em 1.5em 0;}
22
+ a img {border:none;}
23
+ p img.top {margin-top:0;}
24
+ blockquote {margin:1.5em;padding:1em;font-style:italic;font-size:.9em;}
25
+ .small {font-size:.9em;}
26
+ .large {font-size:1.1em;}
27
+ .quiet {color:#999;}
28
+ .hide {display:none;}
29
+ a:link, a:visited {background:transparent;font-weight:700;text-decoration:underline;}
30
+ a:link:after, a:visited:after {content:" (" attr(href) ")";font-size:90%;}
@@ -0,0 +1,267 @@
1
+ /* -----------------------------------------------------------------------
2
+
3
+
4
+ Blueprint CSS Framework 0.8
5
+ http://blueprintcss.org
6
+
7
+ * Copyright (c) 2007-Present. See LICENSE for more info.
8
+ * See README for instructions on how to use Blueprint.
9
+ * For credits and origins, see AUTHORS.
10
+ * This is a compressed file. See the sources in the 'src' directory.
11
+
12
+ ----------------------------------------------------------------------- */
13
+
14
+ /* reset.css */
15
+ html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {margin:0;padding:0;border:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline;}
16
+ body {line-height:1.5;}
17
+ table {border-collapse:separate;border-spacing:0;}
18
+ caption, th, td {text-align:left;font-weight:normal;}
19
+ table, td, th {vertical-align:middle;}
20
+ blockquote:before, blockquote:after, q:before, q:after {content:"";}
21
+ blockquote, q {quotes:"" "";}
22
+ a img {border:none;}
23
+
24
+ /* typography.css */
25
+ body {font-size:100%;color:#222;background:#fff;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;}
26
+ h1, h2, h3, h4, h5, h6 {font-weight:normal;color:#111;}
27
+ h1 {font-size:2em;line-height:1;margin-bottom:0.5em;}
28
+ h2 {font-size:1.6em;margin-bottom:0.75em;}
29
+ h3 {font-size:1.4em;line-height:1;margin-bottom:1em;}
30
+ h4 {font-size:1.2em;line-height:1.25;margin-bottom:1.25em;}
31
+ h5 {font-size:1em;font-weight:bold;margin-bottom:1.5em;}
32
+ h6 {font-size:1em;font-weight:bold;}
33
+ h1 img, h2 img, h3 img, h4 img, h5 img, h6 img {margin:0;}
34
+ p {margin:0 0 1.5em;}
35
+ p img.left {float:left;margin:1.5em 1.5em 1.5em 0;padding:0;}
36
+ p img.right {float:right;margin:1.5em 0 1.5em 1.5em;}
37
+ a:focus, a:hover {color:#000;}
38
+ a {color:#009;text-decoration:underline;}
39
+ blockquote {margin:1.5em;color:#666;font-style:italic;}
40
+ strong {font-weight:bold;}
41
+ em, dfn {font-style:italic;}
42
+ dfn {font-weight:bold;}
43
+ sup, sub {line-height:0;}
44
+ abbr, acronym {border-bottom:1px dotted #666;}
45
+ address {margin:0 0 1.5em;font-style:italic;}
46
+ del {color:#666;}
47
+ pre {margin:1.5em 0;white-space:pre;}
48
+ pre, code, tt {font:1em 'andale mono', 'lucida console', monospace;line-height:1.5;}
49
+ li ul, li ol {margin:0 1.5em;}
50
+ ul, ol {margin:0 1.5em 1.5em 1.5em;}
51
+ ul {list-style-type:disc;}
52
+ ol {list-style-type:decimal;}
53
+ dl {margin:0 0 1.5em 0;}
54
+ dl dt {font-weight:bold;}
55
+ dd {margin-left:1.5em;}
56
+ table {margin-bottom:1.4em;width:100%;}
57
+ th {font-weight:bold;}
58
+ thead th {background:#c3d9ff;}
59
+ th, td, caption {padding:4px 10px 4px 5px;}
60
+ tr.even td {background:#e5ecf9;}
61
+ tfoot {font-style:italic;}
62
+ caption {background:#eee;}
63
+ .small {font-size:.8em;margin-bottom:1.875em;line-height:1.875em;}
64
+ .large {font-size:1.2em;line-height:2.5em;margin-bottom:1.25em;}
65
+ .hide {display:none;}
66
+ .quiet {color:#666;}
67
+ .loud {color:#000;}
68
+ .highlight {background:#ff0;}
69
+ .added {background:#060;color:#fff;}
70
+ .removed {background:#900;color:#fff;}
71
+ .first {margin-left:0;padding-left:0;}
72
+ .last {margin-right:0;padding-right:0;}
73
+ .top {margin-top:0;padding-top:0;}
74
+ .bottom {margin-bottom:0;padding-bottom:0;}
75
+
76
+ /* grid.css */
77
+ /* .container {width:913px;margin:0 auto;} */
78
+ .container {width:913px;margin:0;padding:0 0 0 11px;}
79
+ .showgrid {background:url(src/grid.png);}
80
+ .column, div.span-1, div.span-2, div.span-3, div.span-4, div.span-5, div.span-6, div.span-7, div.span-8, div.span-9, div.span-10, div.span-11, div.span-12, div.span-13, div.span-14, div.span-15, div.span-16, div.span-17, div.span-18, div.span-19, div.span-20, div.span-21 {float:left;margin-right:11px;}
81
+ .last, div.last {margin-right:0;}
82
+ .span-1 {width:33px;}
83
+ .span-2 {width:77px;}
84
+ .span-3 {width:121px;}
85
+ .span-4 {width:165px;}
86
+ .span-5 {width:209px;}
87
+ .span-6 {width:253px;}
88
+ .span-7 {width:297px;}
89
+ .span-8 {width:341px;}
90
+ .span-9 {width:385px;}
91
+ .span-10 {width:429px;}
92
+ .span-11 {width:473px;}
93
+ .span-12 {width:517px;}
94
+ .span-13 {width:561px;}
95
+ .span-14 {width:605px;}
96
+ .span-15 {width:649px;}
97
+ .span-16 {width:693px;}
98
+ .span-17 {width:737px;}
99
+ .span-18 {width:781px;}
100
+ .span-19 {width:825px;}
101
+ .span-20 {width:869px;}
102
+ .span-21, div.span-21 {width:913px;margin:0;}
103
+ input.span-1, textarea.span-1, select.span-1 {width:33px!important;}
104
+ input.span-2, textarea.span-2, select.span-2 {width:56px!important;}
105
+ input.span-3, textarea.span-3, select.span-3 {width:100px!important;}
106
+ input.span-4, textarea.span-4, select.span-4 {width:144px!important;}
107
+ input.span-5, textarea.span-5, select.span-5 {width:188px!important;}
108
+ input.span-6, textarea.span-6, select.span-6 {width:232px!important;}
109
+ input.span-7, textarea.span-7, select.span-7 {width:276px!important;}
110
+ input.span-8, textarea.span-8, select.span-8 {width:320px!important;}
111
+ input.span-9, textarea.span-9, select.span-9 {width:364px!important;}
112
+ input.span-10, textarea.span-10, select.span-10 {width:408px!important;}
113
+ input.span-11, textarea.span-11, select.span-11 {width:452px!important;}
114
+ input.span-12, textarea.span-12, select.span-12 {width:496px!important;}
115
+ input.span-13, textarea.span-13, select.span-13 {width:540px!important;}
116
+ input.span-14, textarea.span-14, select.span-14 {width:584px!important;}
117
+ input.span-15, textarea.span-15, select.span-15 {width:628px!important;}
118
+ input.span-16, textarea.span-16, select.span-16 {width:672px!important;}
119
+ input.span-17, textarea.span-17, select.span-17 {width:716px!important;}
120
+ input.span-18, textarea.span-18, select.span-18 {width:760px!important;}
121
+ input.span-19, textarea.span-19, select.span-19 {width:804px!important;}
122
+ input.span-20, textarea.span-20, select.span-20 {width:848px!important;}
123
+ input.span-21, textarea.span-21, select.span-21 {width:903px!important;}
124
+ .append-1 {padding-right:44px;}
125
+ .append-2 {padding-right:88px;}
126
+ .append-3 {padding-right:132px;}
127
+ .append-4 {padding-right:176px;}
128
+ .append-5 {padding-right:220px;}
129
+ .append-6 {padding-right:264px;}
130
+ .append-7 {padding-right:308px;}
131
+ .append-8 {padding-right:352px;}
132
+ .append-9 {padding-right:396px;}
133
+ .append-10 {padding-right:440px;}
134
+ .append-11 {padding-right:484px;}
135
+ .append-12 {padding-right:528px;}
136
+ .append-13 {padding-right:572px;}
137
+ .append-14 {padding-right:616px;}
138
+ .append-15 {padding-right:660px;}
139
+ .append-16 {padding-right:704px;}
140
+ .append-17 {padding-right:748px;}
141
+ .append-18 {padding-right:792px;}
142
+ .append-19 {padding-right:836px;}
143
+ .append-20 {padding-right:880px;}
144
+ .prepend-1 {padding-left:44px;}
145
+ .prepend-2 {padding-left:88px;}
146
+ .prepend-3 {padding-left:132px;}
147
+ .prepend-4 {padding-left:176px;}
148
+ .prepend-5 {padding-left:220px;}
149
+ .prepend-6 {padding-left:264px;}
150
+ .prepend-7 {padding-left:308px;}
151
+ .prepend-8 {padding-left:352px;}
152
+ .prepend-9 {padding-left:396px;}
153
+ .prepend-10 {padding-left:440px;}
154
+ .prepend-11 {padding-left:484px;}
155
+ .prepend-12 {padding-left:528px;}
156
+ .prepend-13 {padding-left:572px;}
157
+ .prepend-14 {padding-left:616px;}
158
+ .prepend-15 {padding-left:660px;}
159
+ .prepend-16 {padding-left:704px;}
160
+ .prepend-17 {padding-left:748px;}
161
+ .prepend-18 {padding-left:792px;}
162
+ .prepend-19 {padding-left:836px;}
163
+ .prepend-20 {padding-left:880px;}
164
+ div.border {padding-right:4px;margin-right:5px;border-right:1px solid #eee;}
165
+ div.colborder {padding-right:27px;margin-right:27px;border-right:1px solid #eee;}
166
+ .pull-1 {margin-left:-44px;}
167
+ .pull-2 {margin-left:-88px;}
168
+ .pull-3 {margin-left:-132px;}
169
+ .pull-4 {margin-left:-176px;}
170
+ .pull-5 {margin-left:-220px;}
171
+ .pull-6 {margin-left:-264px;}
172
+ .pull-7 {margin-left:-308px;}
173
+ .pull-8 {margin-left:-352px;}
174
+ .pull-9 {margin-left:-396px;}
175
+ .pull-10 {margin-left:-440px;}
176
+ .pull-11 {margin-left:-484px;}
177
+ .pull-12 {margin-left:-528px;}
178
+ .pull-13 {margin-left:-572px;}
179
+ .pull-14 {margin-left:-616px;}
180
+ .pull-15 {margin-left:-660px;}
181
+ .pull-16 {margin-left:-704px;}
182
+ .pull-17 {margin-left:-748px;}
183
+ .pull-18 {margin-left:-792px;}
184
+ .pull-19 {margin-left:-836px;}
185
+ .pull-20 {margin-left:-880px;}
186
+ .pull-21 {margin-left:-924px;}
187
+ .pull-1, .pull-2, .pull-3, .pull-4, .pull-5, .pull-6, .pull-7, .pull-8, .pull-9, .pull-10, .pull-11, .pull-12, .pull-13, .pull-14, .pull-15, .pull-16, .pull-17, .pull-18, .pull-19, .pull-20, .pull-21 {float:left;position:relative;}
188
+ .push-1 {margin:0 -44px 1.5em 44px;}
189
+ .push-2 {margin:0 -88px 1.5em 88px;}
190
+ .push-3 {margin:0 -132px 1.5em 132px;}
191
+ .push-4 {margin:0 -176px 1.5em 176px;}
192
+ .push-5 {margin:0 -220px 1.5em 220px;}
193
+ .push-6 {margin:0 -264px 1.5em 264px;}
194
+ .push-7 {margin:0 -308px 1.5em 308px;}
195
+ .push-8 {margin:0 -352px 1.5em 352px;}
196
+ .push-9 {margin:0 -396px 1.5em 396px;}
197
+ .push-10 {margin:0 -440px 1.5em 440px;}
198
+ .push-11 {margin:0 -484px 1.5em 484px;}
199
+ .push-12 {margin:0 -528px 1.5em 528px;}
200
+ .push-13 {margin:0 -572px 1.5em 572px;}
201
+ .push-14 {margin:0 -616px 1.5em 616px;}
202
+ .push-15 {margin:0 -660px 1.5em 660px;}
203
+ .push-16 {margin:0 -704px 1.5em 704px;}
204
+ .push-17 {margin:0 -748px 1.5em 748px;}
205
+ .push-18 {margin:0 -792px 1.5em 792px;}
206
+ .push-19 {margin:0 -836px 1.5em 836px;}
207
+ .push-20 {margin:0 -880px 1.5em 880px;}
208
+ .push-21 {margin:0 -924px 1.5em 924px;}
209
+ .push-1, .push-2, .push-3, .push-4, .push-5, .push-6, .push-7, .push-8, .push-9, .push-10, .push-11, .push-12, .push-13, .push-14, .push-15, .push-16, .push-17, .push-18, .push-19, .push-20, .push-21 {float:right;position:relative;}
210
+ .prepend-top {margin-top:1.5em;}
211
+ .append-bottom {margin-bottom:1.5em;}
212
+ .box {padding:1.5em;margin-bottom:1.5em;background:#E5ECF9;}
213
+ hr {background:#ddd;color:#ddd;clear:both;float:none;width:100%;height:.1em;margin:0 0 1.45em;border:none;}
214
+ hr.space {background:#fff;color:#fff;}
215
+ .clearfix:after, .container:after {content:"\0020";display:block;height:0;clear:both;visibility:hidden;overflow:hidden;}
216
+ .clearfix, .container {display:block;}
217
+ .clear {clear:both;}
218
+
219
+ /* forms.css */
220
+ label {font-weight:bold;}
221
+ fieldset {padding:1.4em;margin:0 0 1.5em 0;border:1px solid #ccc;}
222
+ legend {font-weight:bold;font-size:1.2em;}
223
+ input.text, input.title, textarea, select {margin:0.5em 0;border:1px solid #bbb;}
224
+ input.text:focus, input.title:focus, textarea:focus, select:focus {border:1px solid #666;}
225
+ input.text, input.title {width:300px;padding:5px;}
226
+ input.title {font-size:1.5em;}
227
+ textarea {width:390px;height:250px;padding:5px;}
228
+ .error, .notice, .success {padding:.8em;margin-bottom:1em;border:2px solid #ddd;}
229
+ .error {background:#FBE3E4;color:#8a1f11;border-color:#FBC2C4;}
230
+ .notice {background:#FFF6BF;color:#514721;border-color:#FFD324;}
231
+ .success {background:#E6EFC2;color:#264409;border-color:#C6D880;}
232
+ .error a {color:#8a1f11;}
233
+ .notice a {color:#514721;}
234
+ .success a {color:#264409;}
235
+
236
+ /* buttons */
237
+ a.button, button {display:block;float:left;margin:0.7em 0.5em 0.7em 0;padding:5px 10px 5px 7px;border:1px solid #dedede;border-top:1px solid #eee;border-left:1px solid #eee;background-color:#f5f5f5;font-family:"Lucida Grande", Tahoma, Arial, Verdana, sans-serif;font-size:100%;line-height:130%;text-decoration:none;font-weight:bold;color:#565656;cursor:pointer;}
238
+ button {width:auto;overflow:visible;padding:4px 10px 3px 7px;}
239
+ button[type] {padding:4px 10px 4px 7px;line-height:17px;}
240
+ *:first-child+html button[type] {padding:4px 10px 3px 7px;}
241
+ button img, a.button img {margin:0 3px -3px 0 !important;padding:0;border:none;width:16px;height:16px;float:none;}
242
+ button:hover, a.button:hover {background-color:#dff4ff;border:1px solid #c2e1ef;color:#336699;}
243
+ a.button:active {background-color:#6299c5;border:1px solid #6299c5;color:#fff;}
244
+ body .positive {color:#529214;}
245
+ a.positive:hover, button.positive:hover {background-color:#E6EFC2;border:1px solid #C6D880;color:#529214;}
246
+ a.positive:active {background-color:#529214;border:1px solid #529214;color:#fff;}
247
+ body .negative {color:#d12f19;}
248
+ a.negative:hover, button.negative:hover {background-color:#fbe3e4;border:1px solid #fbc2c4;color:#d12f19;}
249
+ a.negative:active {background-color:#d12f19;border:1px solid #d12f19;color:#fff;}
250
+
251
+ /* link-icons */
252
+ body a.noicon {background:transparent none !important;padding:0 !important;margin:0 !important;}
253
+ a[href^="http:"], a[href^="mailto:"], a[href^="http:"]:visited, a[href$=".pdf"], a[href$=".doc"], a[href$=".xls"], a[href$=".rss"], a[href$=".rdf"], a[href^="/"] {padding:2px 18px 2px 0;margin:-2px 0;background-repeat:no-repeat;background-position:right center;}
254
+ a[href^="http:"] {background-image:url(icons/external.png);}
255
+ a[href^="mailto:"] {background-image:url(icons/email.png);}
256
+ a[href^="http:"]:visited {background-image:url(icons/visited.png);}
257
+ a[href$=".pdf"] {background-image:url(icons/pdf.png);}
258
+ a[href$=".doc"] {background-image:url(icons/doc.png);}
259
+ a[href$=".xls"] {background-image:url(icons/xls.png);}
260
+ a[href$=".rss"], a[href$=".rdf"] {background-image:url(icons/feed.png);}
261
+ a[href^="/"], a[href^="/"]:visited {background-image:url(icons/im.png);}
262
+ a {text-decoration:none; color:black;border-bottom:1px dotted black;}
263
+ ol li a[href^="/"]:visited {background-image:none;}
264
+
265
+ /* semantic class names */
266
+ #content {float:left;margin-right:11px;width:561px;}
267
+ #footer, #header {float:left;margin-right:11px;width:913px;margin:0;}
Binary file
Binary file
@@ -0,0 +1,11 @@
1
+ #!/bin/bash
2
+
3
+ convert -size 1x913 xc:'#FEF9F0' a.png
4
+ convert -size 1x22 xc:'#0B030C' -alpha set -channel A -fx '0.61' b.png
5
+ convert a.png b.png -append -rotate 90 body.png
6
+ rm a.png b.png
7
+ #convert -size 1x913 xc:'#0B030C' -alpha set -channel A -fx '0.61' a.png
8
+ #convert -size 1x22 xc:'#0B030C' -alpha set -channel A -fx '0.61' b.png
9
+ #convert a.png b.png -append -rotate 90 h1.png
10
+ #rm a.png b.png
11
+ #convert -size 1024x100 xc:'#0B030C' -alpha set -channel A -fx '0.61' h1.png
@@ -0,0 +1,17 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
5
+ <link rel="stylesheet" href="/stylesheets/screen.css" type="text/css" media="screen" charset="utf-8">
6
+ <link rel="stylesheet" href="/stylesheets/print.css" type="text/css" media="print" charset="utf-8">
7
+ <link rel="stylesheet" href="/stylesheets/coderay.css" type="text/css" media="screen" charset="utf-8">
8
+ <link rel="stylesheet" href="/stylesheets/application.css" type="text/css" media="screen" charset="utf-8">
9
+
10
+ <title><%= @title || "Datamapper" %></title>
11
+ </head>
12
+ <body>
13
+ <div class="container">
14
+ <%= yield %>
15
+ </div>
16
+ </body>
17
+ </html>
@@ -0,0 +1,40 @@
1
+ # Datamapper
2
+
3
+ > ![Sir Arthur Conan Doyle](/images/conan_doyle.jpg)
4
+ > I never guess. It is a capital mistake to theorize before one has
5
+ > data. Insensibly one begins to twist facts to suit theories, instead
6
+ > of theories to suit facts.
7
+
8
+ ## Instalacja
9
+
10
+ Instalujemy następujące gemy:
11
+
12
+ sudo gem install dm-core dm-more
13
+ sudo gem install do_sqlite3 do_postgres
14
+ sudo gem install dm-validations dm-timestamps
15
+ sudo gem install dm-aggregates dm-types
16
+
17
+ oraz trochę wtyczek. Wszystkie są
18
+ [opisane tutaj](http://datamapper.org/doku.php?id=docs:more).
19
+
20
+
21
+ ## Zestawianie połączenia z bazą
22
+
23
+ SQLite
24
+
25
+ :::ruby
26
+ # baza danych w RAM
27
+ DataMapper.setup(:default, 'sqlite3::memory:')
28
+ # baza danych plikiem
29
+ DataMapper.setup(:default, "sqlite3:///#{Dir.pwd}/test.sqlite")
30
+
31
+ PostgreSQL
32
+
33
+ :::ruby
34
+ # Postgres 8.2+
35
+ DataMapper.setup(:default, 'postgres://localhost/test')
36
+
37
+ **Uwaga**: You may be wondering how to be more specific about your database
38
+ connection. The second argument can be a hash, containing :host,
39
+ :adapter, :database, :username, :password, :socket, etc. These are
40
+ database-specific but this ought to get you going.
metadata ADDED
@@ -0,0 +1,142 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wbzyl-datamapper-tutorial
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.8
5
+ platform: ruby
6
+ authors:
7
+ - Wlodek Bzyl
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-05-19 00:00:00 -07:00
13
+ default_executable:
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: "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:
35
+ - !ruby/object:Gem::Dependency
36
+ name: rdiscount
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0"
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: sinatra-rdiscount
47
+ type: :runtime
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "0"
54
+ version:
55
+ - !ruby/object:Gem::Dependency
56
+ name: codehighlighter-middleware
57
+ type: :runtime
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: "0"
64
+ version:
65
+ - !ruby/object:Gem::Dependency
66
+ name: coderay
67
+ type: :runtime
68
+ version_requirement:
69
+ version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: "0"
74
+ version:
75
+ description: Moje notki do Datamappera
76
+ email: matwb@univ.gda.pl
77
+ executables: []
78
+
79
+ extensions: []
80
+
81
+ extra_rdoc_files:
82
+ - README.markdown
83
+ - TODO
84
+ files:
85
+ - Rakefile
86
+ - config.ru
87
+ - lib/datamapper-tutorial.rb
88
+ - lib/public/Onyx_Mother_O_Pearl.html
89
+ - lib/public/favicon.ico
90
+ - lib/public/images/conan_doyle.jpg
91
+ - lib/public/stylesheets/application.css
92
+ - lib/public/stylesheets/coderay.css
93
+ - lib/public/stylesheets/icons/cross.png
94
+ - lib/public/stylesheets/icons/doc.png
95
+ - lib/public/stylesheets/icons/email.png
96
+ - lib/public/stylesheets/icons/external.png
97
+ - lib/public/stylesheets/icons/feed.png
98
+ - lib/public/stylesheets/icons/im.png
99
+ - lib/public/stylesheets/icons/key.png
100
+ - lib/public/stylesheets/icons/pdf.png
101
+ - lib/public/stylesheets/icons/tick.png
102
+ - lib/public/stylesheets/icons/visited.png
103
+ - lib/public/stylesheets/icons/xls.png
104
+ - lib/public/stylesheets/ie.css
105
+ - lib/public/stylesheets/print.css
106
+ - lib/public/stylesheets/screen.css
107
+ - lib/public/stylesheets/src/body.png
108
+ - lib/public/stylesheets/src/grid.png
109
+ - lib/public/stylesheets/src/make_background_images.sh
110
+ - lib/public/stylesheets/src/shattered_mirror.png
111
+ - lib/views/layout.rdiscount
112
+ - lib/views/main.rdiscount
113
+ - README.markdown
114
+ - TODO
115
+ has_rdoc: false
116
+ homepage: http://github.com/wbzyl/tutorial
117
+ post_install_message:
118
+ rdoc_options:
119
+ - --charset=UTF-8
120
+ require_paths:
121
+ - lib
122
+ required_ruby_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: "0"
127
+ version:
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: "0"
133
+ version:
134
+ requirements: []
135
+
136
+ rubyforge_project: datamapper-tutorial
137
+ rubygems_version: 1.2.0
138
+ signing_key:
139
+ specification_version: 3
140
+ summary: Prosta aplikacja Sinatry
141
+ test_files: []
142
+