swagr 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +33 -0
- data/Rakefile +1 -0
- data/bin/swagr +61 -0
- data/examples/examples01/app.rb +104 -0
- data/examples/examples01/brownian_searcher.rb +93 -0
- data/examples/examples01/coffee/application.coffee +0 -0
- data/examples/examples01/coffee/d3graph.coffee +54 -0
- data/examples/examples01/coffee/updating_text_graph.coffee +43 -0
- data/examples/examples01/coffee/updating_top_list.coffee +39 -0
- data/examples/examples01/static/css/bootstrap.css +6103 -0
- data/examples/examples01/static/css/bootstrap.min.css +868 -0
- data/examples/examples01/static/css/style.css +15 -0
- data/examples/examples01/static/img/glyphicons-halflings-white.png +0 -0
- data/examples/examples01/static/img/glyphicons-halflings.png +0 -0
- data/examples/examples01/static/js/bootstrap.js +2170 -0
- data/examples/examples01/static/js/bootstrap.min.js +7 -0
- data/examples/examples01/static/js/coffee-script.js +8 -0
- data/examples/examples01/static/js/d3.v3.min.js +4 -0
- data/examples/examples01/static/js/jquery-latest.js +9472 -0
- data/examples/examples01/views/application.slim +0 -0
- data/examples/examples01/views/footer.slim +2 -0
- data/examples/examples01/views/index.slim +80 -0
- data/examples/examples01/views/layout.slim +26 -0
- data/examples/examples01/views/navbar.slim +16 -0
- data/lib/swagr.rb +5 -0
- data/lib/swagr/version.rb +3 -0
- data/skeletons/bootstrap_default_130109_0842.zip +0 -0
- data/swagr.gemspec +26 -0
- data/templates/app.rb +104 -0
- data/templates/brownian_searcher.rb +93 -0
- data/templates/coffee/application.coffee +0 -0
- data/templates/coffee/d3graph.coffee +54 -0
- data/templates/coffee/updating_text_graph.coffee +43 -0
- data/templates/coffee/updating_top_list.coffee +39 -0
- data/templates/static/css/style.css +15 -0
- data/templates/static/js/coffee-script.js +8 -0
- data/templates/static/js/d3.v3.min.js +4 -0
- data/templates/static/js/jquery-latest.js +9472 -0
- data/templates/views/footer.slim +2 -0
- data/templates/views/index.slim +80 -0
- data/templates/views/layout.slim +26 -0
- data/templates/views/navbar.slim +16 -0
- metadata +173 -0
@@ -0,0 +1,80 @@
|
|
1
|
+
h1 Hello, Swagr world!
|
2
|
+
|
3
|
+
/! Example A: Some static svg
|
4
|
+
div class="container"
|
5
|
+
svg width="400" height="50"
|
6
|
+
text x="0" y="35" font-family="Helvetica" font-size="20" SVG:
|
7
|
+
circle cx="175" cy="25" r="20" fill="rgba(128, 0, 128, 1.0)"
|
8
|
+
circle cx="200" cy="25" r="20" fill="rgba(0, 0, 255, 0.75)"
|
9
|
+
circle cx="225" cy="25" r="20" fill="rgba(0, 255, 0, 0.5)"
|
10
|
+
circle cx="250" cy="25" r="20" fill="rgba(255, 255, 0, 0.25)"
|
11
|
+
circle cx="275" cy="25" r="20" fill="rgba(255, 0, 0, 0.1)"
|
12
|
+
/! rect x="100" y="100" width="100" height="50"
|
13
|
+
/! ellipse cx="150" cy="80" rx="50" ry="25" fill="red"
|
14
|
+
/! line x1="0" y1="0" x2="300" y2="50" stroke="black"
|
15
|
+
|
16
|
+
/! Example B: Using d3 to add elements dynamically
|
17
|
+
script src="js/d3.v3.min.js"
|
18
|
+
div class="container" id="d3a"
|
19
|
+
div class="container" id="d3b"
|
20
|
+
script type="text/javascript"
|
21
|
+
| var co = d3.select("#d3a");
|
22
|
+
co.append("p").text("Hello, d3.js world!");
|
23
|
+
|
24
|
+
/! Example C: Coffee-script inline and importing from other files
|
25
|
+
script src="js/coffee-script.js"
|
26
|
+
script src="coffee/d3graph.js"
|
27
|
+
script src="coffee/updating_text_graph.js"
|
28
|
+
script src="coffee/updating_top_list.js"
|
29
|
+
div class="container" id="d3_from_coffeescript"
|
30
|
+
div class="container" id="updating_text"
|
31
|
+
div class="container" id="top_list_header"
|
32
|
+
text class="update"
|
33
|
+
div class="container" id="top_list"
|
34
|
+
script type="text/coffeescript"
|
35
|
+
| a = 1.5
|
36
|
+
b = 2 + a
|
37
|
+
str = "Hello, coffee-script and d3.js world! b = " + b + ". And now an updating text graph from Coffee-script..."
|
38
|
+
console.log(str)
|
39
|
+
d3.select("#d3_from_coffeescript").append("span").text(str)
|
40
|
+
root = exports ? window
|
41
|
+
|
42
|
+
# 1. Updating row of random int values
|
43
|
+
g = new root.Swagr.UpdatingTextGraph "#updating_text", "/data/randints/arrayofsize6.json", {
|
44
|
+
width: 500
|
45
|
+
height: 120
|
46
|
+
}
|
47
|
+
g.run_updates_for(5)
|
48
|
+
#g.start_updates()
|
49
|
+
|
50
|
+
|
51
|
+
# 2. Updating top list of positions found by BrownianSearcher
|
52
|
+
|
53
|
+
class MyUpdatingTopList extends root.Swagr.UpdatingToplist
|
54
|
+
_join_data: (data) ->
|
55
|
+
@svg.selectAll("text").data(data.top_list, (d, i) -> d.number)
|
56
|
+
|
57
|
+
textmapper: (elems, data) -> (d,i) ->
|
58
|
+
(i+1).toString() + ". dist: " + d.distance.toFixed(2) +
|
59
|
+
" pos: (" + d.x + ", " + d.y + ")" +
|
60
|
+
" step: " + d.number
|
61
|
+
|
62
|
+
g2 = new MyUpdatingTopList "#top_list", "/data/brownian_search/search_info.json", {
|
63
|
+
width: 500
|
64
|
+
height: 160
|
65
|
+
transition_y: 100
|
66
|
+
update_interval: 3.0
|
67
|
+
transition_time: 1000
|
68
|
+
}
|
69
|
+
#g2.run_updates_for(20)
|
70
|
+
g2.start_updates()
|
71
|
+
|
72
|
+
# 3. Header for the top list, showing current number of steps.
|
73
|
+
update_header = () ->
|
74
|
+
d3.json("/data/brownian_search/current_position.json", (error, data) ->
|
75
|
+
pos_str = "(" + data[0].x + ", " + data[0].y + ")"
|
76
|
+
d3.select("#top_list_header").select("text")
|
77
|
+
.text("Top 5 positions at step: " + data[0].number + ", pos: " + pos_str)
|
78
|
+
)
|
79
|
+
update_header()
|
80
|
+
setInterval(update_header, g2.opts.update_interval * 1000)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
doctype html
|
2
|
+
html
|
3
|
+
head
|
4
|
+
meta charset="utf-8"
|
5
|
+
title Swagr web app template
|
6
|
+
meta name="viewport" content="width=device-width, initial-scale=1.0"
|
7
|
+
meta name="description" content=""
|
8
|
+
meta name="author" content="FIXME: YOUR NAME"
|
9
|
+
link href="css/bootstrap.css" rel="stylesheet" /! media="screen"
|
10
|
+
link href="css/style.css" rel="stylesheet" /! media="screen"
|
11
|
+
style
|
12
|
+
| body {
|
13
|
+
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
|
14
|
+
}
|
15
|
+
body
|
16
|
+
|
17
|
+
div class="container"
|
18
|
+
== slim :navbar
|
19
|
+
== yield
|
20
|
+
|
21
|
+
div class="container"
|
22
|
+
div id="footer"
|
23
|
+
== slim :footer
|
24
|
+
|
25
|
+
script src="js/jquery-latest.js"
|
26
|
+
script src="js/bootstrap.min.js"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
div class="navbar navbar-inverse navbar-fixed-top"
|
2
|
+
div class="navbar-inner"
|
3
|
+
div class="container"
|
4
|
+
a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"
|
5
|
+
span class="icon-bar"
|
6
|
+
span class="icon-bar"
|
7
|
+
span class="icon-bar"
|
8
|
+
a class="brand" href="#" SwagrApp
|
9
|
+
div class="nav-collapse collapse"
|
10
|
+
ul class="nav"
|
11
|
+
li class="active"
|
12
|
+
a href="#" Home
|
13
|
+
li
|
14
|
+
a href="about" About
|
15
|
+
li
|
16
|
+
a href="contact" Contact
|
metadata
ADDED
@@ -0,0 +1,173 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: swagr
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.5
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Robert Feldt
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-01-15 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: thor
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: slim
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: sass
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: coffee-script
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: json
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
description: simple web app gui framework for ruby
|
95
|
+
email:
|
96
|
+
- robert.feldt@gmail.com
|
97
|
+
executables:
|
98
|
+
- swagr
|
99
|
+
extensions: []
|
100
|
+
extra_rdoc_files: []
|
101
|
+
files:
|
102
|
+
- .gitignore
|
103
|
+
- Gemfile
|
104
|
+
- LICENSE.txt
|
105
|
+
- README.md
|
106
|
+
- Rakefile
|
107
|
+
- bin/swagr
|
108
|
+
- examples/examples01/app.rb
|
109
|
+
- examples/examples01/brownian_searcher.rb
|
110
|
+
- examples/examples01/coffee/application.coffee
|
111
|
+
- examples/examples01/coffee/d3graph.coffee
|
112
|
+
- examples/examples01/coffee/updating_text_graph.coffee
|
113
|
+
- examples/examples01/coffee/updating_top_list.coffee
|
114
|
+
- examples/examples01/static/css/bootstrap.css
|
115
|
+
- examples/examples01/static/css/bootstrap.min.css
|
116
|
+
- examples/examples01/static/css/style.css
|
117
|
+
- examples/examples01/static/img/glyphicons-halflings-white.png
|
118
|
+
- examples/examples01/static/img/glyphicons-halflings.png
|
119
|
+
- examples/examples01/static/js/bootstrap.js
|
120
|
+
- examples/examples01/static/js/bootstrap.min.js
|
121
|
+
- examples/examples01/static/js/coffee-script.js
|
122
|
+
- examples/examples01/static/js/d3.v3.min.js
|
123
|
+
- examples/examples01/static/js/jquery-latest.js
|
124
|
+
- examples/examples01/views/application.slim
|
125
|
+
- examples/examples01/views/footer.slim
|
126
|
+
- examples/examples01/views/index.slim
|
127
|
+
- examples/examples01/views/layout.slim
|
128
|
+
- examples/examples01/views/navbar.slim
|
129
|
+
- lib/swagr.rb
|
130
|
+
- lib/swagr/version.rb
|
131
|
+
- skeletons/bootstrap_default_130109_0842.zip
|
132
|
+
- swagr.gemspec
|
133
|
+
- templates/app.rb
|
134
|
+
- templates/brownian_searcher.rb
|
135
|
+
- templates/coffee/application.coffee
|
136
|
+
- templates/coffee/d3graph.coffee
|
137
|
+
- templates/coffee/updating_text_graph.coffee
|
138
|
+
- templates/coffee/updating_top_list.coffee
|
139
|
+
- templates/static/css/style.css
|
140
|
+
- templates/static/js/coffee-script.js
|
141
|
+
- templates/static/js/d3.v3.min.js
|
142
|
+
- templates/static/js/jquery-latest.js
|
143
|
+
- templates/views/footer.slim
|
144
|
+
- templates/views/index.slim
|
145
|
+
- templates/views/layout.slim
|
146
|
+
- templates/views/navbar.slim
|
147
|
+
homepage: ''
|
148
|
+
licenses: []
|
149
|
+
post_install_message:
|
150
|
+
rdoc_options: []
|
151
|
+
require_paths:
|
152
|
+
- lib
|
153
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
154
|
+
none: false
|
155
|
+
requirements:
|
156
|
+
- - ! '>='
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
159
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
|
+
none: false
|
161
|
+
requirements:
|
162
|
+
- - ! '>='
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '0'
|
165
|
+
requirements: []
|
166
|
+
rubyforge_project:
|
167
|
+
rubygems_version: 1.8.24
|
168
|
+
signing_key:
|
169
|
+
specification_version: 3
|
170
|
+
summary: Simple, barebones web app gui framework for Ruby programs/processes. Based
|
171
|
+
on Sinatra, Sass, Slim, Coffeescript and d3.js. Geared to interfacing with long-running
|
172
|
+
Ruby processes.
|
173
|
+
test_files: []
|