sweet_staging 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,28 +3,26 @@
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1">
6
- <title>Sweet Staging</title>
6
+ <title><%= yield :title %></title>
7
7
  <%= csrf_meta_tags %>
8
8
  <%= csp_meta_tag if ::Rails::VERSION::STRING.to_f >= 5.2 %>
9
9
  <link rel="preconnect" href="https://fonts.gstatic.com">
10
10
  <link href="https://fonts.googleapis.com/css2?family=Ubuntu+Mono&display=swap" rel="stylesheet">
11
11
  <%= render '/sweet_staging/stylesheets/stylesheets' %>
12
+ <%= render '/sweet_staging/javascripts/javascripts' %>
12
13
  <link rel="shortcut icon" href="/favicon.ico">
13
14
  <script>
14
15
  var FETCH_TIMEOUT = <%= SweetStaging.fetch_timeout %>;
15
16
  </script>
16
17
  </head>
17
- <body class="page-wrapper">
18
- <div class="content-wrapper">
19
- <section class="section">
20
- <div class="">
21
- <%#= render '/sweet_staging/shared/header' %>
22
- <%= yield %>
23
- </div>
24
- </section>
25
- </div>
18
+ <body>
19
+ <section>
20
+ <div class="">
21
+ <%= render '/sweet_staging/shared/header' %>
22
+ <%= yield %>
23
+ </div>
24
+ </section>
26
25
  <%#= render '/sweet_staging/shared/footer' %>
27
- <%= render '/sweet_staging/javascripts/javascripts' %>
28
26
  <%= yield :on_load %>
29
27
  </body>
30
28
  </html>
@@ -1,20 +1,19 @@
1
- <div class="tabs is-large">
2
- <ul>
3
- <% SweetStaging.logs.each_with_index do |log, index| %>
4
- <li class="<%= 'is-active' if log[:name] == params[:name] || (index == 0 && params[:name].blank?) %>">
5
- <%= link_to log[:name], sweet_staging.watch_url(name: log[:name]), "changes_url" => sweet_staging.changes_url(name: log[:name]) %>
6
- </li>
7
- <% end %>
8
- </ul>
9
- </div>
1
+ <%= provide :title, params[:name] %>
2
+
3
+ <script>
4
+ $(function() {
5
+ logsWorkerInit();
6
+ });
7
+ </script>
10
8
 
11
- <div id="logs">
9
+ <div class="page-content">
12
10
  <div class="loader-wrapper">
13
11
  <div class="loader is-loading"></div>
14
12
  </div>
13
+ <div id="logs" class="scrollable-content"></div>
15
14
  </div>
16
15
 
17
- <div class="columns is-fluid" id="controls">
16
+ <div class="page-footer columns is-fluid" id="controls">
18
17
  <div class="column">
19
18
  <a class="button" id="pause" onclick="pauseButton();">
20
19
  <%= icon 'pause2' %>
@@ -1,3 +1,24 @@
1
- <%= link_to sweet_staging.home_url, class: "logo" do %>
2
- <h2>Logs</h2>
3
- <% end %>
1
+ <div class="page-header tabs is-large">
2
+ <ul>
3
+ <% SweetStaging.logs.each_with_index do |log, index| %>
4
+ <li class="<%= 'is-active' if log[:name] == params[:name] || (index == 0 && params[:name].blank? && controller_name == 'logs') %>">
5
+ <%= link_to log[:name], sweet_staging.watch_url(name: log[:name]), "changes_url" => sweet_staging.changes_url(name: log[:name]) %>
6
+ </li>
7
+ <% end %>
8
+
9
+ <% if SweetStaging.console %>
10
+ <li class="<%= 'is-active' if controller_name == 'console' %>">
11
+ <%= link_to sweet_staging.console_url, class: 'console-icon' do %>
12
+ <%= icon 'ror' %>
13
+ console
14
+ <% end %>
15
+ </li>
16
+ <% end %>
17
+
18
+ <% SweetStaging.commands.each_with_index do |command, index| %>
19
+ <li class="<%= 'is-active' if command[:name] == params[:name] || (index == 0 && params[:name].blank? && controller_name == 'commands') %>">
20
+ <%= link_to command[:name], sweet_staging.call_url(name: command[:name]) %>
21
+ </li>
22
+ <% end %>
23
+ </ul>
24
+ </div>
@@ -1,3 +1,4 @@
1
1
  <%= insert_css_file "bulmaswatch.min.css" %>
