flok 0.0.11 → 0.0.12

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/spec/helpers.rb CHANGED
@@ -21,6 +21,8 @@ class DuplexPipe
21
21
  @w = @w1
22
22
  end
23
23
 
24
+
25
+
24
26
  def claim_high
25
27
  @r = @r1
26
28
  @w = @w0
@@ -132,3 +134,7 @@ class ChromeRunner
132
134
  end
133
135
  end
134
136
  ###################################################################################################################
137
+
138
+ ###################################################################################################################
139
+ #Execute a system command, will throw an exception on error
140
+ ###################################################################################################################
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flok
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - seo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-16 00:00:00.000000000 Z
11
+ date: 2015-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: execjs
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.5'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -160,7 +174,6 @@ extensions: []
160
174
  extra_rdoc_files: []
161
175
  files:
162
176
  - ".gitignore"
163
- - ".run2"
164
177
  - ".travis.yml"
165
178
  - Gemfile
166
179
  - LICENSE
@@ -169,28 +182,30 @@ files:
169
182
  - app/drivers/chrome/README.md
170
183
  - app/drivers/chrome/Rakefile
171
184
  - app/drivers/chrome/config.yml
172
- - app/drivers/chrome/net.js
173
- - app/drivers/chrome/ui.js
174
- - app/drivers/chrome/vendor/jquery.js
185
+ - app/drivers/chrome/src/config0.js
186
+ - app/drivers/chrome/src/helpers.js
187
+ - app/drivers/chrome/src/net.js
188
+ - app/drivers/chrome/src/ui.js
189
+ - app/drivers/chrome/src/vendor/jquery.js
175
190
  - app/drivers/iface/ui.js
191
+ - app/kern/hello.js
176
192
  - bin/flok
177
193
  - docs/architecture.md
178
194
  - docs/compilation.md
195
+ - docs/driver_interface.md
196
+ - docs/interface.md
179
197
  - docs/platform_drivers.md
180
198
  - docs/project_layout.md
199
+ - docs/testing.md
181
200
  - flok.gemspec
182
201
  - lib/flok.rb
202
+ - lib/flok/build.rb
183
203
  - lib/flok/version.rb
184
- - lib/js/kernel/pipe.js
185
- - lib/js/kernel/utils.js
186
- - lib/js/namespaces.js
187
204
  - logo.png
188
- - public/application.js
189
- - spec/cli_spec.rb
205
+ - output.js
206
+ - spec/build_valid_spec.rb
190
207
  - spec/drivers/net_spec.rb
191
208
  - spec/helpers.rb
192
- - spec/merge_source_spec.rb
193
- - ypou
194
209
  homepage: https://github.com/sotownsend/flok
195
210
  licenses:
196
211
  - MIT
@@ -216,7 +231,6 @@ signing_key:
216
231
  specification_version: 4
217
232
  summary: A boring javascript application framework
218
233
  test_files:
219
- - spec/cli_spec.rb
234
+ - spec/build_valid_spec.rb
220
235
  - spec/drivers/net_spec.rb
221
236
  - spec/helpers.rb
