seeren 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/app/controllers/seeren/components_controller.rb +21 -0
  4. data/app/views/seeren/layouts/component.html.erb +24 -0
  5. data/config/routes.rb +3 -0
  6. data/lib/seeren.rb +17 -0
  7. data/lib/seeren/engine.rb +1 -0
  8. data/lib/seeren/version.rb +6 -0
  9. data/lib/seeren/view_config.rb +41 -0
  10. data/test/dummy/Gemfile.lock +125 -0
  11. data/test/dummy/README.rdoc +28 -0
  12. data/test/dummy/Rakefile +6 -0
  13. data/test/dummy/app/assets/javascripts/application.js +13 -0
  14. data/test/dummy/app/assets/javascripts/clockwatch.js +45 -0
  15. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  16. data/test/dummy/app/assets/stylesheets/content.css +30 -0
  17. data/test/dummy/app/assets/stylesheets/header.css +25 -0
  18. data/test/dummy/app/assets/stylesheets/layout.css +57 -0
  19. data/test/dummy/app/assets/stylesheets/sidebar.css +34 -0
  20. data/test/dummy/app/controllers/application_controller.rb +5 -0
  21. data/test/dummy/app/controllers/sample_controller.rb +5 -0
  22. data/test/dummy/app/helpers/application_helper.rb +2 -0
  23. data/test/dummy/app/views/application/_footer.html.erb +3 -0
  24. data/test/dummy/app/views/application/_header.html.erb +4 -0
  25. data/test/dummy/app/views/application/_sidebar.html.erb +5 -0
  26. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  27. data/test/dummy/app/views/sample/_content.html.erb +13 -0
  28. data/test/dummy/app/views/sample/index.html.erb +11 -0
  29. data/test/dummy/bin/bundle +3 -0
  30. data/test/dummy/bin/rails +4 -0
  31. data/test/dummy/bin/rake +4 -0
  32. data/test/dummy/config.ru +4 -0
  33. data/test/dummy/config/application.rb +23 -0
  34. data/test/dummy/config/boot.rb +5 -0
  35. data/test/dummy/config/database.yml +25 -0
  36. data/test/dummy/config/environment.rb +5 -0
  37. data/test/dummy/config/environments/development.rb +29 -0
  38. data/test/dummy/config/environments/production.rb +80 -0
  39. data/test/dummy/config/environments/test.rb +36 -0
  40. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  41. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  42. data/test/dummy/config/initializers/inflections.rb +16 -0
  43. data/test/dummy/config/initializers/mime_types.rb +5 -0
  44. data/test/dummy/config/initializers/secret_token.rb +12 -0
  45. data/test/dummy/config/initializers/seeren.rb +5 -0
  46. data/test/dummy/config/initializers/session_store.rb +3 -0
  47. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  48. data/test/dummy/config/locales/en.yml +23 -0
  49. data/test/dummy/config/routes.rb +3 -0
  50. data/test/dummy/config/seeren_mapping.yml +19 -0
  51. data/test/dummy/db/development.sqlite3 +0 -0
  52. data/test/dummy/db/production.sqlite3 +0 -0
  53. data/test/dummy/db/schema.rb +16 -0
  54. data/test/dummy/db/test.sqlite3 +0 -0
  55. data/test/dummy/log/development.log +11038 -0
  56. data/test/dummy/public/404.html +58 -0
  57. data/test/dummy/public/422.html +58 -0
  58. data/test/dummy/public/500.html +57 -0
  59. data/test/dummy/public/favicon.ico +0 -0
  60. data/test/dummy/tmp/cache/assets/development/sprockets/01c9e3a2e701f43f372f67203ee37058 +0 -0
  61. data/test/dummy/tmp/cache/assets/development/sprockets/06c086a33b8301cc7c0dd293333e845e +0 -0
  62. data/test/dummy/tmp/cache/assets/development/sprockets/0dc0562647e703ca0535da3b9fcad796 +0 -0
  63. data/test/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  64. data/test/dummy/tmp/cache/assets/development/sprockets/2525cad450c5ef0c03ce6702fdf8e7e8 +0 -0
  65. data/test/dummy/tmp/cache/assets/development/sprockets/28f5e0cec327d4e5d7abcea9b49b0d90 +0 -0
  66. data/test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  67. data/test/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  68. data/test/dummy/tmp/cache/assets/development/sprockets/4d5132aa20a3ea73f3258e45307c8da3 +0 -0
  69. data/test/dummy/tmp/cache/assets/development/sprockets/52c382c44c2b5e3ab83b48ea0b27c309 +0 -0
  70. data/test/dummy/tmp/cache/assets/development/sprockets/5e68413bf4c596f37873be6257f00e2b +0 -0
  71. data/test/dummy/tmp/cache/assets/development/sprockets/64418460bd3ea65b4d83b80b8d141b1c +0 -0
  72. data/test/dummy/tmp/cache/assets/development/sprockets/6b2b96f0d4d63c06d575b5e8c33b1d5b +0 -0
  73. data/test/dummy/tmp/cache/assets/development/sprockets/72cbfd5bf33945bcce154f7a4feaf04d +0 -0
  74. data/test/dummy/tmp/cache/assets/development/sprockets/83ef55e03553719c4bc20f8482d621fe +0 -0
  75. data/test/dummy/tmp/cache/assets/development/sprockets/98387bd5679a9c174ed38bc29b918856 +0 -0
  76. data/test/dummy/tmp/cache/assets/development/sprockets/9968a5db588ce1b0eccde8ee4aa53070 +0 -0
  77. data/test/dummy/tmp/cache/assets/development/sprockets/9f79236dce892cd94637388f05e25f4f +0 -0
  78. data/test/dummy/tmp/cache/assets/development/sprockets/a512f90c8857205c6cfa2cfdffbf6c94 +0 -0
  79. data/test/dummy/tmp/cache/assets/development/sprockets/ac40b40e96db620ce63bc31ea39a3a00 +0 -0
  80. data/test/dummy/tmp/cache/assets/development/sprockets/b54dc30825e42975fc8d5330ade51b76 +0 -0
  81. data/test/dummy/tmp/cache/assets/development/sprockets/b5fa5190a0392c201224fe65623c6b33 +0 -0
  82. data/test/dummy/tmp/cache/assets/development/sprockets/b6f1534bcdbff92a16c85487f363235a +0 -0
  83. data/test/dummy/tmp/cache/assets/development/sprockets/ca0634ebb6f7c3a1c43ee9355d8edd7f +0 -0
  84. data/test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  85. data/test/dummy/tmp/cache/assets/development/sprockets/d62f9baa980673a86e0fdf7b9ceceb9b +0 -0
  86. data/test/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  87. data/test/dummy/tmp/cache/assets/development/sprockets/da8b774f0b10b6cc35062eb3e2a0018f +0 -0
  88. data/test/dummy/tmp/cache/assets/development/sprockets/df22da9859d9c1b69df3e9f4dc407bf0 +0 -0
  89. data/test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  90. data/test/dummy/tmp/pids/server.pid +1 -0
  91. data/test/seeren_test.rb +7 -0
  92. data/test/test_helper.rb +15 -0
  93. metadata +248 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 39ef09cc804a441a8fcb3cd5dc6f4c69ecd20188