2
2
  <%= insert_css_file "perfect-scrollbar.css" %>
3
+ <%= insert_css_file "gruvbox-dark.css" %>
3
4
  <%= insert_css_file "style.css" %>
@@ -0,0 +1,107 @@
1
+ /*
2
+
3
+ Gruvbox style (dark) (c) Pavel Pertsev (original style at https://github.com/morhetz/gruvbox)
4
+
5
+ */
6
+
7
+ .hljs {
8
+ display: block;
9
+ overflow-x: auto;
10
+ padding: 0.5em;
11
+ }
12
+
13
+ .hljs,
14
+ .hljs-subst {
15
+ color: #ebdbb2;
16
+ }
17
+
18
+ /* Gruvbox Red */
19
+ .hljs-deletion,
20
+ .hljs-formula,
21
+ .hljs-keyword,
22
+ .hljs-link,
23
+ .hljs-selector-tag {
24
+ color: #fb4934;
25
+ }
26
+
27
+ /* Gruvbox Blue */
28
+ .hljs-built_in,
29
+ .hljs-emphasis,
30
+ .hljs-name,
31
+ .hljs-quote,
32
+ .hljs-strong,
33
+ .hljs-title,
34
+ .hljs-variable {
35
+ color: #83a598;
36
+ }
37
+
38
+ /* Gruvbox Yellow */
39
+ .hljs-attr,
40
+ .hljs-params,
41
+ .hljs-template-tag,
42
+ .hljs-type {
43
+ color: #fabd2f;
44
+ }
45
+
46
+ /* Gruvbox Purple */
47
+ .hljs-builtin-name,
48
+ .hljs-doctag,
49
+ .hljs-literal,
50
+ .hljs-number {
51
+ color: #8f3f71;
52
+ }
53
+
54
+ /* Gruvbox Orange */
55
+ .hljs-code,
56
+ .hljs-meta,
57
+ .hljs-regexp,
58
+ .hljs-selector-id,
59
+ .hljs-template-variable {
60
+ color: #fe8019;
61
+ }
62
+
63
+ /* Gruvbox Green */
64
+ .hljs-addition,
65
+ .hljs-meta-string,
66
+ .hljs-section,
67
+ .hljs-selector-attr,
68
+ .hljs-selector-class,
69
+ .hljs-string,
70
+ .hljs-symbol {
71
+ color: #b8bb26;
72
+ }
73
+
74
+ /* Gruvbox Aqua */
75
+ .hljs-attribute,
76
+ .hljs-bullet,
77
+ .hljs-class,
78
+ .hljs-function,
79
+ .hljs-function .hljs-keyword,
80
+ .hljs-meta-keyword,
81
+ .hljs-selector-pseudo,
82
+ .hljs-tag {
83
+ color: #8ec07c;
84
+ }
85
+
86
+ /* Gruvbox Gray */
87
+ .hljs-comment {
88
+ color: #928374;
89
+ }
90
+
91
+ /* Gruvbox Purple */
92
+ .hljs-link_label,
93
+ .hljs-literal,
94
+ .hljs-number {
95
+ color: #d3869b;
96
+ }
97
+
98
+ .hljs-comment,
99
+ .hljs-emphasis {
100
+ font-style: italic;
101
+ }
102
+
103
+ .hljs-section,
104
+ .hljs-strong,
105
+ .hljs-tag {
106
+ font-weight: bold;
107
+ }
@@ -1,51 +1,153 @@
1
- .page-wrapper {
2
- display: flex;
3
- min-height: 100vh;
4
- flex-direction: column;
1
+
2
+ html, body {
3
+ scrollbar-width: none;
4
+ }
5
+
6
+ body::-webkit-scrollbar {
7
+ display: none;
8
+ }
9
+
10
+ .page-header {
11
+ position: fixed;
12
+ right: 0;
13
+ left: 0;
14
+ z-index: 100;
15
+ background-color: black;
5
16
  }
6
17
 
7
- .content-wrapper {
8
- flex: 1;
18
+ .page-footer {
19
+ position: fixed;
20
+ right: 0;
21
+ left: 0;
22
+ bottom: 0;
23
+ padding: 20px;
24
+ }
25
+
26
+ .page-content {
27
+ padding: 70px 20px 0 20px;
28
+ position: relative;
29
+ }
30
+
31
+ .loader-wrapper {
32
+ position: absolute;
33
+ width: 100%;
34
+ height: 100%;
35
+ }
36
+
37
+ .is-loading {
38
+ left: calc(50% - 0.5em);
39
+ top: 35%
40
+ }
41
+
42
+ .scrollable-content {
43
+ position: relative;
44
+ width: 100%;
45
+ font-family: Consolas, "Ubuntu Mono";
46
+ font-size: 13px;
47
+ line-height: 17px;
48
+ overflow-y: scroll;
49
+
50
+ /* Firefox custom scrollbar */
51
+ scrollbar-width: thin;
52
+ scrollbar-color: #888 black;
9
53
  }
10
54
 
11
55
  #logs {
12
- position: relative;
13
- width: 100%;
14
- height: 750px;
56
+ height: calc(100vh - 150px);
57
+ white-space: pre-wrap;
58
+ }
15
59
 
16
- font-family: Consolas, "Ubuntu Mono";
17
- font-size: 13px;
18
- line-height: 17px;
19
- white-space: pre-wrap;
60
+ /* Webkit custom scrollbar */
61
+ .scrollable-content::-webkit-scrollbar {
62
+ width: 7px;
63
+ }
64
+ .scrollable-content::-webkit-scrollbar-track {
65
+ background: black;
66
+ }
67
+ .scrollable-content::-webkit-scrollbar-thumb {
68
+ background: #888;
69
+ border-radius: 3px;
70
+ }
71
+ .scrollable-content::-webkit-scrollbar-thumb:hover {
72
+ background: #555;
20
73
  }
21
74
 
22
75
  #controls {
23
- padding-top: 20px;
76
+ padding-top: 20px;
24
77
  }
