shellplay 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f513e6af4490347701bf5da7052b66aae4f4e11f
4
- data.tar.gz: a6098df0e19a95eef0c4d80801080d528e82bf76
3
+ metadata.gz: 2f55dfc5a678eb16a4cb71c13f7d4f28ce7c78aa
4
+ data.tar.gz: b665727c3a94d92745fbadfb97c2b3f2a814fe6c
5
5
  SHA512:
6
- metadata.gz: 5b364e4ae563557457549704017ef8b6587b6047ae265ff771315866b096dc483acfa3d163ea5ef5d13d2143af82dcc2487b4ec1bddab713a7de4cc2362c8050
7
- data.tar.gz: aee282cb9665fa8be56835993cef4e04dd31497eb6c1d540062a441b838ae6bab24cb1afd9e5e9a22e0426fa18916a8690472d042f0cda5bf997bae13c93cbbd
6
+ metadata.gz: 1c2b09cd94a775e1a209d6619016e4011f5d2f7a6304e2d912fb5149a7e805be64a620099cc518e7d6a70fd303861f0b1f4053011fb1b155798df0d07c008baa
7
+ data.tar.gz: a6509a8bd4e0e7552704a132e377f6c290ef3d09790b3ea40ebe83010158c0571e386f886d3441fae6d6e97d1e0683847903353beef1625b662ba063041895be
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  Shellplay Changelog
2
2
  =========================
3
3
 
4
+ v0.1.3 - 2014-08-19
5
+ -------------------
6
+ - html export rudimentary but functional
7
+
4
8
  v0.1.2 - 2014-08-18
5
9
  -------------------
6
10
  - fix recording that was broken in 0.1.1
data/Gemfile CHANGED
@@ -2,3 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in shellprez.gemspec
4
4
  gemspec
5
+
data/README.md CHANGED
@@ -94,6 +94,15 @@ If you don't specify the name of the session, all locally available sessions wil
94
94
 
95
95
  Then type enter to go next, or `?` to display list of available commands.
96
96
 
97
+ ## Export to HTML
98
+
99
+ To export
100
+
101
+ shellexport <session_file_name>
102
+ shellplay <remote session url>
103
+
104
+ It will save the html in a dir in `.shellplay` under the name of the session. The dir contains index.html, css, and js files, ready to be played from your laptop or uploaded to your server.
105
+
97
106
  ## Todo
98
107
 
99
108
  - <s>handle the no-display entries</s>
data/bin/shellexport CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'paint'
4
4
  require 'erb'
5
+ require "shell2html"
5
6
 
6
7
  lib = File.expand_path('../../lib', __FILE__)
7
8
  tpl = File.expand_path('../../tpl', __FILE__)
@@ -22,3 +23,9 @@ File.open(File.join(dest, "index.html"), 'w') do |f|
22
23
  f.puts erb.result(binding)
23
24
  end
24
25
 
26
+ FileUtils.cp(File.join(tpl, 'jquery-1.11.1.min.js'), dest)
27
+ FileUtils.cp(File.join(tpl, 'shellplay.js'), dest)
28
+ FileUtils.cp(File.join(tpl, 'shellplay.css'), dest)
29
+ File.open(File.join(dest, "colors.css"), 'w') do |f|
30
+ f.puts Shell2html.css
31
+ end
@@ -1,10 +1,6 @@
1
- require "shell2html"
2
-
3
1
  module Shellplay
4
2
  class Screen
5
3
 
6
- include Shell2html
7
-
8
4
  attr_reader :stdin, :stdout, :stderr, :display, :timespent, :displaycommand, :playprompt, :clearscreen, :customprompt
9
5
 
10
6
  def initialize
@@ -42,9 +38,5 @@ module Shellplay
42
38
  }
43
39
  end
44
40
 
45
- def html
46
- to_html(@stdout)
47
- end
48
-
49
41
  end
50
42
  end
@@ -32,22 +32,21 @@ module Shellplay
32
32
  @output.puts "There is no recorded session locally."
33
33
  @output.puts "Do you want to play a remote recording?"
34
34
  name = ask "url: "
35
- session_name = File.basename(name, '.json')
36
35
  else
37
36
  @output.puts "What session do you want to load?"
38
37
  name = ask "(input a number or an url if you want to play a remote recording)",
39
38
  aslist: true,
40
39
  choices: sessions.map { |f| File.basename(f, '.json') }
41
- session_name = name
42
40
  end
