sweet_staging 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +36 -0
  4. data/Rakefile +18 -0
  5. data/app/assets/config/sweet_staging_manifest.js +0 -0
  6. data/app/assets/images/eq.svg +1 -0
  7. data/app/assets/images/error.svg +1 -0
  8. data/app/assets/images/heart.svg +1 -0
  9. data/app/assets/images/like.svg +1 -0
  10. data/app/assets/images/minus.svg +1 -0
  11. data/app/assets/images/pause.svg +1 -0
  12. data/app/assets/images/pause2.svg +1 -0
  13. data/app/assets/images/play.svg +1 -0
  14. data/app/assets/images/play2.svg +1 -0
  15. data/app/assets/images/play3.svg +1 -0
  16. data/app/assets/images/plus.svg +1 -0
  17. data/app/assets/images/record.svg +1 -0
  18. data/app/assets/images/settings.svg +1 -0
  19. data/app/assets/images/stop.svg +1 -0
  20. data/app/assets/images/success.svg +1 -0
  21. data/app/assets/images/three-dots.svg +33 -0
  22. data/app/controllers/sweet_staging/base_controller.rb +24 -0
  23. data/app/controllers/sweet_staging/home_controller.rb +13 -0
  24. data/app/controllers/sweet_staging/logs_controller.rb +24 -0
  25. data/app/helpers/sweet_staging/application_helper.rb +27 -0
  26. data/app/views/sweet_staging/home/index.html.erb +0 -0
  27. data/app/views/sweet_staging/javascripts/_javascripts.html.erb +8 -0
  28. data/app/views/sweet_staging/javascripts/ansi_up.js +421 -0
  29. data/app/views/sweet_staging/javascripts/app.js +91 -0
  30. data/app/views/sweet_staging/javascripts/jquery-3.4.1.min.js +2 -0
  31. data/app/views/sweet_staging/javascripts/keyboard.min.js +1 -0
  32. data/app/views/sweet_staging/javascripts/perfect-scrollbar.min.js +20 -0
  33. data/app/views/sweet_staging/javascripts/rails.js +565 -0
  34. data/app/views/sweet_staging/javascripts/selection.js +15 -0
  35. data/app/views/sweet_staging/layouts/sweet_staging.html.erb +30 -0
  36. data/app/views/sweet_staging/logs/changes.js.erb +5 -0
  37. data/app/views/sweet_staging/logs/watch.html.erb +43 -0
  38. data/app/views/sweet_staging/shared/_footer.html.erb +0 -0
  39. data/app/views/sweet_staging/shared/_header.html.erb +3 -0
  40. data/app/views/sweet_staging/stylesheets/_stylesheets.html.erb +3 -0
  41. data/app/views/sweet_staging/stylesheets/bulmaswatch.min.css +6 -0
  42. data/app/views/sweet_staging/stylesheets/perfect-scrollbar.css +116 -0
  43. data/app/views/sweet_staging/stylesheets/style.css +51 -0
  44. data/config/routes.rb +20 -0
  45. data/lib/sweet_staging.rb +78 -0
  46. data/lib/sweet_staging/engine.rb +16 -0
  47. data/lib/sweet_staging/rails/middleware.rb +37 -0
  48. data/lib/sweet_staging/version.rb +3 -0
  49. metadata +119 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3e805a2bb08cbe71c7eb6d7580a639fa40b66555b634debdf82f7ba7ba07157c
