efflux 0.0.1 → 0.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bba5ac045934c1fe04d212826adf6c193c8cb484
4
- data.tar.gz: c50f294351db47da9ed74d932720d4a5f84765c1
3
+ metadata.gz: 3db8f1af5749f3d4c7afb1c19f6a6c8dc3b07e55
4
+ data.tar.gz: 3f34070b587f5d1e2376a6d60152ea270f5ad417
5
5
  SHA512:
6
- metadata.gz: 42a976bb7b552b87f8ea50970f2d3579bdb2380304c5968d5ecdce1f9c6d8f80b1955dbf82861782b8042ff35620ddb1033952e83b68c9a092f0d4a96324f5bc
7
- data.tar.gz: 6c370cf7e5ae513b047068c47705ae9e78130ac1af797aaf8f063f3481e558f9c5be5bcb6da9f55d201ba550c874cd896b12a876439aa6443d20770470101835
6
+ metadata.gz: 5b4a153ca1c6cca175388caedd2957181557f08bfd24bf7ee28419fc45b10a57afb110a3f48859bab29388879cb6c3be8fa85e172ea236fcbcaa1011409b2645
7
+ data.tar.gz: a85e6704accc98e5fa79c9343a943febad3cfd0ed4a2391c9053d8995cd15c995681b6ab345c7fe554176ff429ab7a58220f26e1483685fb0404631fc58f9dba
@@ -1,3 +1,3 @@
1
1
  module Efflux
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -0,0 +1,133 @@
1
+ (function() {
2
+ var Efflux,
3
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
4
+
5
+ $.fn.extend({
6
+ efflux: function(options) {
7
+ return this.each(function(index, elem) {
8
+ return new Efflux(elem, options);
9
+ });
10
+ }
11
+ });
12
+
13
+ $(function() {
14
+ return $('.spec-terminal').efflux({
15
+ url: '/command_stream',
16
+ title: 'rspec'
17
+ });
18
+ });
19
+
20
+ Efflux = (function() {
21
+ Efflux.prototype.e_source = void 0;
22
+
23
+ Efflux.prototype.socket_open = false;
24
+
25
+ Efflux.prototype.lines = 0;
26
+
27
+ Efflux.prototype.title = '';
28
+
29
+ Efflux.prototype.run_time = 0;
30
+
31
+ Efflux.prototype.container = void 0;
32
+
33
+ Efflux.prototype.running = false;
34
+
35
+ function Efflux(elem, options) {
36
+ this.format_runtime = __bind(this.format_runtime, this);
37
+ this.update_timer = __bind(this.update_timer, this);
38
+ this.get_status = __bind(this.get_status, this);
39
+ this.build_console = __bind(this.build_console, this);
40
+ this.data_received = __bind(this.data_received, this);
41
+ this.socket_error = __bind(this.socket_error, this);
42
+ this.socket_open = __bind(this.socket_open, this);
43
+ this.e_source = new EventSource(options.url);
44
+ this.e_source.onerror = this.socket_error;
45
+ this.e_source.onopen = this.socket_open;
46
+ this.e_source.addEventListener('command.data', this.data_received);
47
+ this.container = $(elem);
48
+ this.title = options.title || '';
49
+ this.build_console();
50
+ }
51
+
52
+ Efflux.prototype.socket_open = function(e) {
53
+ this.running = true;
54
+ return this.clock_timer = setTimeout(this.update_timer, 1000);
55
+ };
56
+
57
+ Efflux.prototype.socket_error = function(e) {
58
+ e.target.close();
59
+ this.running = false;
60
+ clearTimeout(this.clock_timer);
61
+ return this.update_timer();
62
+ };
63
+
64
+ Efflux.prototype.data_received = function(e) {
65
+ var auto_scroll, console_height, scroll_height, scroll_top;
66
+ this.lines++;
67
+ scroll_top = this.container.find('.console').scrollTop();
68
+ console_height = this.container.find('.console').outerHeight();
69
+ scroll_height = this.container.find('.console')[0].scrollHeight;
70
+ auto_scroll = scroll_height - scroll_top === console_height || scroll_top === 0;
71
+ this.container.find('.console pre').append(e.data);
72
+ this.container.find('.console').stop();
73
+ if (auto_scroll) {
74
+ return this.container.find('.console').animate({
75
+ scrollTop: this.container.find('.console')[0].scrollHeight
76
+ }, 500);
77
+ }
78
+ };
79
+
80
+ Efflux.prototype.build_console = function() {
81
+ var status, _ref;
82
+ status = (_ref = this.running) != null ? _ref : {
83
+ 'Running': 'Finished'
84
+ };
85
+ return this.container.html("<div class=\"console-frame\"> <div class=\"statusbar\"> <div class=\"title\">" + this.title + " [Starting] - 00m:00s</div> <button type=\"button\" class=\"fullscreen\"/> </div> <div class=\"console\"><pre></pre> </div> </div>");
86
+ };
87
+
88
+ Efflux.prototype.get_status = function() {
89
+ if (this.running) {
90
+ return 'Running';
91
+ } else {
92
+ return 'Finished';
93
+ }
94
+ };
95
+
96
+ Efflux.prototype.update_timer = function() {
97
+ this.run_time++;
98
+ this.container.find('.title').html("" + this.title + " [" + (this.get_status()) + "] - " + (this.format_runtime()));
99
+ if (this.running) {
100
+ return setTimeout(this.update_timer, 1000);
101
+ }
102
+ };
103
+
104
+ Efflux.prototype.format_runtime = function() {
105
+ var minutes, seconds;
106
+ seconds = this.run_time;
107
+ minutes = 0;
108
+ if (seconds > 60) {
109
+ minutes = seconds / 60;
110
+ seconds = seconds - (minutes * 60);
111
+ }
112
+ return "" + (this.pad(minutes, 2)) + "m:" + (this.pad(seconds, 2)) + "s";
113
+ };
114
+
115
+ Efflux.prototype.pad = function(val, length, padChar) {
116
+ var numPads;
117
+ if (padChar == null) {
118
+ padChar = '0';
119
+ }
120
+ val += '';
121
+ numPads = length - val.length;
122
+ if (numPads > 0) {
123
+ return new Array(numPads + 1).join(padChar) + val;
124
+ } else {
125
+ return val;
126
+ }
127
+ };
128
+
129
+ return Efflux;
130
+
131
+ })();
132
+
133
+ }).call(this);
@@ -0,0 +1,58 @@
1
+ @import url(http://fonts.googleapis.com/css?family=Open+Sans);
2
+ .console-frame {
3
+ border: 1px solid #999;
4
+ -moz-box-shadow: 0 0 2px #888;
5
+ -webkit-box-shadow: 0 0 2px #888;
6
+ box-shadow: 0 0 2px #888;
7
+ padding: 5px;
8
+ padding-top: 0px;
9
+ position: relative;
10
+ background-color: #fff;
11
+ overflow: hidden;
12
+ border-radius: 5px; }
13
+ .console-frame .console {
14
+ font-family: "Lucida Console", Monaco, monospace;
15
+ font-size: 1em;
16
+ line-height: 1.375em;
17
+ background: #333;
18
+ color: #eee;
19
+ padding: 8px;
20
+ height: 300px;
21
+ overflow-x: scroll;
22
+ word-wrap: break-word;
23
+ -moz-box-shadow: inset 0 0 5px #161616;
24
+ -webkit-box-shadow: inset 0 0 5px #161616;
25
+ box-shadow: inner 0 0 5px #161616; }
26
+ .console-frame .console .command-finished {
27
+ border-top: 1px solid #ccc; }
28
+ .console-frame .console .foreground-green {
29
+ color: #00ff00; }
30
+ .console-frame .statusbar {
31
+ height: 26px;
32
+ border-bottom: 1px solid #000; }
33
+ .console-frame .statusbar .title {
34
+ font-family: 'Open-Sans', sans-serif;
35
+ text-shadow: white 0px 3px 3px;
36
+ float: left;
37
+ font-weight: 200;
38
+ font-size: 1em;
39
+ margin-top: 4px;
40
+ padding-left: 15px;
41
+ color: #666;
42
+ font-weight: bold; }
43
+ .console-frame .statusbar button {
44
+ float: right;
45
+ margin-top: 3px;
46
+ margin-left: 3px;
47
+ height: 20px;
48
+ width: 20px;
49
+ border-radius: 4px;
50
+ box-shadow: none;
51
+ border: none;
52
+ background-color: transparent; }
53
+ .console-frame .statusbar button.fullscreen {
54
+ background-image: url("fullscreen.png");
55
+ background-size: 75% 75%;
56
+ background-position: center center;
57
+ background-repeat: no-repeat;
58
+ cursor: pointer; }
metadata CHANGED
@@ -1,71 +1,75 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: efflux
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Bellus
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-26 00:00:00.000000000 Z
11
+ date: 2014-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '4.1'
20
+ - - ~>
18
21
  - !ruby/object:Gem::Version
19
22
  version: 4.1.1
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '4.1'
30
+ - - ~>
25
31
  - !ruby/object:Gem::Version
26
32
  version: 4.1.1
27
33
  - !ruby/object:Gem::Dependency
28
- name: coffee-rails
34
+ name: sqlite3
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - ">="
37
+ - - ~>
32
38
  - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
+ version: '1.3'
40
+ - - '>='
39
41
  - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: sass
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :runtime
42
+ version: 1.3.9
43
+ type: :development
49
44
  prerelease: false
50
45
  version_requirements: !ruby/object:Gem::Requirement
51
46
  requirements:
52
- - - ">="
47
+ - - ~>
53
48
  - !ruby/object:Gem::Version
54
- version: '0'
49
+ version: '1.3'
50
+ - - '>='
51
+ - !ruby/object:Gem::Version
52
+ version: 1.3.9
55
53
  - !ruby/object:Gem::Dependency
56
54
  name: rspec-rails
57
55
  requirement: !ruby/object:Gem::Requirement
58
56
  requirements:
59
- - - ">="
57
+ - - ~>
58
+ - !ruby/object:Gem::Version
59
+ version: '2.14'
60
+ - - '>='
60
61
  - !ruby/object:Gem::Version
61
- version: '0'
62
+ version: 2.14.2
62
63
  type: :development
63
64
  prerelease: false
64
65
  version_requirements: !ruby/object:Gem::Requirement
65
66
  requirements:
66
- - - ">="
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '2.14'
70
+ - - '>='
67
71
  - !ruby/object:Gem::Version
68
- version: '0'
72
+ version: 2.14.2
69
73
  description: Efflux makes it easy to display live system commands in a browser based
70
74
  console panel.
71
75
  email:
@@ -80,9 +84,11 @@ files:
80
84
  - lib/efflux/version.rb
81
85
  - lib/tasks/efflux_tasks.rake
82
86
  - vendor/assets/images/fullscreen.png
83
- - vendor/assets/javascripts/efflux.js.coffee
84
- - vendor/assets/stylesheets/efflux.css.scss
85
- homepage: https://github.com/ViaoV/efflux
87
+ - vendor/assets/javascripts/efflux.coffee
88
+ - vendor/assets/javascripts/efflux.js
89
+ - vendor/assets/stylesheets/efflux.css
90
+ - vendor/assets/stylesheets/efflux.scss
91
+ homepage: http://viaov.github.io/efflux/
86
92
  licenses:
87
93
  - MIT
88
94
  metadata: {}
@@ -92,12 +98,12 @@ require_paths:
92
98
  - lib
93
99
  required_ruby_version: !ruby/object:Gem::Requirement
94
100
  requirements:
95
- - - ">="
101
+ - - '>='
96
102
  - !ruby/object:Gem::Version
97
103
  version: '0'
98
104
  required_rubygems_version: !ruby/object:Gem::Requirement
99
105
  requirements:
100
- - - ">="
106
+ - - '>='
101
107
  - !ruby/object:Gem::Version
102
108
  version: '0'
103
109
  requirements: []