cassandra 0.2.3 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/CHANGELOG +12 -0
- data/LICENSE +202 -0
- data/Manifest +24 -17
- data/README +65 -0
- data/Rakefile +13 -0
- data/cassandra.gemspec +22 -117
- data/conf/cassandra.in.sh +55 -0
- data/conf/log4j.properties +38 -0
- data/conf/storage-conf.xml +197 -0
- data/lib/cassandra.rb +21 -159
- data/lib/cassandra/array.rb +8 -0
- data/lib/cassandra/cassandra.rb +315 -0
- data/lib/cassandra/comparable.rb +28 -0
- data/lib/cassandra/constants.rb +8 -0
- data/lib/cassandra/helper.rb +85 -0
- data/lib/cassandra/long.rb +39 -0
- data/lib/cassandra/ordered_hash.rb +135 -0
- data/lib/cassandra/safe_client.rb +21 -0
- data/lib/cassandra/serialization.rb +57 -0
- data/lib/cassandra/time.rb +9 -0
- data/lib/cassandra/uuid.rb +44 -0
- data/quickstart.sh +12 -0
- data/test/cassandra_client_test.rb +302 -0
- data/test/comparable_types_test.rb +44 -0
- data/vendor/gen-rb/cassandra.rb +1138 -0
- data/vendor/gen-rb/cassandra_constants.rb +10 -0
- data/vendor/gen-rb/cassandra_types.rb +239 -0
- metadata +90 -37
- metadata.gz.sig +1 -0
- data/README.rdoc +0 -29
- data/lib/properties.rb +0 -119
- data/lib/tags.rb +0 -89
- data/misc/dan.rb +0 -64
- data/misc/meyer_reset.css +0 -53
- data/site/basic.cssy +0 -12
- data/site/basic.rb +0 -19
- data/site/cssy_title.jpg +0 -0
- data/site/flower.png +0 -0
- data/site/index.mab +0 -22
- data/site/ruby.cssy +0 -15
- data/test/basics.rb +0 -107
- data/test/dan.cssy +0 -160
- data/test/fiddle.css +0 -22
- data/test/fiddle.cssy +0 -34
- data/test/helper.rb +0 -8
data/lib/properties.rb
DELETED
@@ -1,119 +0,0 @@
|
|
1
|
-
class Cassandra
|
2
|
-
CSS_PROPERTIES = %w{
|
3
|
-
azimuth
|
4
|
-
background
|
5
|
-
background_attachment
|
6
|
-
background_color
|
7
|
-
background_image
|
8
|
-
background_position
|
9
|
-
background_repeat
|
10
|
-
border
|
11
|
-
border_left
|
12
|
-
border_top
|
13
|
-
border_right
|
14
|
-
border_bottom
|
15
|
-
border_collapse
|
16
|
-
border_color
|
17
|
-
border_spacing
|
18
|
-
border_style
|
19
|
-
border_top
|
20
|
-
border_top_color
|
21
|
-
border_top_style
|
22
|
-
border_top_width
|
23
|
-
border_width
|
24
|
-
bottom
|
25
|
-
caption_side
|
26
|
-
clear
|
27
|
-
clip
|
28
|
-
color
|
29
|
-
content
|
30
|
-
counter_increment
|
31
|
-
counter_reset
|
32
|
-
cue
|
33
|
-
cue_after
|
34
|
-
cue_before
|
35
|
-
cursor
|
36
|
-
direction
|
37
|
-
display
|
38
|
-
elevation
|
39
|
-
empty_cells
|
40
|
-
float
|
41
|
-
font
|
42
|
-
font_family
|
43
|
-
font_size
|
44
|
-
font_size_adjust
|
45
|
-
font_stretch
|
46
|
-
font_style
|
47
|
-
font_variant
|
48
|
-
font_weight
|
49
|
-
height
|
50
|
-
left
|
51
|
-
letter_spacing
|
52
|
-
line_height
|
53
|
-
list_style
|
54
|
-
list_style_image
|
55
|
-
list_style_position
|
56
|
-
list_style_type
|
57
|
-
margin
|
58
|
-
margin_left
|
59
|
-
margin_top
|
60
|
-
margin_right
|
61
|
-
margin_bottom
|
62
|
-
marker_offset
|
63
|
-
marks
|
64
|
-
max_height
|
65
|
-
max_width
|
66
|
-
min_height
|
67
|
-
min_width
|
68
|
-
orphans
|
69
|
-
outline
|
70
|
-
outline_color
|
71
|
-
outline_style
|
72
|
-
outline_width
|
73
|
-
overflow
|
74
|
-
padding
|
75
|
-
padding_left
|
76
|
-
padding_top
|
77
|
-
padding_right
|
78
|
-
padding_bottom
|
79
|
-
page
|
80
|
-
page_break_after
|
81
|
-
page_break_before
|
82
|
-
page_break_inside
|
83
|
-
pause
|
84
|
-
pause_after
|
85
|
-
pause_before
|
86
|
-
pitch
|
87
|
-
pitch_range
|
88
|
-
play_during
|
89
|
-
position
|
90
|
-
quotes
|
91
|
-
richness
|
92
|
-
right
|
93
|
-
size
|
94
|
-
speak
|
95
|
-
speak_header
|
96
|
-
speak_numeral
|
97
|
-
speak_punctuation
|
98
|
-
speech_rate
|
99
|
-
stress
|
100
|
-
table_layout
|
101
|
-
text_align
|
102
|
-
text_decoration
|
103
|
-
text_indent
|
104
|
-
text_shadow
|
105
|
-
text_transform
|
106
|
-
top
|
107
|
-
unicode_bidi
|
108
|
-
vertical_align
|
109
|
-
visibility
|
110
|
-
voice_family
|
111
|
-
volume
|
112
|
-
white_space
|
113
|
-
widows
|
114
|
-
width
|
115
|
-
word_spacing
|
116
|
-
z_index
|
117
|
-
}
|
118
|
-
|
119
|
-
end
|
data/lib/tags.rb
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
class Cassandra
|
2
|
-
HTML_TAGS = [
|
3
|
-
:a,
|
4
|
-
:abbr,
|
5
|
-
:acronym,
|
6
|
-
:address,
|
7
|
-
:area,
|
8
|
-
:b,
|
9
|
-
:base,
|
10
|
-
:bdo,
|
11
|
-
:big,
|
12
|
-
:blockquote,
|
13
|
-
:body,
|
14
|
-
:br,
|
15
|
-
:button,
|
16
|
-
:caption,
|
17
|
-
:cite,
|
18
|
-
:code,
|
19
|
-
:col,
|
20
|
-
:colgroup,
|
21
|
-
:dd,
|
22
|
-
:del,
|
23
|
-
:dfn,
|
24
|
-
:div,
|
25
|
-
:dl,
|
26
|
-
:dt,
|
27
|
-
:em,
|
28
|
-
:fieldset,
|
29
|
-
:form,
|
30
|
-
:h1,
|
31
|
-
:h2,
|
32
|
-
:h3,
|
33
|
-
:h4,
|
34
|
-
:h5,
|
35
|
-
:h6,
|
36
|
-
:head,
|
37
|
-
:hr,
|
38
|
-
:html,
|
39
|
-
:i,
|
40
|
-
:img,
|
41
|
-
:input,
|
42
|
-
:ins,
|
43
|
-
:kbd,
|
44
|
-
:label,
|
45
|
-
:legend,
|
46
|
-
:li,
|
47
|
-
:link,
|
48
|
-
:map,
|
49
|
-
:meta,
|
50
|
-
:noscript,
|
51
|
-
:object,
|
52
|
-
:ol,
|
53
|
-
:optgroup,
|
54
|
-
:option,
|
55
|
-
:p,
|
56
|
-
:param,
|
57
|
-
:pre,
|
58
|
-
:q,
|
59
|
-
:samp,
|
60
|
-
:script,
|
61
|
-
:select,
|
62
|
-
:small,
|
63
|
-
:span,
|
64
|
-
:strong,
|
65
|
-
:style,
|
66
|
-
:sub,
|
67
|
-
:sup,
|
68
|
-
:table,
|
69
|
-
:tbody,
|
70
|
-
:td,
|
71
|
-
:textarea,
|
72
|
-
:tfoot,
|
73
|
-
:th,
|
74
|
-
:thead,
|
75
|
-
:title,
|
76
|
-
:tr,
|
77
|
-
:tt,
|
78
|
-
:ul,
|
79
|
-
:var,
|
80
|
-
]
|
81
|
-
|
82
|
-
# define tag methods to delegate to selector_eval
|
83
|
-
methods = HTML_TAGS.map do |tag|
|
84
|
-
"def #{tag}(&block); selector_eval(@selector.first, '#{tag}', &block);end\n"
|
85
|
-
end.join
|
86
|
-
|
87
|
-
module_eval methods
|
88
|
-
|
89
|
-
end
|
data/misc/dan.rb
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
# Experimental alternative from Dan Yoder
|
2
|
-
|
3
|
-
%w( rubygems functor ).each { |file| require file }
|
4
|
-
class CSS # :nodoc:
|
5
|
-
|
6
|
-
include Functor::Method
|
7
|
-
|
8
|
-
# Functor needs instance_exec, which needs instance_eval and send ...
|
9
|
-
METHODS = %w( class functor instance_eval instance_exec send __send__ __id__ )
|
10
|
-
instance_methods.each { |m| undef_method( m ) unless METHODS.include? m }
|
11
|
-
|
12
|
-
|
13
|
-
TAGS = %w( a abbr acronym address area b base bdo big blockquote body br button caption
|
14
|
-
cite code col colgroup dd del dfn div dl dt em fieldset form h1 h2 h3 h4 h5 h6 head hr
|
15
|
-
html i img input ins kbd label legend li link map meta noscript object ol optgroup option
|
16
|
-
p param pre q samp script select small span strong style sub sup table tbody td textarea
|
17
|
-
tfoot th thead title tr tt ul var _ )
|
18
|
-
ATTRS = %w( background border clear color display float font height letter_spacing
|
19
|
-
line-height list margin max outline padding text )
|
20
|
-
COMBINATORS = %w( + / > )
|
21
|
-
|
22
|
-
ROWS = %w( height top bottom ) ; COLS = %w( width left right )
|
23
|
-
|
24
|
-
def self.css( &block ) ; @start = block ; end
|
25
|
-
|
26
|
-
def render
|
27
|
-
__start ; instance_eval( &( self.class.module_eval { @start } ) )
|
28
|
-
@output.reverse.map { |sel, attrs| puts sel.inspect ; "#{sel.join('').strip} { #{attrs} }" }.join("\n")
|
29
|
-
end
|
30
|
-
|
31
|
-
def select( s )
|
32
|
-
selector = @selectors[-1].dup << s
|
33
|
-
@selectors << selector ; @buffers << @buffer
|
34
|
-
@buffer = '' ; yield ; @output << [ selector, @buffer ]
|
35
|
-
@selectors.pop ; @buffer = @buffers.pop
|
36
|
-
end
|
37
|
-
|
38
|
-
# grid support
|
39
|
-
def units ; 'px' ; end
|
40
|
-
def cols( n ) "#{n}#{units}" ; end
|
41
|
-
def rows( n ) "#{n}#{units}" ; end
|
42
|
-
|
43
|
-
def method_missing( name, *args, &block ) ; __process( name.to_s, args, block ) ; self ; end
|
44
|
-
|
45
|
-
private
|
46
|
-
|
47
|
-
def __start ; @output = [] ; @selectors = [ [] ] ; @selector = [] ; @buffers = [] ; @buffer = '' ; end
|
48
|
-
def __open( sel ) @selector << [ sel ] ; end
|
49
|
-
def __append( sel ) ( __open( sel ) if @selector.empty? ) or ( @selector[-1] << sel ) ; end
|
50
|
-
def __close( block ) s = @selector ; @selector = [] ; select( s, &block ) ; end
|
51
|
-
def __combine( op ) @output[-1][0][-1] << op ; end
|
52
|
-
|
53
|
-
functor( :__process, lambda { | name | ATTRS.include?( name ) }, Array, nil ) { | name, args, block | __attribute( name, *args ) }
|
54
|
-
functor( :__process, lambda { | name | TAGS.include?( name ) }, [], nil ) { | sel, args, block | __open( sel ) }
|
55
|
-
functor( :__process, lambda { | name | COMBINATORS.include?( name ) }, [], nil ) { | op, args, block | __combine( op ) }
|
56
|
-
functor( :__process, String, [], nil ) { | sel, args, block | __append( sel ) }
|
57
|
-
functor( :__process, lambda { | name | TAGS.include?( name ) }, [], Proc ) { | sel, args, block | __open( sel ) ; __close( block ) }
|
58
|
-
functor( :__process, String, [], Proc ) { | sel, args, block | __append( sel ) ; __close( block ) }
|
59
|
-
functor( :__attribute, String, String ) { | name, val | @buffer << "#{name}: #{val};" }
|
60
|
-
functor( :__attribute, lambda { | name | COLS.include?( name ) }, Integer ) { | name, val | __attribute( name, cols( val ) ) }
|
61
|
-
functor( :__attribute, lambda { | name | ROWS.include?( name ) }, Integer ) { | name, val | __attribute( name, rows( val ) ) }
|
62
|
-
functor( :__attribute, String, Hash ) { | name, vals | vals.each { | key, val | __attribute( "#{name}-#{key}", val ) } }
|
63
|
-
|
64
|
-
end
|
data/misc/meyer_reset.css
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
/* http://meyerweb.com/eric/tools/css/reset/ */
|
2
|
-
/* v1.0 | 20080212 */
|
3
|
-
|
4
|
-
html, body, div, span, applet, object, iframe,
|
5
|
-
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
6
|
-
a, abbr, acronym, address, big, cite, code,
|
7
|
-
del, dfn, em, font, img, ins, kbd, q, s, samp,
|
8
|
-
small, strike, strong, sub, sup, tt, var,
|
9
|
-
b, u, i, center,
|
10
|
-
dl, dt, dd, ol, ul, li,
|
11
|
-
fieldset, form, label, legend,
|
12
|
-
table, caption, tbody, tfoot, thead, tr, th, td {
|
13
|
-
margin: 0;
|
14
|
-
padding: 0;
|
15
|
-
border: 0;
|
16
|
-
outline: 0;
|
17
|
-
font-size: 100%;
|
18
|
-
vertical-align: baseline;
|
19
|
-
background: transparent;
|
20
|
-
}
|
21
|
-
body {
|
22
|
-
line-height: 1;
|
23
|
-
}
|
24
|
-
ol, ul {
|
25
|
-
list-style: none;
|
26
|
-
}
|
27
|
-
blockquote, q {
|
28
|
-
quotes: none;
|
29
|
-
}
|
30
|
-
blockquote:before, blockquote:after,
|
31
|
-
q:before, q:after {
|
32
|
-
content: '';
|
33
|
-
content: none;
|
34
|
-
}
|
35
|
-
|
36
|
-
/* remember to define focus styles! */
|
37
|
-
:focus {
|
38
|
-
outline: 0;
|
39
|
-
}
|
40
|
-
|
41
|
-
/* remember to highlight inserts somehow! */
|
42
|
-
ins {
|
43
|
-
text-decoration: none;
|
44
|
-
}
|
45
|
-
del {
|
46
|
-
text-decoration: line-through;
|
47
|
-
}
|
48
|
-
|
49
|
-
/* tables still need 'cellspacing="0"' in the markup */
|
50
|
-
table {
|
51
|
-
border-collapse: collapse;
|
52
|
-
border-spacing: 0;
|
53
|
-
}
|
data/site/basic.cssy
DELETED
data/site/basic.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
@css = Cssy.new
|
2
|
-
@css.process do
|
3
|
-
|
4
|
-
body { background_color "#F8F7F1"}
|
5
|
-
div.content! {
|
6
|
-
width "700px"; margin "25px auto"
|
7
|
-
|
8
|
-
a {
|
9
|
-
color "#212F54";
|
10
|
-
text_decoration :none
|
11
|
-
font_weight :bold
|
12
|
-
}
|
13
|
-
|
14
|
-
ul.links! { list_style "url(flower.png)" }
|
15
|
-
}
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
@css.to_s
|
data/site/cssy_title.jpg
DELETED
Binary file
|
data/site/flower.png
DELETED
Binary file
|
data/site/index.mab
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'syntax/convertors/html'
|
2
|
-
convertor = Syntax::Convertors::HTML.for_syntax "ruby"
|
3
|
-
|
4
|
-
html do
|
5
|
-
head do
|
6
|
-
title "Cassandra: A CSS generator with a pure-Ruby syntax"
|
7
|
-
link :rel => 'stylesheet', :type => 'text/css', :href => "basic.css"
|
8
|
-
link :rel => 'stylesheet', :type => 'text/css', :href => "ruby.css"
|
9
|
-
end
|
10
|
-
body do
|
11
|
-
div.content! do
|
12
|
-
img.logo! :src => "cssy_title.jpg"
|
13
|
-
div.ruby.example! do
|
14
|
-
convertor.convert( File.read( "site/basic.rb" ) ).to_s
|
15
|
-
end
|
16
|
-
ul.links! do
|
17
|
-
li { a "RDocs", :href => "/rdoc" }
|
18
|
-
li { a "Developer", :href => "http://www.automatthew.com" }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
data/site/ruby.cssy
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
div.ruby {
|
2
|
-
margin "30px 57px"
|
3
|
-
padding_left "20px"
|
4
|
-
border_left "3px solid #e8e7e1"
|
5
|
-
|
6
|
-
comment { color "#5A525F"; font_style :italic }
|
7
|
-
keyword { color "#794938" }
|
8
|
-
attribute { color "#234A97" }
|
9
|
-
constant { color "#691C97"; font_weight :bold }
|
10
|
-
method { color "#BF4F24" }
|
11
|
-
symbol { color "#811F24" }
|
12
|
-
string { color "#0B6125" }
|
13
|
-
ident { color "#080808" }
|
14
|
-
punct { color "#080808" }
|
15
|
-
}
|
data/test/basics.rb
DELETED
@@ -1,107 +0,0 @@
|
|
1
|
-
here = File.dirname(__FILE__)
|
2
|
-
require "#{here}/helper"
|
3
|
-
|
4
|
-
describe "Cassandra" do
|
5
|
-
|
6
|
-
it "can nest blocks" do
|
7
|
-
proc = lambda do
|
8
|
-
div do
|
9
|
-
form { width "35px" }
|
10
|
-
ul do
|
11
|
-
li { background :red }
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
data = [
|
17
|
-
["div", []],
|
18
|
-
["div form", ["width: 35px;"]],
|
19
|
-
["div ul", []],
|
20
|
-
["div ul li", ["background: red;"]]
|
21
|
-
]
|
22
|
-
Cssy.process(&proc).data.should == data
|
23
|
-
end
|
24
|
-
|
25
|
-
it "can chain blocks" do
|
26
|
-
proc = lambda do
|
27
|
-
p.smurf { color :blue }
|
28
|
-
p.gnome.hat { color :red }
|
29
|
-
end
|
30
|
-
|
31
|
-
data = [
|
32
|
-
["p.smurf", [ "color: blue;"]],
|
33
|
-
["p.gnome.hat", ["color: red;"]]
|
34
|
-
]
|
35
|
-
Cssy.process(&proc).data.should == data
|
36
|
-
end
|
37
|
-
|
38
|
-
it "can nest and chain" do
|
39
|
-
proc = lambda do
|
40
|
-
div do
|
41
|
-
span.ugly { font_family "Arial" }
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
data = [
|
46
|
-
["div", []],
|
47
|
-
["div span.ugly", ["font-family: Arial;"]]
|
48
|
-
]
|
49
|
-
Cssy.process(&proc).data.should == data
|
50
|
-
end
|
51
|
-
|
52
|
-
it "can chain and nest" do
|
53
|
-
proc = lambda do
|
54
|
-
ul.monkey do
|
55
|
-
li { list_style :none }
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
data = [
|
60
|
-
["ul.monkey", []],
|
61
|
-
["ul.monkey li", ["list-style: none;"]]
|
62
|
-
]
|
63
|
-
Cssy.process(&proc).data.should == data
|
64
|
-
end
|
65
|
-
|
66
|
-
it "can chain and nest and chain and ..." do
|
67
|
-
proc = lambda do
|
68
|
-
div do
|
69
|
-
div.milk!.toast do
|
70
|
-
p.jam { margin :auto }
|
71
|
-
hr { background :green }
|
72
|
-
end
|
73
|
-
|
74
|
-
p { border :none }
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
data = [
|
79
|
-
["div", []],
|
80
|
-
["div div#milk.toast", []],
|
81
|
-
["div div#milk.toast p.jam", ["margin: auto;"]],
|
82
|
-
["div div#milk.toast hr", ["background: green;"]],
|
83
|
-
["div p", ["border: none;"]]
|
84
|
-
]
|
85
|
-
Cssy.process(&proc).data.should == data
|
86
|
-
end
|
87
|
-
|
88
|
-
|
89
|
-
it "processes strings" do
|
90
|
-
fiddle = [
|
91
|
-
["div", ["background: red;", "width: 9934px;"]],
|
92
|
-
["div ul li", ["color: green;"]],
|
93
|
-
["div p.ugly.truly", ["color: aqua;"]],
|
94
|
-
["div .smurf.house", ["height: 256px;"]],
|
95
|
-
["div #menu", ["padding: 10px;"]],
|
96
|
-
[".gargamel", ["margin: 0px;"]],
|
97
|
-
[".outer.middle.inner", ["top: 34px;"]]
|
98
|
-
]
|
99
|
-
c = Cssy.new
|
100
|
-
c.process(File.read( "#{here}/fiddle.cssy"))
|
101
|
-
c.data.should == fiddle
|
102
|
-
c.to_s.should == File.read( "#{here}/fiddle.css")
|
103
|
-
end
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
end
|