222
- - spec/merge_source_spec.rb
data/.run2 DELETED
@@ -1,3 +0,0 @@
1
- #!/bin/sh
2
-
3
- rake compile
@@ -1,48 +0,0 @@
1
- drivers = window.drivers || {}
2
- drivers.network = {}
3
-
4
- //$(document).ready(function() {
5
- //drivers.network.request("GET", "http://test.services.fittr.com/ping", {}, null);
6
- //})
7
-
8
- //All requests are bound to this table and removed when cancelled
9
- drivers.network.callbackTable = {}
10
- drivers.network.socketIndex = 0 //The current index of the socket, incremented for new sockets
11
-
12
- //A basic get request that supports callbacks
13
- drivers.network.request = function(verb, url, params, completion) {
14
- //Store callback in the table
15
- var socketIndex = drivers.network.socketIndex++
16
- drivers.network.callbackTable[socketIndex] = true
17
-
18
- $.ajax({
19
- url: url,
20
- type: verb,
21
- data: params,
22
- success: function(data) {
23
- data = JSON.parse(data);
24
- completion = completion || function() {}
25
- if (completion != null) {
26
- //Callback if possible
27
- if (drivers.network.callbackTable[socketIndex] === true) {
28
- delete drivers.network.callbackTable[socketIndex];
29
- completion(data, false);
30
- }
31
- }
32
- },
33
- error: function(xhr, status, err) {
34
- if (drivers.network.callbackTable[socketIndex] === true) {
35
- delete drivers.network.callbackTable[socketIndex];
36
- completion({"message":status}, true);
37
- }
38
- }
39
- })
40
-
41
- return socketIndex
42
- }
43
-
44
- drivers.network.cancel_request = function(socket) {
45
- res = drivers.network.callbackTable[socket];
46
- //Clear callback
47
- delete drivers.network.callbackTable[socket]
48
- }
@@ -1,87 +0,0 @@
1
- drivers = window.drivers || {}
2
- drivers.ui = {}
3
-
4
- //Create a new surface based on a prototype name and information. Should return a surface pointer
5
- drivers.ui.createSurface = function(protoName, info) {
6
- var $proto = $("#surface-prototypes").find(".surface[data-name=\'"+protoName+"\']");
7
- if ($proto.length === 0) {
8
- throw "Couldn't find a surface prototype named: \(protoName)";
9
- }
10
-
11
- //Get a UUID, move the surface to the 'body' element and hidden
12
- var uuid = UUID()
13
- $proto.attr("data-uuid", uuid);
14
- $("body").append($proto[0].outerHTML);
15
- $proto.removeAttr("data-uuid");
16
-
17
- $sel = $("[data-uuid='" + uuid + "']");
18
- $sel.addClass("hidden");
19
-
20
- //Does this have a controller?
21
- var scc = drivers.ui.scc[protoName];
22
-
23
- (function() {
24
- var _sel = $sel;
25
- var p = pipe(function(msg) {
26
- console.log("CLICKED!");
27
- if (msg === "sign_in_clicked") {
28
- var source = drivers.ui.createSurface("nav_container", {color: "blue"});
29
- var source2 = drivers.ui.createSurface("login", {color: "blue"});
30
- drivers.ui.embedSurface(source, $("#root-surface"), "main", false, null);
31
- drivers.ui.embedSurface(source2, source, "content", false, null);
32
-
33
- } else if (msg === "login") {
34
- var source = drivers.ui.createSurface("loading");
35
- drivers.ui.embedSurface(source, $("#root-surface"), "main", false, null);
36
-
37
- var callback = function() {
38
- alert("error!");
39
- var source = drivers.ui.createSurface("nav_container", {color: "blue"});
40
- var source2 = drivers.ui.createSurface("login", {color: "blue"});
41
- drivers.ui.embedSurface(source, $("#root-surface"), "main", false, null);
42
- drivers.ui.embedSurface(source2, source, "content", false, null);
43
- }
44
- setTimeout(callback, 400);
45
-
46
- } else {
47
- var source = drivers.ui.createSurface("splash");
48
- drivers.ui.embedSurface(source, $("#root-surface"), "main", false, null);
49
- }
50
- });
51
-
52
- if (scc != undefined) {
53
- new scc($sel, info, p);
54
- }
55
- })();
56
-
57
- //Our surface pointers are selectors
58
- return $sel
59
- }
60
-
61
- //Delete a surface which removes it from the UI
62
- drivers.ui.deleteSurface = function(sp) {
63
- sp.remove();
64
- }
65
-
66
- //Embed a surface into another surface in the view with the correct name
67
- //source_sp - The surface we are embedding
68
- //dest_sp - The surface we are embedding into
69
- //animated - If true, a segue is allowed to take place
70
- //animationDidComplete - Call this funtction if animated is true when you are done animating.
71
- drivers.ui.embedSurface = function(source_sp, dest_sp, viewName, animated, animationDidComplete) {
72
- //Lookup view selector
73
- var $view = dest_sp.find(".view[data-name=" + viewName + "]");
74
- if ($view.length === 0) {
75
- throw "Found surface, but couldn't find a view *inside* a surface named: " + viewName;
76
- }
77
-
78
- $view.html("");
79
- source_sp.appendTo($view);
80
- source_sp.removeClass('hidden');
81
- }
82
-
83
- //Surface controller constructors
84
- drivers.ui.scc = {};
85
- drivers.ui.regController = function(surfaceName, constructor) {
86
- drivers.ui.scc[surfaceName] = constructor;
87
- }
@@ -1,36 +0,0 @@
1
- //Pipes handle all communication and provide 1-way channels
2
-
3
- //All the pipe 'routes'. Each pipe is a number that represents the receiver.
4
- //This table looks up the receiving function
5
- pipe_routes = {};
6
-
7
- //Create a new pipe to a receiver
8
- //will call 'callback' when new data is sent over this pipe
9
- //and returns a opaque pipe pointer (pp)
10
- function pipe(callback) {
11
- var pp = UUID();
12
- pipe_routes[pp] = callback;
13
- return pp;
14
- }
15
-
16
- //Send a message over a pipe
17
- function send(pp, msg) {
18
- var callback = pipe_routes[pp];
19
- if (callback === undefined) {
20
- throw "Could not pipe_send because no route existed for pipe with pointer: "+pp+" with msg: "+msg;
21
- }
22
-
23
- callback(msg);
24
- }
25
-
26
- //Delete a pipe
27
- function close(pp) {
28
- delete flock_pipe_routes[pp];
29
- }
30
-
31
- //List all pipes
32
- function lspipe() {
33
- for (pp in pipe_routes) {
34
- console.log(pp + " - " + pipe_routes[pp]);
35
- }
36
- }
@@ -1,8 +0,0 @@
1
- //Generate a pseudo UUID
2
- ///////////////////////////////////////////////////////////////////////
3
- _uuid_floc = 0;
4
- function UUID() {
5
- _uuid_floc += 1;
6
- return _uuid_floc;
7
- }
8
- ///////////////////////////////////////////////////////////////////////
data/lib/js/namespaces.js DELETED
@@ -1,2 +0,0 @@
1
-
2
-
data/spec/cli_spec.rb DELETED
@@ -1,210 +0,0 @@
1
- #require './lib/flok.rb'
2
- #require 'tempfile'
3
- #require 'securerandom'
4
- #require 'v8'
5
-
6
- #def ensure_tmp
7
- #tmp_spec_path = './spec/tmp'
8
- #FileUtils.mkdir_p(tmp_spec_path) unless File.exists?(tmp_spec_path)
9
- #end
10
-
11
- #RSpec.describe "CLI" do
12
- #it "Creates a new module folder with absolute path" do
13
- ##Get a temporary file, delete it, but save the path
14
- #temp = Tempfile.new SecureRandom.hex
15
- #path = temp.path
16
- #temp.close
17
- #temp.unlink
18
-
19
- #`ruby -Ilib ./bin/flok new #{path}`
20
-
21
- #expect(Dir.exists? path).to be(true)
22
- #end
23
-
24
- #it "Creates a new module folder with relative path" do
25
- #ensure_tmp
26
- #fn = SecureRandom.hex
27
-
28
- #dir = "./spec/tmp/#{fn}"
29
- #`ruby -Ilib ./bin/flok new #{dir}`
30
- #expect(File.exists?(dir)).to be(true)
31
- #end
32
-
33
- #it "Creates a new module folder with correct root folders" do
34
- ##Get a temporary file, delete it, but save the path
35
- #temp = Tempfile.new SecureRandom.hex
36
- #path = temp.path
37
- #temp.close
38
- #temp.unlink
39
-
40
- #`ruby -Ilib ./bin/flok new #{path}`
41
-
42
- #folders = %w{app lib config}
43
-
44
- #folders.each do |f|
45
- #p = "#{path}/#{f}"
46
- #expect(Dir.exists? p).to be(true)
47
- #end
48
- #end
49
-
50
- #it "The new module has all the files and folders of a RubyGem" do
51
- ##Get a temporary file, delete it, but save the path
52
- #temp = Tempfile.new SecureRandom.hex
53
- #path = temp.path
54
- #temp.close
55
- #temp.unlink
56
- #FileUtils.mkdir_p(path)
57
- #test_gem_path = "#{path}/test_gem"
58
- #FileUtils.mkdir_p(test_gem_path)
59
- #file_paths = []
60
- #dir_paths = []
61
- #name = "#{SecureRandom.hex[0..4]}_module_name"
62
- #Dir.chdir(test_gem_path) do
63
- #`bundle gem #{name}`
64
-
65
- #Dir.chdir "./#{name}" do
66
- #Dir["**/*"].each do |f|
67
- #if File.file?(f)
68
- #file_paths << f
69
- #end
70
-
71
- #if File.directory?(f)
72
- #dir_paths << f
73
- #end
74
- #end
75
- #end
76
-
77
- #file_paths.uniq!
78
- #dir_paths.uniq!
79
- #end
80
-
81
- #`ruby -Ilib ./bin/flok new #{path}/#{name}`
82
- #Dir.chdir "#{path}/#{name}" do
83
- #Dir["**/*"].each do |f|
84
- #if File.file?(f)
85
- #file_paths = file_paths - [f]
86
- #end
87
-
88
- #if File.directory?(f)
89
- #dir_paths = dir_paths - [f]
90
- #end
91
- #end
92
-
93
- #if file_paths.count+dir_paths.count != 0
94
- #puts "------------------------------------------------------------------------------"
95
- #puts "Files not found matching Gemfile: #{file_paths.inspect}" if file_paths.count > 0
96
- #puts "Directories not found matching Gemfile: #{dir_paths.inspect}" if dir_paths.count > 0
97
- #puts "------------------------------------------------------------------------------"
98
- #end
99
-
100
- #expect(file_paths.count+dir_paths.count).to be(0)
101
- #end
102
- #end
103
-
104
- #it "does create a public/application.js when 'build' is run" do
105
- ##Get a temporary file, delete it, but save the path
106
- #temp = Tempfile.new SecureRandom.hex
107
- #path = temp.path
108
- #temp.close
109
- #temp.unlink
110
-
111
- #`ruby -Ilib ./bin/flok new #{path}`
112
- #gem_root_path = File.expand_path(File.dirname(__FILE__))+"/.."
113
- #Dir.chdir path do
114
- #`ruby -I#{gem_root_path}/lib #{gem_root_path}/bin/flok build`
115
- #expect(File.exist?("./public/application.js")).to be(true)
116
- #end
117
- #end
118
-
119
- #it "does create a public/application.js when 'build' is run that's not empty" do
120
- ##Get a temporary file, delete it, but save the path
121
- #temp = Tempfile.new SecureRandom.hex
122
- #path = temp.path
123
- #temp.close
124
- #temp.unlink
125
-
126
- #`ruby -Ilib ./bin/flok new #{path}`
127
- #gem_root_path = File.expand_path(File.dirname(__FILE__))+"/.."
128
- #Dir.chdir path do
129
- #`ruby -I#{gem_root_path}/lib #{gem_root_path}/bin/flok build`
130
- #expect(File.read("./public/application.js").length).to be > 0
131
- #end
132
- #end
133
-
134
- #it "creates an application.js that is executable by js" do
135
- ##Get a temporary file, delete it, but save the path
136
- #temp = Tempfile.new SecureRandom.hex
137
- #path = temp.path
138
- #temp.close
139
- #temp.unlink
140
-
141
- #`ruby -Ilib ./bin/flok new #{path}`
142
- #gem_root_path = File.expand_path(File.dirname(__FILE__))+"/.."
143
- #Dir.chdir path do
144
- #`ruby -I#{gem_root_path}/lib #{gem_root_path}/bin/flok build`
145
- ##str = File.read("./public/application.js")
146
- #ctx = V8::Context.new
147
- #ctx.load("./public/application.js")
148
- ##ExecJS.compile(str)
149
- ##it does not throw an error
150
- #end
151
- #end
152
-
153
- #it "supports build --compress, which makes a smaller js file" do
154
- ##Get a temporary file, delete it, but save the path
155
- #temp = Tempfile.new SecureRandom.hex
156
- #path = temp.path
157
- #temp.close
158
- #temp.unlink
159
-
160
- #uncompressed_length = 0
161
- #compressed_length = 0
162
- #`ruby -Ilib ./bin/flok new #{path}`
163
- #gem_root_path = File.expand_path(File.dirname(__FILE__))+"/.."
164
- #Dir.chdir path do
165
- #`ruby -I#{gem_root_path}/lib #{gem_root_path}/bin/flok build`
166
- #str = File.read("./public/application.js")
167
- #uncompressed_length = str.length
168
-
169
- #`ruby -I#{gem_root_path}/lib #{gem_root_path}/bin/flok build --compress`
170
- #str = File.read("./public/application.js")
171
- #compressed_length = str.length
172
- #expect(compressed_length).to be < uncompressed_length
173
- ##it does not throw an error
174
- #end
175
- #end
176
-
177
- #it "supports build --compress, which makes a smaller js file (that still contains something)" do
178
- ##Get a temporary file, delete it, but save the path
179
- #temp = Tempfile.new SecureRandom.hex
180
- #path = temp.path
181
- #temp.close
182
- #temp.unlink
183
-
184
- #`ruby -Ilib ./bin/flok new #{path}`
185
- #gem_root_path = File.expand_path(File.dirname(__FILE__))+"/.."
186
- #Dir.chdir path do
187
- #`ruby -I#{gem_root_path}/lib #{gem_root_path}/bin/flok build --compress`
188
- #str = File.read("./public/application.js")
189
- #expect(str.length).to be > 0
190
- ##it does not throw an error
191
- #end
192
- #end
193
-
194
- #it "creates an application.js that is executable by js when compress" do
195
- ##Get a temporary file, delete it, but save the path
196
- #temp = Tempfile.new SecureRandom.hex
197
- #path = temp.path
198
- #temp.close
199
- #temp.unlink
200
-
201
- #`ruby -Ilib ./bin/flok new #{path}`
202
- #gem_root_path = File.expand_path(File.dirname(__FILE__))+"/.."
203
- #Dir.chdir path do
204
- #`ruby -I#{gem_root_path}/lib #{gem_root_path}/bin/flok build --compress`
205
- #ctx = V8::Context.new
206
- #ctx.load("./public/application.js")
207
- ##it does not throw an error
208
- #end
209
- #end
210
- #end