25
78
 
26
79
  #controls a svg {
27
- width: 16px;
28
- height: 16px;
29
- margin-right: 6px;
80
+ width: 16px;
81
+ height: 16px;
82
+ margin-right: 6px;
30
83
  }
31
84
 
32
85
  .github-ext {
33
- display: inline-block;
34
- margin-top: 15px;
35
- height: 14px;
86
+ display: inline-block;
87
+ margin-top: 15px;
88
+ height: 14px;
36
89
  }
37
90
 
38
91
  .github-ext svg {
39
- height: 14px;
40
- width: 14px;
92
+ height: 14px;
93
+ width: 14px;
41
94
  }
42
95
 
43
96
  #three-dots {
44
- display: inline-block;
45
- margin-left: 20px;
46
- padding-top: 5px;
97
+ display: inline-block;
98
+ margin-left: 20px;
99
+ padding-top: 5px;
47
100
  }
48
101
 
49
102
  #three-dots svg {
50
- height: 4px;
51
- }
103
+ height: 4px;
104
+ }
105
+
106
+ #console {
107
+ height: calc(100vh - 256px);
108
+ }
109
+
110
+ #console.hidden {
111
+ opacity: 0.5;
112
+ }
113
+
114
+ .console-icon svg {
115
+ margin-top: 6px;
116
+ width: 24px;
117
+ height: 24px;
118
+ margin-right: 8px;
119
+ }
120
+
121
+ #command-output {
122
+ overflow-y: scroll;
123
+ font-family: Consolas, "Ubuntu Mono";
124
+ font-size: 13px;
125
+ line-height: 17px;
126
+ }
127
+
128
+ .textarea {
129
+ min-height: auto !important;
130
+ height: 100px !important;
131
+ margin-bottom: 15px !important;
132
+ background-color: #292929;
133
+ border: none;
134
+ color: white;
135
+ }
136
+
137
+ .textarea::placeholder {
138
+ color: silver;
139
+ }
140
+
141
+ pre {
142
+ background-color:#1c1b1b !important;
143
+ }
144
+
145
+ .execute-btn svg {
146
+ width: 16px;
147
+ height: 16px;
148
+ margin-right: 6px;
149
+ }
150
+
151
+ .console-content.loader-wrapper {
152
+ display: none;
153
+ }
@@ -3,6 +3,11 @@ SweetStaging::Engine.routes.draw do
3
3
  get '/watch' => 'logs#watch', as: :watch
