shelr 0.13.3 → 0.14.0

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.
data/bin/shelr CHANGED
@@ -10,34 +10,37 @@ HELP = <<-HELP
10
10
 
11
11
  Usage: #{BASENAME} command [arg]
12
12
 
13
- Recording:
13
+ COMMANDS:
14
14
 
15
- record - record new shellcast
15
+ Recording:
16
16
 
17
- Publishing:
17
+ record - record new shellcast
18
18
 
19
- push last - publish last record
20
- push RECORD_ID - publish
19
+ Publishing:
21
20
 
22
- Getting record as json:
21
+ push last - publish last record
22
+ push last --private - publish private record
23
+ push RECORD_ID - publish record with given id
23
24
 
24
- dump last - dump last record as json to current dir
25
- dump RECORD_ID - dump any record as json to current dir
25
+ Getting record as json:
26
26
 
27
- Replaying:
27
+ dump last - dump last record as json to current dir
28
+ dump RECORD_ID - dump any record as json to current dir
28
29
 
29
- list - print list of records
30
- play last - play last local record
31
- play RECORD_ID - play local record
32
- play RECORD_URL - play remote record
33
- play dump.json - play local file dumped with `shelr dump`
30
+ Replaying:
34
31
 
35
- Setup:
32
+ list - print list of records
33
+ play last - play last local record
34
+ play RECORD_ID - play local record
35
+ play RECORD_URL - play remote record
36
+ play dump.json - play local file dumped with `shelr dump`
36
37
 
37
- setup API_KEY - set your API key
38
- backend [ttyrec|script] - setup recorder backend
38
+ Setup:
39
39
 
40
- Visit: http://shelr.tv/ for more info.
40
+ setup API_KEY - set your API key
41
+ backend [ttyrec|script] - setup recorder backend
42
+
43
+ Visit: http://shelr.tv/ for more info.
41
44
 
42
45
  HELP
43
46
 
@@ -75,7 +78,7 @@ when 'dump'
75
78
  end
76
79
  when 'push'
77
80
  if ARGV[1]
78
- Shelr::Publisher.new.publish(ARGV[1])
81
+ Shelr::Publisher.new.publish(ARGV[1], ARGV[2] == '--private')
79
82
  else
80
83
  puts "What do you want to publish?"
81
84
  Shelr::Player.list
data/lib/shelr/player.rb CHANGED
@@ -64,6 +64,9 @@ module Shelr
64
64
  STDOUT.puts "-=" * (Shelr.terminal.size[:width] / 2)
65
65
  end
66
66
 
67
+ def scriptreplay(typescript, timing)
68
+ end
69
+
67
70
  private
68
71
 
69
72
  def record_file(name)
@@ -4,7 +4,8 @@ require 'uri'
4
4
  module Shelr
5
5
  class Publisher
6
6
 
7
- def publish(id)
7
+ def publish(id, priv = false)
8
+ @private = priv
8
9
  ensure_unlocked(id)
9
10
  with_exception_handler do
10
11
  uri = URI.parse(Shelr::API_URL + '/records')
@@ -30,7 +31,7 @@ module Shelr
30
31
  if File.exist?(lock_path)
31
32
  puts "=> Cannot publish the record (make sure it finished with exit or Ctrl+D)"
32
33
  puts "=> Record locked on #{File.read(lock_path)}"
33
- puts "=> Esure no other shelr process running"
34
+ puts "=> Make sure no other shelr process running (ps axu | grep shelr)"
34
35
  puts "=> Or remove lock file manually: #{lock_path}"
35
36
  exit 0
36
37
  end
@@ -45,12 +46,14 @@ module Shelr
45
46
  end
46
47
 
47
48
  def handle_response(res)
48
- res = JSON.parse(res.body)
49
- if res['ok']
50
- STDOUT.puts res['message']
51
- STDOUT.puts Shelr::API_URL + '/records/' + res['id']
52
- else
53
- STDOUT.puts res['message']
49
+ with_exception_handler do
50
+ res = JSON.parse(res.body)
51
+ if res['ok']
52
+ STDOUT.puts "=> " + res['message'].to_s
53
+ STDOUT.puts "=> " + res['url'].to_s
54
+ else
55
+ STDOUT.puts res['message']
56
+ end
54
57
  end
55
58
  end
56
59
 
@@ -85,6 +88,7 @@ module Shelr
85
88
  out['description'] = STDIN.gets.strip
86
89
  STDOUT.print 'Tags (ex: howto, linux): '
87
90
  out['tags'] = STDIN.gets.strip
91
+ out['private'] = @private
88
92
  return out.to_json
89
93
  end
90
94
  end
data/lib/shelr/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Shelr
2
- VERSION = '0.13.3'
2
+ VERSION = '0.14.0'
3
3
  end
@@ -5,6 +5,7 @@ describe Shelr::Recorder do
5
5
  before do
6
6
  STDIN.stub(:gets).and_return('my shellcast')
7
7
  Shelr.backend = 'script'
8
+ # disable term size guard
8
9
  STDOUT.stub(:puts)
9
10
  STDOUT.stub(:print)
10
11
  end
@@ -13,6 +14,7 @@ describe Shelr::Recorder do
13
14
  before do
14
15
  subject.stub(:system).with(anything).and_return(true)
15
16
  subject.stub(:record_id => "1")
17
+ subject.stub(:ensure_terminal_has_good_size)
16
18
  subject.stub(:with_lock_file).and_yield
17
19
  end
18
20
 
@@ -49,9 +51,9 @@ describe Shelr::Recorder do
49
51
  end
50
52
 
51
53
  it "adds XDG_CURRENT_DESKTOP to @meta as xdg_current_desktop" do
52
- subject.stub(:record_id => 'ololo')
54
+ ENV['XDG_CURRENT_DESKTOP'] = 'united-kde-gnome-shell'
53
55
  subject.request_metadata
54
- subject.meta["recorded_at"].should == 'ololo'
56
+ subject.meta["xdg_current_desktop"].should == 'united-kde-gnome-shell'
55
57
  end
56
58
 
57
59
  it "reads title from stdin" do
@@ -69,4 +71,10 @@ describe Shelr::Recorder do
69
71
  subject.user_columns.should == 10
70
72
  end
71
73
  end
74
+
75
+ describe "#scriptreplay(typescript, timing)" do
76
+ it "reads typescript" do
77
+ File.stub(:read)
78
+ end
79
+ end
72
80
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shelr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.3
4
+ version: 0.14.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2012-04-11 00:00:00.000000000 Z
15
+ date: 2012-04-15 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: json
@@ -87,7 +87,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
87
87
  version: '0'
88
88
  segments:
89
89
  - 0
90
- hash: -2787247765045559838
90
+ hash: -3405193242959743349
91
91
  required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  none: false
93
93
  requirements:
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  version: '0'
97
97
  segments:
98
98
  - 0
99
- hash: -2787247765045559838
99
+ hash: -3405193242959743349
100
100
  requirements: []
101
101
  rubyforge_project:
102
102
  rubygems_version: 1.8.21