daftos 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/.DS_Store CHANGED
Binary file
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
data/daftos.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "daftos"
8
- s.version = "0.2.0"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ondrej Odchazel"]
12
- s.date = "2012-05-01"
12
+ s.date = "2012-05-03"
13
13
  s.description = "OS in your browser"
14
14
  s.email = "hypertornado@gmail.com"
15
15
  s.executables = ["daftos"]
@@ -30,16 +30,24 @@ Gem::Specification.new do |s|
30
30
  "daftos.gemspec",
31
31
  "lib/.DS_Store",
32
32
  "lib/apis/.DS_Store",
33
+ "lib/apis/apps_api.rb",
33
34
  "lib/apis/filesystem_api.rb",
34
35
  "lib/apps/.DS_Store",
36
+ "lib/apps/apps/.DS_Store",
35
37
  "lib/apps/apps/body.html",
38
+ "lib/apps/apps/coffee/apps.coffee",
39
+ "lib/apps/apps/css/style.css",
36
40
  "lib/apps/apps/options.json",
41
+ "lib/apps/apps/png/.DS_Store",
42
+ "lib/apps/apps/png/icon.png",
37
43
  "lib/apps/filebrowser/.DS_Store",
38
44
  "lib/apps/filebrowser/body.html",
39
45
  "lib/apps/filebrowser/coffee/filebrowser.coffee",
40
46
  "lib/apps/filebrowser/js/.DS_Store",
41
47
  "lib/apps/filebrowser/js/daftos.js",
42
48
  "lib/apps/filebrowser/options.json",
49
+ "lib/apps/filebrowser/png/.DS_Store",
50
+ "lib/apps/filebrowser/png/icon.png",
43
51
  "lib/apps/photobooth/.DS_Store",
44
52
  "lib/apps/photobooth/body.html",
45
53
  "lib/apps/photobooth/coffee/photobooth.coffee",
@@ -48,10 +56,16 @@ Gem::Specification.new do |s|
48
56
  "lib/apps/photobooth/js/.DS_Store",
49
57
  "lib/apps/photobooth/js/daftos.js",
50
58
  "lib/apps/photobooth/options.json",
59
+ "lib/apps/photobooth/png/.DS_Store",
60
+ "lib/apps/photobooth/png/icon.png",
61
+ "lib/apps/photobrowser/.DS_Store",
51
62
  "lib/apps/photobrowser/body.html",
52
63
  "lib/apps/photobrowser/coffee/photobrowser.coffee",
53
64
  "lib/apps/photobrowser/js/.DS_Store",
54
65
  "lib/apps/photobrowser/options.json",
66
+ "lib/apps/photobrowser/png/.DS_Store",
67
+ "lib/apps/photobrowser/png/icon.png",
68
+ "lib/apps/texteditor/.DS_Store",
55
69
  "lib/apps/texteditor/body.html",
56
70
  "lib/apps/texteditor/coffee/texteditor.coffee",
57
71
  "lib/apps/texteditor/js/.DS_Store",
@@ -316,6 +330,7 @@ Gem::Specification.new do |s|
316
330
  "lib/apps/texteditor/js/worker-javascript.js",
317
331
  "lib/apps/texteditor/js/worker-json.js",
318
332
  "lib/apps/texteditor/options.json",
333
+ "lib/apps/texteditor/png/icon.png",
319
334
  "lib/daftos.rb",
320
335
  "lib/daftos/.DS_Store",
321
336
  "lib/daftos/server.rb",
@@ -324,8 +339,10 @@ Gem::Specification.new do |s|
324
339
  "lib/libs/.DS_Store",
325
340
  "lib/libs/coffee/daftos.coffee",
326
341
  "lib/libs/css/bootstrap.css",
342
+ "lib/libs/img/.DS_Store",
327
343
  "lib/libs/js/bootstrap.js",
328
344
  "lib/libs/js/jquery.js",