4
4
  get '/watch/changes' => 'logs#changes', as: :changes
5
5
 
6
+ get '/console' => 'console#index', as: :console
7
+ post '/execute' => 'console#execute', as: :execute
8
+
9
+ get '/call' => 'commands#call', as: :call
10
+
6
11
  ["ansi_up.js.map", "perfect-scrollbar.min.js.map", "bulmaswatch.min.css.map", "ansi_up.js.map", "perfect-scrollbar.min.js.map", "bulmaswatch.min.css.map"].each do |res|
7
12
  get "/#{res}", to: -> (env) do
8
13
  [200, { 'Content-Type' => 'text/plain' }, ['']]
@@ -1,4 +1,6 @@
1
1
  require "sweet_staging/version"
2
+ require "awesome_print"
3
+ require "open3"
2
4
 
3
5
  module SweetStaging
4
6
  mattr_accessor :enabled
@@ -25,11 +27,17 @@ module SweetStaging
25
27
  @@verify_access_proc = proc { |controller| true }
26
28
 
27
29
  mattr_accessor :fetch_timeout
28
- @@fetch_timeout = 5000
30
+ @@fetch_timeout = 1000
29
31
 
30
32
  mattr_accessor :logs
31
33
  @@logs = []
32
34
 
35
+ mattr_accessor :console
36
+ @@console = true
37
+
38
+ mattr_accessor :commands
39
+ @@commands = []
40
+
33
41
  def self.setup
34
42
  yield(self)
35
43
  end
@@ -1,3 +1,3 @@
1
1
  module SweetStaging
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sweet_staging
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Kasyanchuk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-30 00:00:00.000000000 Z
11
+ date: 2021-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -24,6 +24,34 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 5.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: awesome_print
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: open3
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: pry
29
57
  requirement: !ruby/object:Gem::Requirement
@@ -61,18 +89,25 @@ files:
61
89
  - app/assets/images/play3.svg
62
90
  - app/assets/images/plus.svg
63
91
  - app/assets/images/record.svg
92
+ - app/assets/images/ror.svg
64
93
  - app/assets/images/settings.svg
65
94
  - app/assets/images/stop.svg
66
95
  - app/assets/images/success.svg
67
96
  - app/assets/images/three-dots.svg
68
97
  - app/controllers/sweet_staging/base_controller.rb
98
+ - app/controllers/sweet_staging/commands_controller.rb
99
+ - app/controllers/sweet_staging/console_controller.rb
69
100
  - app/controllers/sweet_staging/home_controller.rb
70
101
  - app/controllers/sweet_staging/logs_controller.rb
71
102
  - app/helpers/sweet_staging/application_helper.rb
103
+ - app/views/sweet_staging/commands/call.html.erb
104
+ - app/views/sweet_staging/console/execute.js.erb
105
+ - app/views/sweet_staging/console/index.html.erb
72
106
  - app/views/sweet_staging/home/index.html.erb
73
107
  - app/views/sweet_staging/javascripts/_javascripts.html.erb
74
108
  - app/views/sweet_staging/javascripts/ansi_up.js
75
109
  - app/views/sweet_staging/javascripts/app.js
110
+ - app/views/sweet_staging/javascripts/highlight.pack.js
76
111
  - app/views/sweet_staging/javascripts/jquery-3.4.1.min.js
77
112
  - app/views/sweet_staging/javascripts/keyboard.min.js
78
113
  - app/views/sweet_staging/javascripts/perfect-scrollbar.min.js
@@ -85,6 +120,7 @@ files:
85
120
  - app/views/sweet_staging/shared/_header.html.erb
86
121
  - app/views/sweet_staging/stylesheets/_stylesheets.html.erb
87
122
  - app/views/sweet_staging/stylesheets/bulmaswatch.min.css
123
+ - app/views/sweet_staging/stylesheets/gruvbox-dark.css
88
124
  - app/views/sweet_staging/stylesheets/perfect-scrollbar.css
89
125
  - app/views/sweet_staging/stylesheets/style.css
90
126
  - config/routes.rb