shellplay 0.1.6 → 0.1.7

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: a990510c54011a42c073d7b5c2455480e2d124d1
4
- data.tar.gz: 663418918a9eed30b279545a2fccc317c28b3194
3
+ metadata.gz: 1a755f6552006186547d635756ba577cb2fadec3
4
+ data.tar.gz: bc83ab0769908a487e6750361c980116f65ce2dc
5
5
  SHA512:
6
- metadata.gz: 7e79caf702fdb83c988bb0e24bb54b4cebbadad9e20bbd88caac00569df28a1285aa4733b7c84e1ea8feb6af530c0abde75df773c1523ac6347b0eb364d73dd1
7
- data.tar.gz: cc2f77de04fe717ba488e7fcb01f96d7d84a53b208453b792a2e646644b66b382c1955f8d9a68ba11c46ab10abdd9d006f68de1ef2e3fb822beba7c004fdc72d
6
+ metadata.gz: e8dd6658f4a887d91164a6664368dd73df83d12a6734faebf51e7e158c629ffa208ac8f8bb935c1d7daefb103a3813a5e7d585f43c6abd3673f591efc0415d98
7
+ data.tar.gz: bedada485c7bf906584fe67c201c43c7b67aeb58d5ec7c01a68ad95b7552effe79203b10a1732a95f54a85f98efb67ba0bb3691e4662eeb4f1918cf85258bc31
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.1.2
1
+ 2.2.3
data/.travis.yml CHANGED
@@ -3,4 +3,4 @@ bundler_args: --path vendor
3
3
  cache: bundler
4
4
  rvm:
5
5
  - 1.9.3
6
- - 2.1.1
6
+ - 2.2.3
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  Shellplay Changelog
2
2
  =========================
3
3
 
4
+ v0.1.7 - 2015-11-23
5
+ -------------------
6
+ - create config dir if it does not exist (first time launch)
7
+ - add more code documentation
8
+ - update dependencies
9
+
4
10
  v0.1.6 - 2014-08-19
5
11
  -------------------
6
12
  - fix display of session prompt