43
41
  end
44
42
  if /^https?:\/\//.match name
45
43
  infile = open(name) { |f| f.read }
44
+ @name = File.basename(name, '.json')
46
45
  else
47
46
  infile = IO.read(File.join(@basedir, "#{name}.json"))
47
+ @name = name
48
48
  end
49
49
  data = JSON.parse(infile)
50
- @name = session_name
51
50
  @title = data['title']
52
51
  @config = Shellplay::Config.new({
53
52
  basedir: @basedir,
data/tpl/index.html CHANGED
@@ -4,7 +4,8 @@
4
4
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
5
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=">
6
6
  <title><%= @session.title %></title>
7
- <link href="style.css" rel="stylesheet">
7
+ <link href="shellplay.css" rel="stylesheet">
8
+ <link href="colors.css" rel="stylesheet">
8
9
  <script src="jquery-1.11.1.min.js"></script>
9
10
  </head>
10
11
  <body>
@@ -13,13 +14,24 @@
13
14
  <div class="row">
14
15
  <div class="col-md-12 main">
15
16
  <% @session.sequence.each_with_index do |screen, i| %>
16
- <div class="screen">
17
- <%= screen.html %>
17
+ <div class="screen" id="s<%= i %>">
18
+ <% if screen.customprompt %>
19
+ <%= Shell2html.to_html(screen.customprompt) %>
20
+ <% else %>
21
+ <%= Shell2html.to_html(@session.config.prompt) %>
22
+ <% end %>
23
+ <%= Shell2html.to_html(screen.stdin) %>
24
+ <br>
25
+ <%= Shell2html.to_html(screen.stdout) %>
26
+ <% if screen.stderr %>
27
+ <%= Shell2html.to_html(screen.stderr) %>
28
+ <% end %>
18
29
  </div>
19
30
  <% end %>
20
31
  </div>
21
32
  </div>
22
33
  </div>
23
34
 
35
+ <script src="shellplay.js"></script>
24
36
  </body>
25
37
  </html>
data/tpl/shellplay.css ADDED
@@ -0,0 +1,28 @@
1
+ * {
2
+
3
+ }
4
+ body {
5
+ margin: 0;
6
+ padding: 0;
7
+ background-color: #000000;
8
+ }
9
+ .container {
10
+
11
+ }
12
+ .main {
13
+ position: absolute;
14
+ top: 40px;
15
+ bottom: 40px;
16
+ left: 40px;
17
+ right: 40px;
18
+ background-color: #000000;
19
+ color: #ffffff;
20
+ font-family: monospace;
21
+ border: 1px solid #848484;
22
+ border-radius: 5px;
23
+ box-shadow: 0 0 35px 20px #424648;
24
+ overflow: hidden;
25
+ }
26
+ .screen {
27
+ margin: 30px;
28
+ }
data/tpl/shellplay.js ADDED
@@ -0,0 +1,44 @@
1
+ (function(){
2
+
3
+ var current = 0;
4
+ var last = $(".screen").size() - 1;
5
+
6
+ function draw() {
7
+ $(".screen").hide();
8
+ $("#s"+current).show();
9
+ }
10
+
11
+ function next() {
12
+ if (current < last) {
13
+ current++;
14
+ }
15
+ draw();
16
+ }
17
+
18
+ function previous() {
19
+ console.log(current);
20
+ if (current > 0) {
21
+ current--;
22
+ }
23
+ draw();
24
+ }
25
+
26
+ draw();
27
+
28
+ $(document).keydown(function(e) {
29
+ switch(e.keyCode) {
30
+ case 39: // ->
31
+ case 78: // n
32
+ case 13: // enter
33
+ next();
34
+ break;
35
+ case 37: // <-
36
+ case 80: // p
37
+ previous();
38
+ break;
39
+ default:
40
+ console.log(e.keyCode);
41
+ }
42
+ });
43
+
44
+ }());
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shellplay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - mose
@@ -158,7 +158,8 @@ files:
158
158
  - spec/spec_helper.rb
159
159
  - tpl/index.html
160
160
  - tpl/jquery-1.11.1.min.js
161
- - tpl/nav.js
161
+ - tpl/shellplay.css
162
+ - tpl/shellplay.js
162
163
  homepage: https://github.com/mose/shellplay
163
164
  licenses:
164
165
  - MIT
data/tpl/nav.js DELETED
@@ -1,3 +0,0 @@
1
- (function(){
2
-
3
- }());