4
+ data.tar.gz: 5d83ca4413d1c3163f24321302427530c2f4a396
5
+ SHA512:
6
+ metadata.gz: 8de96c500376a4dda7490f61112f1fc5c0013d86297b9951d07c9b0531899b51dce307dcd927c31676c0e3c52345121ac26aaf9fc081f881e6e44c6885ef2195
7
+ data.tar.gz: e69900d5457ce57769f3be97ba54231fa9f1e1b39840c0053aae4be2cfafce909305bad43db43404b56f4eaa22ae1b104ead3533dbf8f280f8bdec765a22a864
@@ -0,0 +1,20 @@
1
+ Copyright 2013 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,21 @@
1
+ class Seeren::ComponentsController < ActionController::Base
2
+ # respond_with :html
3
+
4
+ layout "component"
5
+
6
+ def view
7
+ @view_config = build_view_config
8
+ render nothing: true, layout: "seeren/layouts/component"
9
+ end
10
+
11
+ private
12
+ def build_view_config
13
+ @view_config ||= Seeren::ViewConfig.new(
14
+ width: params[:width],
15
+ height: params[:height],
16
+ view: Seeren.mapping[params[:component]]["view"],
17
+ js: Seeren.mapping[params[:component]]["javascript"],
18
+ css: Seeren.mapping[params[:component]]["stylesheet"]
19
+ )
20
+ end
21
+ end
@@ -0,0 +1,24 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Seeren • <%= @view_config.view %></title>
5
+
6
+ <style type="text/css">
7
+ #component-container {
8
+ width:800px;
9
+ height:600px;
10
+ margin:0 auto;
11
+ overflow:hidden;
12
+ }
13
+ </style>
14
+
15
+ <%= stylesheet_link_tag @view_config.css, media: "all" %>
16
+ </head>
17
+ <body>
18
+ <div id="component-container" style="<%= @view_config.contain_in %>">
19
+ <%= render @view_config.view %>
20
+ </div>
21
+
22
+ <%= javascript_include_tag @view_config.js %>
23
+ </body>
24
+ </html>
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ get '/components/:component', :to => 'seeren/components#view', :format => :html
3
+ end
@@ -0,0 +1,17 @@
1
+ require 'seeren/version'
2
+
3
+ require 'seeren/engine'
4
+ require 'seeren/view_config'
5
+
6
+ require_relative '../app/controllers/seeren/components_controller'
7
+
8
+ module Seeren
9
+ def self.setup
10
+ yield self
11
+ end
12
+
13
+ def self.mapping(file=nil)
14
+ @mapping = YAML.load_file(file) if file
15
+ @mapping
16
+ end
17
+ end
@@ -0,0 +1 @@
1
+ class Seeren::Engine < Rails::Engine ; end
@@ -0,0 +1,6 @@
1
+ module Seeren
2
+ MAJOR = '0'
3
+ MINOR = '1'
4
+ PATCH = '0'
5
+ VERSION = [MAJOR, MINOR, PATCH].join('.')
6
+ end
@@ -0,0 +1,41 @@
1
+ class Seeren::ViewConfig
2
+ attr_reader :view, :js, :css
3
+
4
+ def initialize(args={})
5
+ args.each do |key, value|
6
+ self.public_send "#{key}=", value
7
+ end
8
+ end
9
+
10
+ def contain_in
11
+ style = ""
12
+ style += "width:#{@width};" if @width
13
+ style += "height:#{@height};" if @height
14
+ style
15
+ end
16
+
17
+ private
18
+ %w[width height].each do |property|
19
+ define_method "#{property}=" do |value|
20
+ validate_size value
21
+
22
+ self.instance_variable_set "@#{property}", value
23
+ end
24
+ end
25
+
26
+ %w[view js css].each do |property|
27
+ define_method "#{property}=" do |value|
28
+ self.instance_variable_set "@#{property}", value
29
+ end
30
+ end
31
+
32
+ def validate_size(value)
33
+ if value and not (value =~ /[\d\.]+(px|em)/)
34
+ fail Seeren::InvalidFormat
35
+ end
36
+ end
37
+ end
38
+
39
+ class Seeren::Exception < StandardError ; end
40
+ class Seeren::InvalidFormat < Seeren::Exception ; end
41
+ class Seeren::MissingAsset < Seeren::Exception ; end
@@ -0,0 +1,125 @@
1
+ PATH
2
+ remote: ~/projects/opensource/seeren
3
+ specs:
4
+ seeren (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ actionmailer (4.0.0)
10
+ actionpack (= 4.0.0)
11
+ mail (~> 2.5.3)
12
+ actionpack (4.0.0)
13
+ activesupport (= 4.0.0)
14
+ builder (~> 3.1.0)
15
+ erubis (~> 2.7.0)
16
+ rack (~> 1.5.2)
17
+ rack-test (~> 0.6.2)
18
+ activemodel (4.0.0)
19
+ activesupport (= 4.0.0)
20
+ builder (~> 3.1.0)
21
+ activerecord (4.0.0)
22
+ activemodel (= 4.0.0)
23
+ activerecord-deprecated_finders (~> 1.0.2)
24
+ activesupport (= 4.0.0)
25
+ arel (~> 4.0.0)
26
+ activerecord-deprecated_finders (1.0.3)
27
+ activesupport (4.0.0)
28
+ i18n (~> 0.6, >= 0.6.4)
29
+ minitest (~> 4.2)
30
+ multi_json (~> 1.3)
31
+ thread_safe (~> 0.1)
32
+ tzinfo (~> 0.3.37)
33
+ arel (4.0.0)
34
+ atomic (1.1.14)
35
+ builder (3.1.4)
36
+ coffee-rails (4.0.0)
37
+ coffee-script (>= 2.2.0)
38
+ railties (>= 4.0.0.beta, < 5.0)
39
+ coffee-script (2.2.0)
40
+ coffee-script-source
41
+ execjs
42
+ coffee-script-source (1.6.3)
43
+ erubis (2.7.0)
44
+ execjs (2.0.2)
45
+ hike (1.2.3)
46
+ i18n (0.6.5)
47
+ jbuilder (1.5.1)
48
+ activesupport (>= 3.0.0)
49
+ multi_json (>= 1.2.0)
50
+ jquery-rails (3.0.4)
51
+ railties (>= 3.0, < 5.0)
52
+ thor (>= 0.14, < 2.0)
53
+ json (1.8.0)
54
+ mail (2.5.4)
55
+ mime-types (~> 1.16)
56
+ treetop (~> 1.4.8)
57
+ mime-types (1.25)
58
+ minitest (4.7.5)
59
+ multi_json (1.8.1)
60
+ polyglot (0.3.3)
61
+ rack (1.5.2)
62
+ rack-test (0.6.2)
63
+ rack (>= 1.0)
64
+ rails (4.0.0)
65
+ actionmailer (= 4.0.0)
66
+ actionpack (= 4.0.0)
67
+ activerecord (= 4.0.0)
68
+ activesupport (= 4.0.0)
69
+ bundler (>= 1.3.0, < 2.0)
70
+ railties (= 4.0.0)
71
+ sprockets-rails (~> 2.0.0)
72
+ railties (4.0.0)
73
+ actionpack (= 4.0.0)
74
+ activesupport (= 4.0.0)
75
+ rake (>= 0.8.7)
76
+ thor (>= 0.18.1, < 2.0)
77
+ rake (10.1.0)
78
+ rdoc (3.12.2)
79
+ json (~> 1.4)
80
+ sass (3.2.12)
81
+ sass-rails (4.0.0)
82
+ railties (>= 4.0.0.beta, < 5.0)
83
+ sass (>= 3.1.10)
84
+ sprockets-rails (~> 2.0.0)
85
+ sdoc (0.3.20)
86
+ json (>= 1.1.3)
87
+ rdoc (~> 3.10)
88
+ sprockets (2.10.0)
89
+ hike (~> 1.2)
90
+ multi_json (~> 1.0)
91
+ rack (~> 1.0)
92
+ tilt (~> 1.1, != 1.3.0)
93
+ sprockets-rails (2.0.0)
94
+ actionpack (>= 3.0)
95
+ activesupport (>= 3.0)
96
+ sprockets (~> 2.8)
97
+ sqlite3 (1.3.8)
98
+ thor (0.18.1)
99
+ thread_safe (0.1.3)
100
+ atomic
101
+ tilt (1.4.1)
102
+ treetop (1.4.15)
103
+ polyglot
104
+ polyglot (>= 0.3.1)
105
+ turbolinks (1.3.0)
106
+ coffee-rails
107
+ tzinfo (0.3.37)
108
+ uglifier (2.2.1)
109
+ execjs (>= 0.3.0)
110
+ multi_json (~> 1.0, >= 1.0.2)
111
+
112
+ PLATFORMS
113
+ ruby
114
+
115
+ DEPENDENCIES
116
+ coffee-rails (~> 4.0.0)
117
+ seeren!
118
+ jbuilder (~> 1.2)
119
+ jquery-rails
120
+ rails (= 4.0.0)
121
+ sass-rails (~> 4.0.0)
122
+ sdoc
123
+ sqlite3
124
+ turbolinks
125
+ uglifier (>= 1.3.0)
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Dummy::Application.load_tasks
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,45 @@
1
+ // Scripts for the demo page of -prefix-free
2
+
3
+ function $(id) { return document.getElementById(id) }
4
+
5
+ (function(){
6
+ if(window.PrefixFree) {
7
+ var source = $('source'),
8
+ prefixed = $('prefixed');
9
+
10
+ (source.oninput = function() {
11
+ prefixed.value = PrefixFree.prefixCSS(source.value, true);
12
+ })();
13
+
14
+ source.onscroll = function() {
15
+ prefixed.scrollTop = source.scrollTop;
16
+ }
17
+ }
18
+
19
+ (window.onhashchange = function() {
20
+ var target, page, previousPage;
21
+
22
+ if(location.hash) {
23
+ page = target = document.querySelector(location.hash);
24
+
25
+ while(page && page.className != 'page') {
26
+ page = page.parentNode;
27
+ }
28
+ }
29
+
30
+ (previousPage = document.querySelector('.current.page')) && (previousPage.className = 'page');
31
+
32
+ if(page) {
33
+ page.className = 'current page';
34
+
35
+ document.body.className = 'in-page';
36
+ }
37
+ else {
38
+ document.body.className = 'home';
39
+ }
40
+
41
+ if(target) {
42
+ target.scrollIntoView(true);
43
+ }
44
+ })();
45
+ })();
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,30 @@
1
+ #content {
2
+ width: 600px;
3
+ float: left;
4
+ background: #f8f8f8;
5
+ margin-bottom: 5px;
6
+ border: solid 1px #ccc;
7
+ }
8
+
9
+ @media screen and (max-width: 980px) {
10
+
11
+ #content {
12
+ width: 65%;
13
+ }
14
+
15
+ }
16
+
17
+ /* for 700px or less */
18
+ @media screen and (max-width: 700px) {
19
+
20
+ #content {
21
+ width: auto;
22
+ float: none;
23
+ }
24
+
25
+ }
26
+
27
+ /* for 480px or less */
28
+ @media screen and (max-width: 480px) {
29
+
30
+ }
@@ -0,0 +1,25 @@
1
+ #header {
2
+ height: 180px;
3
+ border: solid 1px #ccc;
4
+ }
5
+
6
+ @media screen and (max-width: 980px) {
7
+
8
+ }
9
+
10
+ @media screen and (max-width: 700px) {
11
+
12
+ #content {
13
+ width: auto;
14
+ float: none;
15
+ }
16
+
17
+ }
18
+
19
+ @media screen and (max-width: 480px) {
20
+
21
+ #header {
22
+ height: auto;
23
+ }
24
+
25
+ }