345
+ "lib/libs/png/icon.png",
329
346
  "myapp.pid",
330
347
  "test/helper.rb",
331
348
  "test/test_daftos.rb"
data/lib/.DS_Store CHANGED
Binary file
@@ -0,0 +1,18 @@
1
+ require 'json'
2
+
3
+ class AppsAPI < Sinatra::Base
4
+
5
+ get '/list' do
6
+ list = Dir.new(File.dirname(__FILE__) + "/../apps").entries
7
+ list = list.find_all{|item| item =~ /^[a-z]+$/}
8
+ list = list.map do |item|
9
+ json = JSON.parse(File.read(File.dirname(__FILE__) + "/../apps/#{item}/options.json"))
10
+ {
11
+ path: item,
12
+ name: json['name']
13
+ }
14
+ end
15
+ list.to_json
16
+ end
17
+
18
+ end
@@ -41,6 +41,8 @@ class FileSystem
41
41
  f = File.new("#{dir.path}/#{name}")
42
42
  files << file_info(f)
43
43
  rescue
44
+ #puts "error"
45
+ #puts e
44
46
  end
45
47
  end
46
48
  ret[:contents] = files
@@ -62,6 +64,7 @@ class FileSystem
62
64
  ret[:client_mtime] = file.mtime
63
65
  ret[:modified] = file.ctime
64
66
  ret[:mime_type] = Rack::Mime.mime_type("." + file.path.split('.').last)
67
+ ret[:binary] = File.binary?(ret[:absolute_path])
65
68
  ret
66
69
  end
67
70
 
data/lib/apps/.DS_Store CHANGED
Binary file
Binary file
@@ -1,6 +1,2 @@
1
- <ul>
2
- <li><a href="/filebrowser#/Users/ondrejodchazel">FileBrowser</a></li>
3
- <li><a href="/photobooth">PhotoBooth</a></li>
4
- <li><a href="/texteditor#/etc/hosts">TextEditor</a></li>
5
- <li><a href="/photobrowser#/Users/ondrejodchazel/Pictures/pozadi.png">PhotoBrowser</a></li>
1
+ <ul id="applist">
6
2
  </ul>
@@ -0,0 +1,21 @@
1
+ #alert "xx"
2
+ #/api/apps/list
3
+
4
+ $ ->
5
+ $(window).bind('body_loaded',
6
+ =>
7
+ apps = new Apps()
8
+ )
9
+
10
+ class Apps
11
+ constructor: ->
12
+ $.ajax "/api/apps/list"
13
+ cache: false
14
+ dataType: 'json'
15
+ success: (data) =>
16
+ console.log data
17
+ for d in data
18
+ $("#applist").append("<a href='/#{d.path}'><li class='apps'>
19
+ <img src='/#{d.path}/icon.png' class='icon-big'>
20
+ <div>#{d.name}</div>
21
+ </li></a>")
@@ -0,0 +1,49 @@
1
+ body {
2
+ baackground: #DDD;
3
+ }
4
+
5
+ .icon-big {
6
+ background: #0074CC;
7
+ margin: 15px 15px 2px 15px;
8
+ box-shadow: 0px 0px 5px #333;
9
+ border-radius: 5px;
10
+ width: 80px;
11
+ height: 80px;
12
+ }
13
+
14
+ li.apps img {
15
+ opacity: 0.9;
16
+ }
17
+
18
+ li.apps:hover img {
19
+ opacity: 1;
20
+ }
21
+
22
+ #applist {
23
+ margin: 5px;
24
+ padding: 0px;
25
+ text-align: center;
26
+ }
27
+
28
+ li.apps {
29
+ text-shadow: 0px 1px 1px #222, 0px -1px 1px #222, 1px 0px 1px #222, -1px 0px 1px #222;
30
+ list-style: none;
31
+ display: inline-block;
32
+ text-align: center;
33
+ padding-bottom: 10px;
34
+ color: #FFF;
35
+ font-weight: bold;
36
+ font-size: 12px;
37
+ }
38
+
39
+ li.apps:hover img {
40
+ /*background: #f1f1f1;
41
+ border-radius: 5px;*/
42
+ box-shadow: 0px 0px 5px black;
43
+ text-shadow: 1px 1px 5px black;
44
+ }
45
+
46
+ li.apps:hover {
47
+ text-shadow: 0px 1px 2px #000, 0px -1px 2px #000, 1px 0px 2px #000, -1px 0px 2px #000;
48
+ }
49
+
@@ -1,7 +1,7 @@
1
1
  {
2
- "name": "Daftos Apps",
2
+ "name": "Apps",
3
3
  "description": "Daft apps.",
4
4
  "version": "0.1",
5
- "libs": ["bootstrap.css","jquery.js", "daftos.coffee", "bootstrap.js"]
5
+ "libs": ["bootstrap.css","jquery.js", "daftos.coffee", "bootstrap.js", "apps.coffee", "style.css"]
6
6
  }