data/README.md CHANGED
@@ -7,7 +7,7 @@ Shellplay
7
7
  [![Coverage Status](https://img.shields.io/coveralls/mose/shellplay.svg)](https://coveralls.io/r/mose/shellplay?branch=master)
8
8
  [![Dependency Status](https://img.shields.io/gemnasium/mose/shellplay.svg)](https://gemnasium.com/mose/shellplay)
9
9
  [![Code Climate](https://img.shields.io/codeclimate/github/mose/shellplay.svg)](https://codeclimate.com/github/mose/shellplay)
10
-
10
+ [![Inch CI](https://inch-ci.org/github/mose/shellplay.svg)](https://inch-ci.org/github/mose/shellplay)
11
11
  ----
12
12
 
13
13
  This is a CLI tool for recording and presenting step by step operations from the console. It is targeted at presentations that would simulate live coding, without the random murphy factor of it.
@@ -22,6 +22,16 @@ It can record a session and playback from it, so if internet fails in your confe
22
22
 
23
23
  The first time you run it, some configuration variables will be asked, and stored in `$HOME/.shellplay/config.yml`. All the recorded sessions will be stored in that same directory.
24
24
 
25
+ ### Development install
26
+
27
+ git clone git@github.com:mose/shellplay.git
28
+ cd shellplay
29
+ bundle install --path vendor
30
+
31
+ To launch shellrecord or shellplay from local repo:
32
+
33
+ bundle exec ./bin/shellrecord
34
+
25
35
  ## Recording a session
26
36
 
27
37
  For recording a session
data/bin/shellplay CHANGED
@@ -30,6 +30,8 @@ def usage
30
30
  puts
31
31
  end
32
32
 
33
+ # generic display method
34
+ #
33
35
  def display(screen)
34
36
  if screen.clearscreen
35
37
  if ENV['TERM_PROGRAM'] = 'iTerm.app'
@@ -59,6 +61,7 @@ def display(screen)
59
61
  end
60
62
  end
61
63
 
64
+ # move to the next screen
62
65
  def shownext
63
66
  if @session.current_screen and @session.current_screen.stdin
64
67
  display @session.current_screen
@@ -70,6 +73,7 @@ def shownext
70
73
  end
71
74
  end
72
75
 
76
+ # move to the previous screen
73
77
  def showprevious
74
78
  if @session.pointer > 0
75
79
  @session.previous
@@ -81,6 +85,7 @@ def showprevious
81
85
  end
82
86
  end
83
87
 
88
+ # jump to an arbitrary screen
84
89
  def show(index)
85
90
  if @session.show(index) && @session.show(index).stdin
86
91
  display @session.show(index)
@@ -93,6 +98,7 @@ end
93
98
 
94
99
  print "\n\e[33m>\e[0m Type <enter> to begin."
95
100
 
101
+ # main loop
96
102
  while continue do
97
103
  command = STDIN.gets.strip
98
104
  case command
@@ -2,6 +2,8 @@ require 'cliprompt'
2
2
  require 'configstruct'
3
3
  require 'fileutils'
4
4
 
5
+ # config struct class
6
+ # refer to https://github.com/mose/configstruct for documentation
5
7
  module Shellplay
6
8
  class Config < ConfigStruct
7
9
 
@@ -11,12 +13,16 @@ module Shellplay
11
13
  super(options, input = STDIN, output = STDOUT, true)
12
14
  end
13
15
 
16
+ # override default config values
14
17
  def set_defaults
15
18
  default :basedir, File.join(ENV['HOME'], '.shellplay')
16
19
  default :basefile, File.join(self.basedir, 'config.yml')
17
20
  super
18
21
  end
19
22
 
23
+ # interactive configuration creation process
24
+ # uses cliprompt for console interaction
25
+ # refer to https://github.com/mose/cliprompt for documentation
20
26
  def setup
21
27
  unless self.prompt && self.timeformat
22
28
  values = {}
@@ -1,3 +1,4 @@
1
+ # class for the screen object
1
2
  module Shellplay
2
3
  class Screen
3
4
 
@@ -14,6 +15,7 @@ module Shellplay
14
15
  @timespent = 0
15
16
  end
16
17
 
18
+ # transforms a hash into a screen object
17
19
  def import(hash)
18
20
  @displaycommand = !!hash['displaycommand']
19
21
  @playprompt = !!hash['playprompt']
@@ -25,6 +27,7 @@ module Shellplay
25
27
  @timespent = hash['timespent']
26
28
  end
27
29
 
30
+ # transfroms a screen object into a hash
28
31
  def export
29
32
  {
30
33
  displaycommand: @displaycommand,
@@ -5,6 +5,7 @@ require "open-uri"
5
5
  require "shellplay/config"
6
6
  require "shellplay/screen"
7
7
 
8
+ # session class, controlling the interaction during the presentation
8
9
  module Shellplay
9
10
  class Session
10
11
 
@@ -20,11 +21,13 @@ module Shellplay
20
21
  @timeformat = false
21
22
  @pointer = 0
22
23
  @basedir = basedir || File.join(ENV['HOME'], '.shellplay')
24
+ FileUtils.mkdir_p(@basedir) unless Dir.exist? @basedir
23
25
  @basefile = basefile || 'config.yml'
24
26
  @input = input
25
27
  @output = output
26
28
  end
27
29
 
30
+ # import a json file from local drive or http location
28
31
  def import(name)
29
32
  unless name
30
33
  sessions = Dir.glob(File.join(@basedir, '*.json'))
@@ -58,38 +61,46 @@ module Shellplay
58
61
  end
59
62
  end
60
63
 
64
+ # appends a screen to the main sequence
61
65
  def add_screen(screenhash)
62
66
  s = Shellplay::Screen.new
63
67
  s.import(screenhash)
64
68
  @sequence << s
65
69
  end
66
70
 
71
+ # appends an array of screens to the sequence
67
72
  def add_screens(screenarray)
68
73
  @sequence += screenarray
69
74
  end
70
75
 
76
+ # used for cancelling a screen while recording
71
77
  def drop_last_screen
72
78
  @sequence.pop
73
79
  previous
74
80
  end
75
81
 
82
+ # jump to next screen
76
83
  def next
77
84
  @pointer += 1
78
85
  end
79
86
 
87
+ # jump to previous screen
80
88
  def previous
81
89
  @pointer -= 1
82
90
  end
83
91
 
92
+ # jump to an arbitrary screen
84
93
  def show(index)
85
94
  @pointer = index.to_i
86
95
  current_screen
87
96
  end
88
97
 
98
+ # returns the screen object at the current point in the sequence
89
99
  def current_screen
90
100
  @sequence[@pointer]
91
101
  end
92
102
 
103
+ # saves the json file for the sequence
93
104
  def save
94
105
  prepare
95
106
  h = {}
@@ -101,6 +112,7 @@ module Shellplay
101
112
  end
102
113
  end
103
114
 
115
+ # initialize the sequence meta-data
104
116
  def prepare
105
117
  set_title
106
118
  set_name
@@ -108,10 +120,13 @@ module Shellplay
108
120
 
109
121
  private
110
122
 
123
+ # uses cliprompt to ask for a title if not set already
111
124
  def set_title
112
125
  @title ||= ask("What is the title of this session?", "No Title")
113
126
  end
114
127
 
128
+ # uses cliprompt to ask for a name if not set already
129
+ # name is the name of the file on the disk
115
130
  def set_name
116
131
  @name ||= ask("What is the name of the session file?", "untitled")
117
132
  end
data/lib/shellplay.rb CHANGED
@@ -1,4 +1 @@
1
1
  require 'shellplay/session'
2
-
3
- module Shellplay
4
- end
data/shellplay.gemspec CHANGED
@@ -18,13 +18,14 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^spec/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency 'paint'
22
- spec.add_dependency 'cliprompt'
23
- spec.add_dependency 'configstruct', "~> 0.0.4"
24
- spec.add_dependency 'shell2html'
21
+ spec.add_dependency 'paint', '~> 1.0.0'
22
+ spec.add_dependency 'cliprompt', '~> 0.1.2'
23
+ spec.add_dependency 'configstruct', '~> 0.1.0'
24
+ spec.add_dependency 'shell2html', '~> 0.0.5'
25
25
 
26
- spec.add_development_dependency "bundler", "~> 1.6"
26
+ spec.add_development_dependency "bundler", '~> 1.6'
27
27
  spec.add_development_dependency "rake"
28
- spec.add_development_dependency 'rspec', "~> 3.0"
28
+ spec.add_development_dependency 'rspec', '~> 3.0'
29
+ spec.add_development_dependency 'simplecov'
29
30
  spec.add_development_dependency 'coveralls'
30
31
  end
@@ -26,7 +26,7 @@ describe Shellplay::Session, "A shellplay session" do
26
26
 
27
27
  context "when we import an invalid file, " do
28
28
  it "should break and throw exception" do
29
- expect { subject.import('/file/notfound') }.to raise_error
29
+ expect { subject.import('/file/notfound') }.to raise_error(Errno::ENOENT)
30
30
  end
31
31
  end
32
32
 
metadata CHANGED
@@ -1,71 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shellplay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - mose
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-19 00:00:00.000000000 Z
11
+ date: 2015-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: paint
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 1.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 1.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: cliprompt
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 0.1.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 0.1.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: configstruct
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.0.4
47
+ version: 0.1.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.0.4
54
+ version: 0.1.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: shell2html
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 0.0.5
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: 0.0.5
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '3.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: simplecov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: coveralls
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -181,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
195
  version: '0'
182
196
  requirements: []
183
197
  rubyforge_project:
184
- rubygems_version: 2.2.2
198
+ rubygems_version: 2.4.8
185
199
  signing_key:
186
200
  specification_version: 4
187
201
  summary: CLI tool for shell-based presentations.