4
+ data.tar.gz: 31a2ca223f423d05d7472aed5530466089182bf2c0ca7c415ad203ff0fbdac00
5
+ SHA512:
6
+ metadata.gz: 3e802133da676b1be3582b5de2d01d1c7cc0c80eccb9a0c1b67fe60cfa58b7f4ca69308da81f8d9db1d07a8f59a3432bf4e6598208ac92a899816720cc1ea254
7
+ data.tar.gz: 820381210e61274ee0750c31191cbce52c75e853478f2f9ce15c9ce058e6f9bfda87a3b8ad9c5189a67c772711d8a240ac42e901b656ddace5ad5e6353e8ac5d
@@ -0,0 +1,20 @@
1
+ Copyright 2020 Igor Kasyanchuk
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,36 @@
1
+ # SweetStaging
2
+ Short description and motivation.
3
+
4
+ ## Usage
5
+ How to use my plugin.
6
+
7
+ ## Installation
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'sweet_staging'
12
+ ```
13
+
14
+ And then execute:
15
+ ```bash
16
+ $ bundle
17
+ ```
18
+
19
+ Or install it yourself as:
20
+ ```bash
21
+ $ gem install sweet_staging
22
+ ```
23
+
24
+ ## TODO
25
+
26
+ - on scroll put on pause, on scroll to the bottom continue scrolling
27
+ - on selection put on pause
28
+ - icons for pause, play
29
+ - flexbox design
30
+ - implement link to log line feature
31
+
32
+ ## Contributing
33
+ Contribution directions go here.
34
+
35
+ ## License
36
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,18 @@
1
+ require "bundler/setup"
2
+
3
+ APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
4
+ load "rails/tasks/engine.rake"
5
+
6
+ load "rails/tasks/statistics.rake"
7
+
8
+ require "bundler/gem_tasks"
9
+
10
+ require "rake/testtask"
11
+
12
+ Rake::TestTask.new(:test) do |t|
13
+ t.libs << 'test'
14
+ t.pattern = 'test/**/*_test.rb'
15
+ t.verbose = false
16
+ end
17
+
18
+ task default: :test
@@ -0,0 +1 @@
1
+ <?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg enable-background="new 0 0 512 512" id="Layer_1" version="1.1" viewBox="0 0 512 512" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="256" x2="256" y1="512" y2="-9.094947e-013"><stop offset="0" style="stop-color:#8E54E9"/><stop offset="1" style="stop-color:#4776E6"/></linearGradient><circle cx="256" cy="256" fill="url(#SVGID_1_)" r="256"/><g><path d="M175.4,282.1V142.7c0-2.8-2.3-5.1-5.1-5.1s-5.1,2.3-5.1,5.1v139.4c-19.1,2.5-34,18.8-34,38.5 c0,19.8,14.9,36,34,38.5v10.2c0,2.8,2.3,5.1,5.1,5.1s5.1-2.3,5.1-5.1v-10.2c19.1-2.5,34-18.8,34-38.5 C209.4,300.8,194.5,284.6,175.4,282.1z M170.3,349.5C170.3,349.5,170.3,349.5,170.3,349.5C170.3,349.5,170.3,349.5,170.3,349.5 c-15.9,0-28.9-13-28.9-28.9c0-15.9,13-28.9,28.9-28.9s28.9,12.9,28.9,28.9C199.2,336.5,186.2,349.5,170.3,349.5z" fill="#FFFFFF"/><path d="M380.7,282.5c0-19.8-14.9-36-34-38.5V142.7c0-2.8-2.3-5.1-5.1-5.1c-2.8,0-5.1,2.3-5.1,5.1V244 c-19.1,2.5-34,18.7-34,38.5c0,19.8,14.9,36,34,38.5v48.3c0,2.8,2.3,5.1,5.1,5.1c2.8,0,5.1-2.3,5.1-5.1v-48.3 C365.9,318.5,380.7,302.3,380.7,282.5z M341.7,311.4c-15.9,0-28.9-12.9-28.9-28.9c0-15.9,13-28.9,28.9-28.9 c15.9,0,28.9,13,28.9,28.9C370.5,298.4,357.6,311.4,341.7,311.4z" fill="#FFFFFF"/><path d="M261.7,152.9v-10.2c0-2.8-2.3-5.1-5.1-5.1c-2.8,0-5.1,2.3-5.1,5.1v10.2c-19.1,2.5-34,18.8-34,38.5 s14.9,36,34,38.5v139.4c0,2.8,2.3,5.1,5.1,5.1c2.8,0,5.1-2.3,5.1-5.1V230c19.1-2.5,34-18.8,34-38.5S280.9,155.4,261.7,152.9z M256.7,220.3C256.7,220.3,256.6,220.3,256.7,220.3C256.6,220.3,256.6,220.3,256.7,220.3c-15.9,0-28.9-13-28.9-28.9 c0-15.9,13-28.9,28.9-28.9c15.9,0,28.9,13,28.9,28.9C285.5,207.3,272.6,220.3,256.7,220.3z" fill="#FFFFFF"/></g></svg>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg enable-background="new 0 0 512 512" id="Layer_1" version="1.1" viewBox="0 0 512 512" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="256" x2="256" y1="512" y2="-9.094947e-013"><stop offset="0" style="stop-color:#E73827"/><stop offset="1" style="stop-color:#F85032"/></linearGradient><circle cx="256" cy="256" fill="url(#SVGID_1_)" r="256"/><path d="M268.7,256l119.6-119.6c3.2-3.2,3.2-8.3,0-11.4c-3.2-3.2-8.3-3.2-11.4,0L257.2,244.6L135.1,122.5 c-3.2-3.2-8.3-3.2-11.4,0c-3.2,3.2-3.2,8.3,0,11.4L245.8,256L123.7,378.1c-3.2,3.2-3.2,8.3,0,11.4c1.6,1.6,3.7,2.4,5.7,2.4 c2.1,0,4.1-0.8,5.7-2.4l122.1-122.1l119.6,119.6c1.6,1.6,3.7,2.4,5.7,2.4c2.1,0,4.1-0.8,5.7-2.4c3.2-3.2,3.2-8.3,0-11.4L268.7,256z" fill="#FFFFFF"/></svg>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" ?><svg enable-background="new 0 0 64 64" height="64px" version="1.1" viewBox="0 0 64 64" width="64px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g id="Layer_1"><g><circle cx="32" cy="32" fill="#C75C5C" r="32"/></g><g opacity="0.2"><g><path d="M49.982,31.003c-0.094-5.522-4.574-10.442-10.107-10.442c-3.2,0-6.019,1.674-7.875,4.131 c-1.856-2.457-4.676-4.131-7.875-4.131c-5.533,0-10.012,4.921-10.107,10.442H14c0,0.034,0.007,0.065,0.007,0.099 c0,0.025-0.007,0.049-0.007,0.076c0,0.155,0.038,0.272,0.045,0.421c0.495,14.071,17.813,19.84,17.813,19.84 s17.572-5.762,18.092-19.818C49.959,31.464,50,31.34,50,31.178c0-0.027-0.007-0.052-0.007-0.076c0-0.036,0.007-0.065,0.007-0.099 H49.982z" fill="#231F20"/></g></g><g><g><path d="M49.982,29.003c-0.094-5.522-4.574-10.442-10.107-10.442c-3.2,0-6.019,1.674-7.875,4.131 c-1.856-2.457-4.676-4.131-7.875-4.131c-5.533,0-10.012,4.921-10.107,10.442H14c0,0.034,0.007,0.065,0.007,0.099 c0,0.025-0.007,0.049-0.007,0.076c0,0.155,0.038,0.272,0.045,0.421c0.495,14.071,17.813,19.84,17.813,19.84 s17.572-5.762,18.092-19.818C49.959,29.464,50,29.34,50,29.178c0-0.027-0.007-0.052-0.007-0.076c0-0.036,0.007-0.065,0.007-0.099 H49.982z" fill="#FFFFFF"/></g></g></g><g id="Layer_2"/></svg>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg enable-background="new 0 0 512 512" id="Layer_1" version="1.1" viewBox="0 0 512 512" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="256" x2="256" y1="512" y2="-9.094947e-013"><stop offset="0" style="stop-color:#F857A6"/><stop offset="1" style="stop-color:#FF5858"/></linearGradient><circle cx="256" cy="256" fill="url(#SVGID_1_)" r="256"/><path d="M370.4,159.2c-14.1-14.1-32.9-21.8-52.9-21.8s-38.8,7.7-52.9,21.8l-8.2,8.2c-0.2,0.2-0.6,0.2-0.8,0l-8.2-8.2 c-14.1-14.1-32.8-21.8-52.9-21.8c-20,0-38.8,7.7-52.9,21.8c-29.2,29.2-29.2,76.6,0,105.8L248,371.3c2.1,2.1,5,3.3,8,3.3 c3,0,5.9-1.2,8-3.3L370.4,265c14.1-14.1,21.8-32.9,21.8-52.9C392.2,192.1,384.4,173.3,370.4,159.2z M362.8,257.4L256.4,363.7 c-0.2,0.2-0.6,0.2-0.8,0L149.3,257.4c-25-25-25-65.6,0-90.6c12-12,28.1-18.7,45.3-18.7s33.3,6.6,45.3,18.7l8.2,8.2 c2.1,2.1,5,3.3,8,3.3c3,0,5.9-1.2,8-3.3l8.2-8.2c12-12,28.1-18.7,45.3-18.7c17.2,0,33.2,6.6,45.3,18.7c12,12.1,18.7,28.1,18.7,45.3 C381.4,229.2,374.8,245.3,362.8,257.4z" fill="#FFFFFF"/></svg>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg enable-background="new 0 0 512 512" id="Layer_1" version="1.1" viewBox="0 0 512 512" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="256" x2="256" y1="512" y2="-9.094947e-013"><stop offset="0" style="stop-color:#E43A15"/><stop offset="1" style="stop-color:#E65245"/></linearGradient><circle cx="256" cy="256" fill="url(#SVGID_1_)" r="256"/><path d="M381.6,244.2H130.4c-6.5,0-11.8,5.3-11.8,11.8c0,6.5,5.3,11.8,11.8,11.8h251.1c6.5,0,11.8-5.3,11.8-11.8 C393.3,249.5,388,244.2,381.6,244.2z" fill="#FFFFFF"/></svg>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" ?><svg viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg"><title/><g id="Pause"><circle cx="32" cy="32" r="30" style="fill:#93b5e1"/><path d="M62,32A30,30,0,0,1,2,32c0-.49.01-.98.04-1.46a30,30,0,0,0,59.92,0C61.99,31.02,62,31.51,62,32Z" style="opacity:0.15"/><circle cx="32" cy="32" r="24" style="fill:#848ccf"/><path d="M56,32A24,24,0,0,1,8,32c0-.51.02-1.01.05-1.5a23.9967,23.9967,0,0,0,47.9,0C55.98,30.99,56,31.49,56,32Z" style="opacity:0.15"/><rect height="26" rx="1" style="fill:#fff" width="8" x="21" y="19"/><rect height="26" rx="1" style="fill:#fff" width="8" x="35" y="19"/><g style="opacity:0.15"><path d="M29,41v3a1.0029,1.0029,0,0,1-1,1H22a1.0029,1.0029,0,0,1-1-1V41a1.0029,1.0029,0,0,0,1,1h6A1.0029,1.0029,0,0,0,29,41Z"/><path d="M43,41v3a1.0029,1.0029,0,0,1-1,1H36a1.0029,1.0029,0,0,1-1-1V41a1.0029,1.0029,0,0,0,1,1h6A1.0029,1.0029,0,0,0,43,41Z"/></g><path d="M32,2A30,30,0,1,0,62,32,30.034,30.034,0,0,0,32,2Zm0,58A28,28,0,1,1,60,32,28.0314,28.0314,0,0,1,32,60Z" style="fill:#3282b8"/><path d="M32,8A24,24,0,1,0,56,32,24.0275,24.0275,0,0,0,32,8Zm0,46A22,22,0,1,1,54,32,22.0248,22.0248,0,0,1,32,54Z" style="fill:#3282b8"/><path d="M28,19H22a1,1,0,0,0-1,1V44a1,1,0,0,0,1,1h6a1,1,0,0,0,1-1V20A1,1,0,0,0,28,19ZM27,43H23V21h4Z" style="fill:#3282b8"/><path d="M42,19H36a1,1,0,0,0-1,1V44a1,1,0,0,0,1,1h6a1,1,0,0,0,1-1V20A1,1,0,0,0,42,19ZM41,43H37V21h4Z" style="fill:#3282b8"/></g></svg>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg enable-background="new 0 0 512 512" id="Layer_1" version="1.1" viewBox="0 0 512 512" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="256" x2="256" y1="512" y2="-9.094947e-013"><stop offset="0" style="stop-color:#F857A6"/><stop offset="1" style="stop-color:#FF5858"/></linearGradient><circle cx="256" cy="256" fill="url(#SVGID_1_)" r="256"/><g><path d="M213.2,129h-59.1c-9.2,0-16.6,7.5-16.6,16.6v220.7c0,9.2,7.5,16.6,16.6,16.6h59.1c9.2,0,16.6-7.5,16.6-16.6 V145.7C229.9,136.5,222.4,129,213.2,129z M217.4,366.3c0,2.3-1.9,4.2-4.2,4.2h-59.1c-2.3,0-4.2-1.9-4.2-4.2V145.7 c0-2.3,1.9-4.2,4.2-4.2h59.1c2.3,0,4.2,1.9,4.2,4.2V366.3z" fill="#FFFFFF"/><path d="M357.8,129h-59.1c-9.2,0-16.6,7.5-16.6,16.6v220.7c0,9.2,7.5,16.6,16.6,16.6h59.1c9.2,0,16.6-7.5,16.6-16.6 V145.7C374.5,136.5,367,129,357.8,129z M362,366.3c0,2.3-1.9,4.2-4.2,4.2h-59.1c-2.3,0-4.2-1.9-4.2-4.2V145.7 c0-2.3,1.9-4.2,4.2-4.2h59.1c2.3,0,4.2,1.9,4.2,4.2V366.3z" fill="#FFFFFF"/></g></svg>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" ?><svg viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg"><title/><g id="Play"><circle cx="32" cy="32" r="30" style="fill:#93b5e1"/><path d="M62,32A30,30,0,0,1,2,32c0-.49.01-.98.04-1.46a30,30,0,0,0,59.92,0C61.99,31.02,62,31.51,62,32Z" style="opacity:0.15"/><circle cx="32" cy="32" r="24" style="fill:#848ccf"/><path d="M56,32A24,24,0,0,1,8,32c0-.51.02-1.01.05-1.5a23.9967,23.9967,0,0,0,47.9,0C55.98,30.99,56,31.49,56,32Z" style="opacity:0.15"/><path d="M44.8779,30.2681l-.0009,0L26.0615,19.4053a2.0005,2.0005,0,0,0-3,1.7319V42.8628a1.9959,1.9959,0,0,0,3,1.7324L44.8779,33.7319a2.0016,2.0016,0,0,0,0-3.4638Z" style="fill:#fff"/><path d="M45.88,32a1.9909,1.9909,0,0,1-1,1.73L26.06,44.6a1.976,1.976,0,0,1-1,.27,1.9428,1.9428,0,0,1-1-.28,1.9789,1.9789,0,0,1-1-1.73v-3a1.9789,1.9789,0,0,0,1,1.73,1.9428,1.9428,0,0,0,1,.28,1.976,1.976,0,0,0,1-.27L44.88,30.73a1.78,1.78,0,0,0,.31-.23A1.94,1.94,0,0,1,45.88,32Z" style="opacity:0.15"/><path d="M44.8779,30.2681l-.0009,0L26.0615,19.4053a2.0005,2.0005,0,0,0-3,1.7319V42.8628a1.9959,1.9959,0,0,0,3,1.7324L44.8779,33.7319a2.0016,2.0016,0,0,0,0-3.4638ZM25.0615,42.8628V21.1372L43.877,32Z" style="fill:#3282b8"/><path d="M32,2A30,30,0,1,0,62,32,30.034,30.034,0,0,0,32,2Zm0,58A28,28,0,1,1,60,32,28.0314,28.0314,0,0,1,32,60Z" style="fill:#3282b8"/><path d="M32,8A24,24,0,1,0,56,32,24.0275,24.0275,0,0,0,32,8Zm0,46A22,22,0,1,1,54,32,22.0248,22.0248,0,0,1,32,54Z" style="fill:#3282b8"/></g></svg>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg enable-background="new 0 0 512 512" id="Layer_1" version="1.1" viewBox="0 0 512 512" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="256" x2="256" y1="512" y2="-9.094947e-013"><stop offset="0" style="stop-color:#FF512F"/><stop offset="1" style="stop-color:#F09819"/></linearGradient><circle cx="256" cy="256" fill="url(#SVGID_1_)" r="256"/><path d="M347.6,238L188.8,130.4c-3.6-2.5-7.8-3.8-12.1-3.8c-12,0-21.8,9.8-21.8,21.8v215.1c0,12,9.8,21.8,21.8,21.8 h0c4.3,0,8.5-1.3,12.1-3.8L347.6,274c6-4,9.5-10.8,9.5-18C357.1,248.8,353.6,242.1,347.6,238z M340.6,263.7L181.8,371.3 c-1.6,1.1-3.3,1.6-5.2,1.6h0c-4.5,0-9.4-3.6-9.4-9.3V148.4c0-5.8,4.9-9.3,9.4-9.3c1.8,0,3.6,0.5,5.2,1.6l158.8,107.6 c2.6,1.8,4.1,4.6,4.1,7.7S343.2,262,340.6,263.7z" fill="#FFFFFF"/></svg>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" ?><svg enable-background="new 0 0 512 512" id="Layer_1" version="1.1" viewBox="0 0 512 512" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g><g><linearGradient gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="0.0000038" x2="512" y1="256" y2="256"><stop offset="0" style="stop-color:#33B49D"/><stop offset="1" style="stop-color:#00A185"/></linearGradient><circle cx="256" cy="256" fill="url(#SVGID_1_)" r="256"/><linearGradient gradientUnits="userSpaceOnUse" id="SVGID_2_" x1="42.6666679" x2="469.3333435" y1="256.0005188" y2="256.0005188"><stop offset="0" style="stop-color:#00A185"/><stop offset="1" style="stop-color:#33B49D"/></linearGradient><path d="M256,469.3338623c-117.6309357,0-213.3333282-95.7018738-213.3333282-213.3333435 c0-117.6309204,95.7023926-213.333313,213.3333282-213.333313c117.636261,0,213.3333435,95.7024002,213.3333435,213.333313 C469.3333435,373.6319885,373.636261,469.3338623,256,469.3338623z" fill="url(#SVGID_2_)"/></g><polygon id="XMLID_46_" opacity="0.3" points="358.4709167,264 169.5296021,384 169.5296021,144 "/><polygon fill="#FFFFFF" id="XMLID_819_" points="350.4709167,256 161.5296021,376 161.5296021,136 "/></g></svg>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg enable-background="new 0 0 512 512" id="Layer_1" version="1.1" viewBox="0 0 512 512" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="256" x2="256" y1="512" y2="-9.094947e-013"><stop offset="0" style="stop-color:#76B852"/><stop offset="1" style="stop-color:#8DC26F"/></linearGradient><circle cx="256" cy="256" fill="url(#SVGID_1_)" r="256"/><path d="M381.7,244.2H267.8V130.3c0-6.5-5.3-11.8-11.8-11.8c-6.5,0-11.8,5.3-11.8,11.8v113.9H130.3 c-6.5,0-11.8,5.3-11.8,11.8s5.3,11.8,11.8,11.8h113.9v113.9c0,6.5,5.3,11.8,11.8,11.8c6.5,0,11.8-5.3,11.8-11.8V267.8h113.9 c6.5,0,11.8-5.3,11.8-11.8S388.2,244.2,381.7,244.2z" fill="#FFFFFF"/></svg>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" ?><svg viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg"><title/><g id="Record"><circle cx="32" cy="32" r="30" style="fill:#93b5e1"/><path d="M62,32A30,30,0,0,1,2,32c0-.49.01-.98.04-1.46a30,30,0,0,0,59.92,0C61.99,31.02,62,31.51,62,32Z" style="opacity:0.15"/><circle cx="32" cy="32" r="24" style="fill:#848ccf"/><path d="M56,32A24,24,0,0,1,8,32c0-.51.02-1.01.05-1.5a23.9967,23.9967,0,0,0,47.9,0C55.98,30.99,56,31.49,56,32Z" style="opacity:0.15"/><circle cx="32" cy="32" r="13" style="fill:#fff"/><path d="M45,32a13,13,0,0,1-26,0,12.3318,12.3318,0,0,1,.09-1.5,12.9964,12.9964,0,0,0,25.82,0A12.3318,12.3318,0,0,1,45,32Z" style="opacity:0.15"/><path d="M32,2A30,30,0,1,0,62,32,30.034,30.034,0,0,0,32,2Zm0,58A28,28,0,1,1,60,32,28.0314,28.0314,0,0,1,32,60Z" style="fill:#3282b8"/><path d="M32,8A24,24,0,1,0,56,32,24.0275,24.0275,0,0,0,32,8Zm0,46A22,22,0,1,1,54,32,22.0248,22.0248,0,0,1,32,54Z" style="fill:#3282b8"/><path d="M32,19A13,13,0,1,0,45,32,13.0147,13.0147,0,0,0,32,19Zm0,24A11,11,0,1,1,43,32,11.0125,11.0125,0,0,1,32,43Z" style="fill:#3282b8"/></g></svg>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg enable-background="new 0 0 512 512" id="Layer_1" version="1.1" viewBox="0 0 512 512" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="256" x2="256" y1="512" y2="-9.094947e-013"><stop offset="0" style="stop-color:#232526"/><stop offset="1" style="stop-color:#414345"/></linearGradient><circle cx="256" cy="256" fill="url(#SVGID_1_)" r="256"/><g><path d="M256.9,197.5c-33.3,0-60.3,27.1-60.3,60.3c0,33.3,27.1,60.3,60.3,60.3s60.3-27.1,60.3-60.3 C317.2,224.6,290.2,197.5,256.9,197.5z M256.9,307.1c-27.2,0-49.3-22.1-49.3-49.3s22.1-49.3,49.3-49.3c27.2,0,49.3,22.1,49.3,49.3 S284.1,307.1,256.9,307.1z" fill="#FFFFFF"/><path d="M374.4,216.2h-4.1c-4.7,0-6.5-3.6-6.9-4.6c-0.5-1.1-1.7-4.9,1.6-8.2l2.9-2.9c7.2-7.2,7.2-19,0-26.2 l-30.1-30.1c-3.5-3.5-8.2-5.4-13.1-5.4c-5,0-9.6,1.9-13.1,5.4l-2.9,2.9c-1.8,1.8-3.9,2.2-5.2,2.2c-1.9,0-3.9-0.8-5.3-2.1 c-1-1-2.3-2.7-2.3-5.4v-4.1c0-10.2-8.3-18.6-18.6-18.6h-42.5c-10.2,0-18.6,8.3-18.6,18.6v5.2c0,4.7-3.9,7.5-7.6,7.5 c-1.4,0-3.4-0.4-5.2-2.2l-2.9-2.9c-3.5-3.5-8.2-5.4-13.1-5.4c-5,0-9.6,1.9-13.1,5.4l-30.1,30.1c-3.5,3.5-5.4,8.2-5.4,13.1 c0,5,1.9,9.6,5.4,13.1l1.9,1.9c3.3,3.3,2.1,7.1,1.6,8.2c-0.5,1.1-2.3,4.6-6.9,4.6h-3.1c-10.2,0-18.6,8.3-18.6,18.6v42.5 c0,10.2,8.3,18.6,18.6,18.6h4.1c4.7,0,6.5,3.6,6.9,4.6c0.5,1.1,1.7,4.9-1.6,8.2l-2.9,2.9c-3.5,3.5-5.4,8.2-5.4,13.1 c0,5,1.9,9.6,5.4,13.1l30.1,30.1c3.5,3.5,8.2,5.4,13.1,5.4c5,0,9.6-1.9,13.1-5.4l2.9-2.9c1.8-1.8,3.9-2.2,5.2-2.2 c3.7,0,7.6,2.8,7.6,7.5v4.1c0,10.2,8.3,18.6,18.6,18.6h42.5c10.2,0,18.6-8.3,18.6-18.6v-3.1c0-4.7,3.9-7.5,7.6-7.5 c1.4,0,3.4,0.4,5.2,2.2l2.9,2.9c3.5,3.5,8.2,5.4,13.1,5.4c5,0,9.6-1.9,13.1-5.4l30.1-30.1c7.2-7.2,7.2-19,0-26.2l-4-4 c-3.3-3.3-2.1-7.1-1.6-8.2c0.5-1.1,2.3-4.6,6.9-4.6h5.2c10.2,0,18.6-8.3,18.6-18.6v-42.5C393,224.5,384.7,216.2,374.4,216.2z M381.9,277.3c0,4.1-3.4,7.5-7.5,7.5h-5.2c-7.6,0-14.2,4.4-17.1,11.5c-2.9,7.1-1.4,14.8,4,20.2l4,4c2.9,2.9,2.9,7.7,0,10.6 L330,361.1c-1.4,1.4-3.3,2.2-5.3,2.2c-2,0-3.9-0.8-5.3-2.2l-2.9-2.9c-3.5-3.5-8.1-5.5-13-5.5c-10.3,0-18.6,8.3-18.6,18.6v3.1 c0,4.1-3.4,7.5-7.5,7.5h-42.5c-4.1,0-7.5-3.4-7.5-7.5v-4.1c0-10.2-8.4-18.6-18.6-18.6c-4.9,0-9.5,1.9-13,5.5l-2.9,2.9 c-1.4,1.4-3.3,2.2-5.3,2.2c-2,0-3.9-0.8-5.3-2.2L151.9,330c-1.4-1.4-2.2-3.3-2.2-5.3c0-2,0.8-3.9,2.2-5.3l2.9-2.9 c5.4-5.4,6.9-13.2,4-20.2c-2.9-7.1-9.5-11.5-17.1-11.5h-4.1c-4.1,0-7.5-3.4-7.5-7.5v-42.5c0-4.1,3.4-7.5,7.5-7.5h3.1 c7.6,0,14.2-4.4,17.1-11.5c2.9-7.1,1.4-14.8-4-20.2l-1.9-1.9c-1.4-1.4-2.2-3.3-2.2-5.3c0-2,0.8-3.9,2.2-5.3L182,153 c1.4-1.4,3.3-2.2,5.3-2.2c2,0,3.9,0.8,5.3,2.2l2.9,2.9c3.5,3.5,8.1,5.5,13,5.5c10.3,0,18.6-8.3,18.6-18.6v-5.2 c0-4.1,3.4-7.5,7.5-7.5h42.5c4.1,0,7.5,3.4,7.5,7.5v4.1c0,5.2,2.1,10,5.8,13.5c3.5,3.2,8.1,5.1,12.8,5.1c4.9,0,9.5-1.9,13-5.5 l2.9-2.9c1.4-1.4,3.3-2.2,5.3-2.2c2,0,3.9,0.8,5.3,2.2l30.1,30.1c2.9,2.9,2.9,7.7,0,10.6l-2.9,2.9c-5.4,5.4-6.9,13.2-4,20.2 c2.9,7.1,9.5,11.5,17.1,11.5h4.1c4.1,0,7.5,3.4,7.5,7.5V277.3z" fill="#FFFFFF"/></g></svg>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" ?><svg viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg"><title/><g id="Stop"><circle cx="32" cy="32" r="30" style="fill:#93b5e1"/><path d="M62,32A30,30,0,0,1,2,32c0-.49.01-.98.04-1.46a30,30,0,0,0,59.92,0C61.99,31.02,62,31.51,62,32Z" style="opacity:0.15"/><circle cx="32" cy="32" r="24" style="fill:#848ccf"/><path d="M56,32A24,24,0,0,1,8,32c0-.51.02-1.01.05-1.5a23.9967,23.9967,0,0,0,47.9,0C55.98,30.99,56,31.49,56,32Z" style="opacity:0.15"/><rect height="26" rx="1" style="fill:#fff" width="24" x="20" y="19"/><path d="M44,41v3a1.0029,1.0029,0,0,1-1,1H21a1.0029,1.0029,0,0,1-1-1V41a1.0029,1.0029,0,0,0,1,1H43A1.0029,1.0029,0,0,0,44,41Z" style="opacity:0.15"/><path d="M32,2A30,30,0,1,0,62,32,30.034,30.034,0,0,0,32,2Zm0,58A28,28,0,1,1,60,32,28.0314,28.0314,0,0,1,32,60Z" style="fill:#3282b8"/><path d="M32,8A24,24,0,1,0,56,32,24.0275,24.0275,0,0,0,32,8Zm0,46A22,22,0,1,1,54,32,22.0248,22.0248,0,0,1,32,54Z" style="fill:#3282b8"/><path d="M43,19H21a1,1,0,0,0-1,1V44a1,1,0,0,0,1,1H43a1,1,0,0,0,1-1V20A1,1,0,0,0,43,19ZM42,43H22V21H42Z" style="fill:#3282b8"/></g></svg>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg enable-background="new 0 0 512 512" id="Layer_1" version="1.1" viewBox="0 0 512 512" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="256" x2="256" y1="512" y2="-9.094947e-013"><stop offset="0" style="stop-color:#4CB8C4"/><stop offset="1" style="stop-color:#3CD3AD"/></linearGradient><circle cx="256" cy="256" fill="url(#SVGID_1_)" r="256"/><path d="M375,154L194.2,334.8L137,277.7c-4.3-4.3-11.2-4.3-15.4,0c-4.3,4.3-4.3,11.2,0,15.4l64.9,64.9 c2.1,2.1,4.9,3.2,7.7,3.2c2.8,0,5.6-1.1,7.7-3.2l188.5-188.5c4.3-4.3,4.3-11.2,0-15.4C386.1,149.8,379.2,149.8,375,154z" fill="#FFFFFF"/></svg>
@@ -0,0 +1,33 @@
1
+ <!-- By Sam Herbert (@sherb), for everyone. More @ http://goo.gl/7AJzbL -->
2
+ <svg width="120" height="30" viewBox="0 0 120 30" xmlns="http://www.w3.org/2000/svg" fill="#fff">
3
+ <circle cx="15" cy="15" r="15">
4
+ <animate attributeName="r" from="15" to="15"
5
+ begin="0s" dur="0.8s"
6
+ values="15;9;15" calcMode="linear"
7
+ repeatCount="indefinite" />
8
+ <animate attributeName="fill-opacity" from="1" to="1"
9
+ begin="0s" dur="0.8s"
10
+ values="1;.5;1" calcMode="linear"
11
+ repeatCount="indefinite" />
12
+ </circle>
13
+ <circle cx="60" cy="15" r="9" fill-opacity="0.3">
14
+ <animate attributeName="r" from="9" to="9"
15
+ begin="0s" dur="0.8s"
16
+ values="9;15;9" calcMode="linear"
17
+ repeatCount="indefinite" />
18
+ <animate attributeName="fill-opacity" from="0.5" to="0.5"
19
+ begin="0s" dur="0.8s"
20
+ values=".5;1;.5" calcMode="linear"
21
+ repeatCount="indefinite" />
22
+ </circle>
23
+ <circle cx="105" cy="15" r="15">
24
+ <animate attributeName="r" from="15" to="15"
25
+ begin="0s" dur="0.8s"
26
+ values="15;9;15" calcMode="linear"
27
+ repeatCount="indefinite" />
28
+ <animate attributeName="fill-opacity" from="1" to="1"
29
+ begin="0s" dur="0.8s"
30
+ values="1;.5;1" calcMode="linear"
31
+ repeatCount="indefinite" />
32
+ </circle>
33
+ </svg>
@@ -0,0 +1,24 @@
1
+ module SweetStaging
2
+ class BaseController < ActionController::Base
3
+ include SweetStaging::ApplicationHelper
4
+ layout 'sweet_staging/layouts/sweet_staging'
5
+
6
+ # self.logger = SweetStaging::SilentLogger.new(config.logger)
7
+
8
+ before_action :verify_access
9
+
10
+ if SweetStaging.http_basic_authentication_enabled
11
+ http_basic_authenticate_with \
12
+ name: SweetStaging.http_basic_authentication_user_name,
13
+ password: SweetStaging.http_basic_authentication_password
14
+ end
15
+
16
+ private
17
+
18
+ def verify_access
19
+ result = SweetStaging.verify_access_proc.call(self)
20
+ redirect_to('/', error: 'Access Denied', status: 401) unless result
21
+ end
22
+
23
+ end
24
+ end
@@ -0,0 +1,13 @@
1
+ require_relative './base_controller.rb'
2
+
3
+ module SweetStaging
4
+ class HomeController < SweetStaging::BaseController
5
+
6
+ if SweetStaging.enabled
7
+ def index
8
+ redirect_to sweet_staging.watch_url(name: SweetStaging.logs[0][:name])
9
+ end
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,24 @@
1
+ require_relative './base_controller.rb'
2
+
3
+ module SweetStaging
4
+ class LogsController < SweetStaging::BaseController
5
+
6
+ if SweetStaging.enabled
7
+ def watch
8
+ end
9
+
10
+ def changes
11
+ @lines = log_file.readlines
12
+ @total_lines = log_file.total_lines
13
+ end
14
+
15
+ def log_file
16
+ @log_file ||= begin
17
+ item = SweetStaging.logs.detect {|e| e[:name] == params[:name]}
18
+ LogFile.new(path: "#{::Rails.root}/#{item[:path]}", client_total_lines: params[:client_total_lines])
19
+ end
20
+ end
21
+ end
22
+
23
+ end
24
+ end
@@ -0,0 +1,27 @@
1
+ module SweetStaging
2
+ module ApplicationHelper
3
+ def icon(name)
4
+ # https://www.iconfinder.com/iconsets/vivid
5
+ raw File.read(File.expand_path(File.dirname(__FILE__) + "/../../assets/images/#{name}.svg"))
6
+ end
7
+
8
+ def insert_css_file(file)
9
+ raw "<style>#{raw File.read File.expand_path(File.dirname(__FILE__) + "/../../views/sweet_staging/stylesheets/#{file}")}</style>"
10
+ end
11
+
12
+ def insert_js_file(file)
13
+ raw "<script>#{raw File.read File.expand_path(File.dirname(__FILE__) + "/../../views/sweet_staging/javascripts/#{file}")}</script>"
14
+ end
15
+
16
+ def format_datetime(e)
17
+ e.strftime("%Y-%m-%d %H:%M:%S")
18
+ end
19
+
20
+ def active?(section)
21
+ case section
22
+ when :dashboard
23
+ "is-active" if controller_name == "home" && action_name == "index"
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,8 @@
1
+ <%= insert_js_file 'jquery-3.4.1.min.js' %>
2
+ <%= insert_js_file 'rails.js' %>
3
+ <%= insert_js_file 'ansi_up.js' %>
4
+ <%= insert_js_file 'perfect-scrollbar.min.js' %>
5
+ <%= insert_js_file 'keyboard.min.js' %>
6
+
7
+ <%= insert_js_file 'selection.js' %>
8
+ <%= insert_js_file 'app.js' %>
@@ -0,0 +1,421 @@
1
+ /* ansi_up.js
2
+ * author : Dru Nelson
3
+ * license : MIT
4
+ * http://github.com/drudru/ansi_up
5
+ */
6
+ (function (root, factory) {
7
+ if (typeof define === 'function' && define.amd) {
8
+ // AMD. Register as an anonymous module.
9
+ define(['exports'], factory);
10
+ } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
11
+ // CommonJS
12
+ factory(exports);
13
+ } else {
14
+ // Browser globals
15
+ var exp = {};
16
+ factory(exp);
17
+ root.AnsiUp = exp.default;
18
+ }
19
+ }(this, function (exports) {
20
+ "use strict";
21
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
22
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
23
+ return cooked;
24
+ };
25
+ var PacketKind;
26
+ (function (PacketKind) {
27
+ PacketKind[PacketKind["EOS"] = 0] = "EOS";
28
+ PacketKind[PacketKind["Text"] = 1] = "Text";
29
+ PacketKind[PacketKind["Incomplete"] = 2] = "Incomplete";
30
+ PacketKind[PacketKind["ESC"] = 3] = "ESC";
31
+ PacketKind[PacketKind["Unknown"] = 4] = "Unknown";
32
+ PacketKind[PacketKind["SGR"] = 5] = "SGR";
33
+ PacketKind[PacketKind["OSCURL"] = 6] = "OSCURL";
34
+ })(PacketKind || (PacketKind = {}));
35
+ var AnsiUp = (function () {
36
+ function AnsiUp() {
37
+ this.VERSION = "4.0.3";
38
+ this.setup_palettes();
39
+ this._use_classes = false;
40
+ this._escape_for_html = true;
41
+ this.bold = false;
42
+ this.fg = this.bg = null;
43
+ this._buffer = '';
44
+ this._url_whitelist = { 'http': 1, 'https': 1 };
45
+ }
46
+ Object.defineProperty(AnsiUp.prototype, "use_classes", {
47
+ get: function () {
48
+ return this._use_classes;
49
+ },
50
+ set: function (arg) {
51
+ this._use_classes = arg;
52
+ },
53
+ enumerable: true,
54
+ configurable: true
55
+ });
56
+ Object.defineProperty(AnsiUp.prototype, "escape_for_html", {
57
+ get: function () {
58
+ return this._escape_for_html;
59
+ },
60
+ set: function (arg) {
61
+ this._escape_for_html = arg;
62
+ },
63
+ enumerable: true,
64
+ configurable: true
65
+ });
66
+ Object.defineProperty(AnsiUp.prototype, "url_whitelist", {
67
+ get: function () {
68
+ return this._url_whitelist;
69
+ },
70
+ set: function (arg) {
71
+ this._url_whitelist = arg;
72
+ },
73
+ enumerable: true,
74
+ configurable: true
75
+ });
76
+ AnsiUp.prototype.setup_palettes = function () {
77
+ var _this = this;
78
+ this.ansi_colors =
79
+ [
80
+ [
81
+ { rgb: [0, 0, 0], class_name: "ansi-black" },
82
+ { rgb: [187, 0, 0], class_name: "ansi-red" },
83
+ { rgb: [0, 187, 0], class_name: "ansi-green" },
84
+ { rgb: [187, 187, 0], class_name: "ansi-yellow" },
85
+ { rgb: [120, 159, 209], class_name: "ansi-blue" },
86
+ { rgb: [187, 0, 187], class_name: "ansi-magenta" },
87
+ { rgb: [0, 187, 187], class_name: "ansi-cyan" },
88
+ { rgb: [255, 255, 255], class_name: "ansi-white" }
89
+ ],
90
+ [
91
+ { rgb: [85, 85, 85], class_name: "ansi-bright-black" },
92
+ { rgb: [255, 85, 85], class_name: "ansi-bright-red" },
93
+ { rgb: [0, 255, 0], class_name: "ansi-bright-green" },
94
+ { rgb: [255, 255, 85], class_name: "ansi-bright-yellow" },
95
+ { rgb: [85, 85, 255], class_name: "ansi-bright-blue" },
96
+ { rgb: [255, 85, 255], class_name: "ansi-bright-magenta" },
97
+ { rgb: [85, 255, 255], class_name: "ansi-bright-cyan" },
98
+ { rgb: [255, 255, 255], class_name: "ansi-bright-white" }
99
+ ]
100
+ ];
101
+ this.palette_256 = [];
102
+ this.ansi_colors.forEach(function (palette) {
103
+ palette.forEach(function (rec) {
104
+ _this.palette_256.push(rec);
105
+ });
106
+ });
107
+ var levels = [0, 95, 135, 175, 215, 255];
108
+ for (var r = 0; r < 6; ++r) {
109
+ for (var g = 0; g < 6; ++g) {
110
+ for (var b = 0; b < 6; ++b) {
111
+ var col = { rgb: [levels[r], levels[g], levels[b]], class_name: 'truecolor' };
112
+ this.palette_256.push(col);
113
+ }
114
+ }
115
+ }
116
+ var grey_level = 8;
117
+ for (var i = 0; i < 24; ++i, grey_level += 10) {
118
+ var gry = { rgb: [grey_level, grey_level, grey_level], class_name: 'truecolor' };
119
+ this.palette_256.push(gry);
120
+ }
121
+ };
122
+ AnsiUp.prototype.escape_txt_for_html = function (txt) {
123
+ return txt.replace(/[&<>]/gm, function (str) {
124
+ if (str === "&")
125
+ return "&amp;";
126
+ if (str === "<")
127
+ return "&lt;";
128
+ if (str === ">")
129
+ return "&gt;";
130
+ });
131
+ };
132
+ AnsiUp.prototype.append_buffer = function (txt) {
133
+ var str = this._buffer + txt;
134
+ this._buffer = str;
135
+ };
136
+ AnsiUp.prototype.get_next_packet = function () {
137
+ var pkt = {
138
+ kind: PacketKind.EOS,
139
+ text: '',
140
+ url: ''
141
+ };
142
+ var len = this._buffer.length;
143
+ if (len == 0)
144
+ return pkt;
145
+ var pos = this._buffer.indexOf("\x1B");
146
+ if (pos == -1) {
147
+ pkt.kind = PacketKind.Text;
148
+ pkt.text = this._buffer;
149
+ this._buffer = '';
150
+ return pkt;
151
+ }
152
+ if (pos > 0) {
153
+ pkt.kind = PacketKind.Text;
154
+ pkt.text = this._buffer.slice(0, pos);
155
+ this._buffer = this._buffer.slice(pos);
156
+ return pkt;
157
+ }
158
+ if (pos == 0) {
159
+ if (len == 1) {
160
+ pkt.kind = PacketKind.Incomplete;
161
+ return pkt;
162
+ }
163
+ var next_char = this._buffer.charAt(1);
164
+ if ((next_char != '[') && (next_char != ']')) {
165
+ pkt.kind = PacketKind.ESC;
166
+ pkt.text = this._buffer.slice(0, 1);
167
+ this._buffer = this._buffer.slice(1);
168
+ return pkt;
169
+ }
170
+ if (next_char == '[') {
171
+ if (!this._csi_regex) {
172
+ this._csi_regex = rgx(__makeTemplateObject(["\n ^ # beginning of line\n #\n # First attempt\n (?: # legal sequence\n \u001B[ # CSI\n ([<-?]?) # private-mode char\n ([d;]*) # any digits or semicolons\n ([ -/]? # an intermediate modifier\n [@-~]) # the command\n )\n | # alternate (second attempt)\n (?: # illegal sequence\n \u001B[ # CSI\n [ -~]* # anything legal\n ([\0-\u001F:]) # anything illegal\n )\n "], ["\n ^ # beginning of line\n #\n # First attempt\n (?: # legal sequence\n \\x1b\\[ # CSI\n ([\\x3c-\\x3f]?) # private-mode char\n ([\\d;]*) # any digits or semicolons\n ([\\x20-\\x2f]? # an intermediate modifier\n [\\x40-\\x7e]) # the command\n )\n | # alternate (second attempt)\n (?: # illegal sequence\n \\x1b\\[ # CSI\n [\\x20-\\x7e]* # anything legal\n ([\\x00-\\x1f:]) # anything illegal\n )\n "]));
173
+ }
174
+ var match = this._buffer.match(this._csi_regex);
175
+ if (match === null) {
176
+ pkt.kind = PacketKind.Incomplete;
177
+ return pkt;
178
+ }
179
+ if (match[4]) {
180
+ pkt.kind = PacketKind.ESC;
181
+ pkt.text = this._buffer.slice(0, 1);
182
+ this._buffer = this._buffer.slice(1);
183
+ return pkt;
184
+ }
185
+ if ((match[1] != '') || (match[3] != 'm'))
186
+ pkt.kind = PacketKind.Unknown;
187
+ else
188
+ pkt.kind = PacketKind.SGR;
189
+ pkt.text = match[2];
190
+ var rpos = match[0].length;
191
+ this._buffer = this._buffer.slice(rpos);
192
+ return pkt;
193
+ }
194
+ if (next_char == ']') {
195
+ if (len < 4) {
196
+ pkt.kind = PacketKind.Incomplete;
197
+ return pkt;
198
+ }
199
+ if ((this._buffer.charAt(2) != '8')
200
+ || (this._buffer.charAt(3) != ';')) {
201
+ pkt.kind = PacketKind.ESC;
202
+ pkt.text = this._buffer.slice(0, 1);
203
+ this._buffer = this._buffer.slice(1);
204
+ return pkt;
205
+ }
206
+ if (!this._osc_st) {
207
+ this._osc_st = rgxG(__makeTemplateObject(["\n (?: # legal sequence\n (\u001B\\) # ESC | # alternate\n (\u0007) # BEL (what xterm did)\n )\n | # alternate (second attempt)\n ( # illegal sequence\n [\0-\u0006] # anything illegal\n | # alternate\n [\b-\u001A] # anything illegal\n | # alternate\n [\u001C-\u001F] # anything illegal\n )\n "], ["\n (?: # legal sequence\n (\\x1b\\\\) # ESC \\\n | # alternate\n (\\x07) # BEL (what xterm did)\n )\n | # alternate (second attempt)\n ( # illegal sequence\n [\\x00-\\x06] # anything illegal\n | # alternate\n [\\x08-\\x1a] # anything illegal\n | # alternate\n [\\x1c-\\x1f] # anything illegal\n )\n "]));
208
+ }
209
+ this._osc_st.lastIndex = 0;
210
+ {
211
+ var match_1 = this._osc_st.exec(this._buffer);
212
+ if (match_1 === null) {
213
+ pkt.kind = PacketKind.Incomplete;
214
+ return pkt;
215
+ }
216
+ if (match_1[3]) {
217
+ pkt.kind = PacketKind.ESC;
218
+ pkt.text = this._buffer.slice(0, 1);
219
+ this._buffer = this._buffer.slice(1);
220
+ return pkt;
221
+ }
222
+ }
223
+ {
224
+ var match_2 = this._osc_st.exec(this._buffer);
225
+ if (match_2 === null) {
226
+ pkt.kind = PacketKind.Incomplete;
227
+ return pkt;
228
+ }
229
+ if (match_2[3]) {
230
+ pkt.kind = PacketKind.ESC;
231
+ pkt.text = this._buffer.slice(0, 1);
232
+ this._buffer = this._buffer.slice(1);
233
+ return pkt;
234
+ }
235
+ }
236
+ if (!this._osc_regex) {
237
+ this._osc_regex = rgx(__makeTemplateObject(["\n ^ # beginning of line\n #\n \u001B]8; # OSC Hyperlink\n [ -:<-~]* # params (excluding ;)\n ; # end of params\n ([!-~]{0,512}) # URL capture\n (?: # ST\n (?:\u001B\\) # ESC | # alternate\n (?:\u0007) # BEL (what xterm did)\n )\n ([!-~]+) # TEXT capture\n \u001B]8;; # OSC Hyperlink End\n (?: # ST\n (?:\u001B\\) # ESC | # alternate\n (?:\u0007) # BEL (what xterm did)\n )\n "], ["\n ^ # beginning of line\n #\n \\x1b\\]8; # OSC Hyperlink\n [\\x20-\\x3a\\x3c-\\x7e]* # params (excluding ;)\n ; # end of params\n ([\\x21-\\x7e]{0,512}) # URL capture\n (?: # ST\n (?:\\x1b\\\\) # ESC \\\n | # alternate\n (?:\\x07) # BEL (what xterm did)\n )\n ([\\x21-\\x7e]+) # TEXT capture\n \\x1b\\]8;; # OSC Hyperlink End\n (?: # ST\n (?:\\x1b\\\\) # ESC \\\n | # alternate\n (?:\\x07) # BEL (what xterm did)\n )\n "]));
238
+ }
239
+ var match = this._buffer.match(this._osc_regex);
240
+ if (match === null) {
241
+ pkt.kind = PacketKind.ESC;
242
+ pkt.text = this._buffer.slice(0, 1);
243
+ this._buffer = this._buffer.slice(1);
244
+ return pkt;
245
+ }
246
+ pkt.kind = PacketKind.OSCURL;
247
+ pkt.url = match[1];
248
+ pkt.text = match[2];
249
+ var rpos = match[0].length;
250
+ this._buffer = this._buffer.slice(rpos);
251
+ return pkt;
252
+ }
253
+ }
254
+ };
255
+ AnsiUp.prototype.ansi_to_html = function (txt) {
256
+ this.append_buffer(txt);
257
+ var blocks = [];
258
+ while (true) {
259
+ var packet = this.get_next_packet();
260
+ if ((packet.kind == PacketKind.EOS)
261
+ || (packet.kind == PacketKind.Incomplete))
262
+ break;
263
+ if ((packet.kind == PacketKind.ESC)
264
+ || (packet.kind == PacketKind.Unknown))
265
+ continue;
266
+ if (packet.kind == PacketKind.Text)
267
+ blocks.push(this.transform_to_html(this.with_state(packet)));
268
+ else if (packet.kind == PacketKind.SGR)
269
+ this.process_ansi(packet);
270
+ else if (packet.kind == PacketKind.OSCURL)
271
+ blocks.push(this.process_hyperlink(packet));
272
+ }
273
+ return blocks.join("");
274
+ };
275
+ AnsiUp.prototype.with_state = function (pkt) {
276
+ return { bold: this.bold, fg: this.fg, bg: this.bg, text: pkt.text };
277
+ };
278
+ AnsiUp.prototype.process_ansi = function (pkt) {
279
+ var sgr_cmds = pkt.text.split(';');
280
+ while (sgr_cmds.length > 0) {
281
+ var sgr_cmd_str = sgr_cmds.shift();
282
+ var num = parseInt(sgr_cmd_str, 10);
283
+ if (isNaN(num) || num === 0) {
284
+ this.fg = this.bg = null;
285
+ this.bold = false;
286
+ }
287
+ else if (num === 1) {
288
+ this.bold = true;
289
+ }
290
+ else if (num === 22) {
291
+ this.bold = false;
292
+ }
293
+ else if (num === 39) {
294
+ this.fg = null;
295
+ }
296
+ else if (num === 49) {
297
+ this.bg = null;
298
+ }
299
+ else if ((num >= 30) && (num < 38)) {
300
+ this.fg = this.ansi_colors[0][(num - 30)];
301
+ }
302
+ else if ((num >= 40) && (num < 48)) {
303
+ this.bg = this.ansi_colors[0][(num - 40)];
304
+ }
305
+ else if ((num >= 90) && (num < 98)) {
306
+ this.fg = this.ansi_colors[1][(num - 90)];
307
+ }
308
+ else if ((num >= 100) && (num < 108)) {
309
+ this.bg = this.ansi_colors[1][(num - 100)];
310
+ }
311
+ else if (num === 38 || num === 48) {
312
+ if (sgr_cmds.length > 0) {
313
+ var is_foreground = (num === 38);
314
+ var mode_cmd = sgr_cmds.shift();
315
+ if (mode_cmd === '5' && sgr_cmds.length > 0) {
316
+ var palette_index = parseInt(sgr_cmds.shift(), 10);
317
+ if (palette_index >= 0 && palette_index <= 255) {
318
+ if (is_foreground)
319
+ this.fg = this.palette_256[palette_index];
320
+ else
321
+ this.bg = this.palette_256[palette_index];
322
+ }
323
+ }
324
+ if (mode_cmd === '2' && sgr_cmds.length > 2) {
325
+ var r = parseInt(sgr_cmds.shift(), 10);
326
+ var g = parseInt(sgr_cmds.shift(), 10);
327
+ var b = parseInt(sgr_cmds.shift(), 10);
328
+ if ((r >= 0 && r <= 255) && (g >= 0 && g <= 255) && (b >= 0 && b <= 255)) {
329
+ var c = { rgb: [r, g, b], class_name: 'truecolor' };
330
+ if (is_foreground)
331
+ this.fg = c;
332
+ else
333
+ this.bg = c;
334
+ }
335
+ }
336
+ }
337
+ }
338
+ }
339
+ };
340
+ AnsiUp.prototype.transform_to_html = function (fragment) {
341
+ var txt = fragment.text;
342
+ if (txt.length === 0)
343
+ return txt;
344
+ if (this._escape_for_html)
345
+ txt = this.escape_txt_for_html(txt);
346
+ if (!fragment.bold && fragment.fg === null && fragment.bg === null)
347
+ return txt;
348
+ var styles = [];
349
+ var classes = [];
350
+ var fg = fragment.fg;
351
+ var bg = fragment.bg;
352
+ if (fragment.bold)
353
+ styles.push('font-weight:bold');
354
+ if (!this._use_classes) {
355
+ if (fg)
356
+ styles.push("color:rgb(" + fg.rgb.join(',') + ")");
357
+ if (bg)
358
+ styles.push("background-color:rgb(" + bg.rgb + ")");
359
+ }
360
+ else {
361
+ if (fg) {
362
+ if (fg.class_name !== 'truecolor') {
363
+ classes.push(fg.class_name + "-fg");
364
+ }
365
+ else {
366
+ styles.push("color:rgb(" + fg.rgb.join(',') + ")");
367
+ }
368
+ }
369
+ if (bg) {
370
+ if (bg.class_name !== 'truecolor') {
371
+ classes.push(bg.class_name + "-bg");
372
+ }
373
+ else {
374
+ styles.push("background-color:rgb(" + bg.rgb.join(',') + ")");
375
+ }
376
+ }
377
+ }
378
+ var class_string = '';
379
+ var style_string = '';
380
+ if (classes.length)
381
+ class_string = " class=\"" + classes.join(' ') + "\"";
382
+ if (styles.length)
383
+ style_string = " style=\"" + styles.join(';') + "\"";
384
+ return "<span" + style_string + class_string + ">" + txt + "</span>";
385
+ };
386
+ ;
387
+ AnsiUp.prototype.process_hyperlink = function (pkt) {
388
+ var parts = pkt.url.split(':');
389
+ if (parts.length < 1)
390
+ return '';
391
+ if (!this._url_whitelist[parts[0]])
392
+ return '';
393
+ var result = "<a href=\"" + this.escape_txt_for_html(pkt.url) + "\">" + this.escape_txt_for_html(pkt.text) + "</a>";
394
+ return result;
395
+ };
396
+ return AnsiUp;
397
+ }());
398
+ function rgx(tmplObj) {
399
+ var subst = [];
400
+ for (var _i = 1; _i < arguments.length; _i++) {
401
+ subst[_i - 1] = arguments[_i];
402
+ }
403
+ var regexText = tmplObj.raw[0];
404
+ var wsrgx = /^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm;
405
+ var txt2 = regexText.replace(wsrgx, '');
406
+ return new RegExp(txt2);
407
+ }
408
+ function rgxG(tmplObj) {
409
+ var subst = [];
410
+ for (var _i = 1; _i < arguments.length; _i++) {
411
+ subst[_i - 1] = arguments[_i];
412
+ }
413
+ var regexText = tmplObj.raw[0];
414
+ var wsrgx = /^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm;
415
+ var txt2 = regexText.replace(wsrgx, '');
416
+ return new RegExp(txt2, 'g');
417
+ }
418
+ //# sourceMappingURL=ansi_up.js.map
419
+ Object.defineProperty(exports, "__esModule", { value: true });
420
+ exports.default = AnsiUp;
421
+ }));