7
7
 
Binary file
Binary file
Binary file
@@ -23,6 +23,7 @@ class FileBrowser
23
23
  path: path
24
24
  dataType: 'json'
25
25
  success: (data) =>
26
+ console.log data
26
27
  for file in data.contents
27
28
  $('#dir-path').html(@path_element(path))
28
29
  $('#file-list').append(@create_element(file))
@@ -36,6 +37,8 @@ class FileBrowser
36
37
  app = ""
37
38
  app = "texteditor" if file.mime_type.match("text/")
38
39
  app = "photobrowser" if file.mime_type.match("image/")
40
+ if (app == "" and not file.binary)
41
+ app = "texteditor"
39
42
  if app.length > 0
40
43
  el = $("<tr><td><a href='/#{app}##{file.absolute_path}' target='_blank'>#{file.name}</a></td><td>#{file.mime_type}</td></tr>")
41
44
  else
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
data/lib/daftos.rb CHANGED
@@ -1,6 +1,8 @@
1
1
 
2
+ require 'ptools'
2
3
  require_relative 'daftos/server.rb'
3
4
  require_relative 'apis/filesystem_api.rb'
5
+ require_relative 'apis/apps_api.rb'
4
6
 
5
7
 
6
8
  class Daftos
@@ -13,6 +15,7 @@ class Daftos
13
15
 
14
16
  builder = Rack::Builder.new do
15
17
  map('/api/file_system'){ run FileSystemAPI }
18
+ map('/api/apps'){ run AppsAPI }
16
19
  map('/'){ run Server }
17
20
  end
18
21
  Rack::Handler::Thin.run builder, :Port => 9999
data/lib/libs/.DS_Store CHANGED
Binary file
@@ -3493,4 +3493,4 @@ a.thumbnail:hover {
3493
3493
  }
3494
3494
  .invisible {
3495
3495
  visibility: hidden;
3496
- }
3496
+ }
Binary file
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daftos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-01 00:00:00.000000000Z
12
+ date: 2012-05-03 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: shoulda
16
- requirement: &2154238000 !ruby/object:Gem::Requirement
16
+ requirement: &2165065940 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2154238000
24
+ version_requirements: *2165065940
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rdoc
27
- requirement: &2154236420 !ruby/object:Gem::Requirement
27
+ requirement: &2165065240 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '3.12'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2154236420
35
+ version_requirements: *2165065240
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &2154235440 !ruby/object:Gem::Requirement
38
+ requirement: &2165064740 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.0.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2154235440
46
+ version_requirements: *2165064740
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: jeweler
49
- requirement: &2154234480 !ruby/object:Gem::Requirement
49
+ requirement: &2165064240 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.8.3
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2154234480
57
+ version_requirements: *2165064240
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: ptools
60
- requirement: &2154233620 !ruby/object:Gem::Requirement
60
+ requirement: &2165063720 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2154233620
68
+ version_requirements: *2165063720
69
69
  description: OS in your browser
70
70
  email: hypertornado@gmail.com
71
71
  executables:
@@ -87,16 +87,24 @@ files:
87
87
  - daftos.gemspec
88
88
  - lib/.DS_Store
89
89
  - lib/apis/.DS_Store
90
+ - lib/apis/apps_api.rb
90
91
  - lib/apis/filesystem_api.rb
91
92
  - lib/apps/.DS_Store
93
+ - lib/apps/apps/.DS_Store
92
94
  - lib/apps/apps/body.html
95
+ - lib/apps/apps/coffee/apps.coffee
96
+ - lib/apps/apps/css/style.css
93
97
  - lib/apps/apps/options.json
98
+ - lib/apps/apps/png/.DS_Store
99
+ - lib/apps/apps/png/icon.png
94
100
  - lib/apps/filebrowser/.DS_Store
95
101
  - lib/apps/filebrowser/body.html
96
102
  - lib/apps/filebrowser/coffee/filebrowser.coffee
97
103
  - lib/apps/filebrowser/js/.DS_Store
98
104
  - lib/apps/filebrowser/js/daftos.js
99
105
  - lib/apps/filebrowser/options.json
106
+ - lib/apps/filebrowser/png/.DS_Store
107
+ - lib/apps/filebrowser/png/icon.png
100
108
  - lib/apps/photobooth/.DS_Store
101
109
  - lib/apps/photobooth/body.html
102
110
  - lib/apps/photobooth/coffee/photobooth.coffee
@@ -105,10 +113,16 @@ files:
105
113
  - lib/apps/photobooth/js/.DS_Store
106
114
  - lib/apps/photobooth/js/daftos.js
107
115
  - lib/apps/photobooth/options.json
116
+ - lib/apps/photobooth/png/.DS_Store
117
+ - lib/apps/photobooth/png/icon.png
118
+ - lib/apps/photobrowser/.DS_Store
108
119
  - lib/apps/photobrowser/body.html
109
120
  - lib/apps/photobrowser/coffee/photobrowser.coffee
110
121
  - lib/apps/photobrowser/js/.DS_Store
111
122
  - lib/apps/photobrowser/options.json
123
+ - lib/apps/photobrowser/png/.DS_Store
124
+ - lib/apps/photobrowser/png/icon.png
125
+ - lib/apps/texteditor/.DS_Store
112
126
  - lib/apps/texteditor/body.html
113
127
  - lib/apps/texteditor/coffee/texteditor.coffee
114
128
  - lib/apps/texteditor/js/.DS_Store
@@ -373,6 +387,7 @@ files:
373
387
  - lib/apps/texteditor/js/worker-javascript.js
374
388
  - lib/apps/texteditor/js/worker-json.js
375
389
  - lib/apps/texteditor/options.json
390
+ - lib/apps/texteditor/png/icon.png
376
391
  - lib/daftos.rb
377
392
  - lib/daftos/.DS_Store
378
393
  - lib/daftos/server.rb
@@ -381,8 +396,10 @@ files:
381
396
  - lib/libs/.DS_Store
382
397
  - lib/libs/coffee/daftos.coffee
383
398
  - lib/libs/css/bootstrap.css
399
+ - lib/libs/img/.DS_Store
384
400
  - lib/libs/js/bootstrap.js
385
401
  - lib/libs/js/jquery.js
402
+ - lib/libs/png/icon.png
386
403
  - myapp.pid
387
404
  - test/helper.rb
388
405
  - test/test_daftos.rb
@@ -401,7 +418,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
401
418
  version: '0'
402
419
  segments:
403
420
  - 0
404
- hash: 367366124570153315
421
+ hash: -3473143825273189833
405
422
  required_rubygems_version: !ruby/object:Gem::Requirement
406
423
  none: false
407
424
  requirements: