Permalink
Browse files

Rebranded to shelr, http://shelr.tv/ mentioned :)

  • Loading branch information...
1 parent 126070d commit 4adb3271994f3ab67f8a29d93d61c7054c48950d @antono antono committed Aug 16, 2011
View
@@ -1,9 +1,7 @@
source "http://rubygems.org"
-gem 'xdg'
+gem 'xdg', '1.0.0'
gem 'colored'
-#gem 'artii'
-#gem 'ohai'
group :development do
gem "rspec"
View
@@ -10,7 +10,7 @@ GEM
rake
mocha (0.9.9)
rake
- rake (0.8.7)
+ rake (0.9.2)
rcov (0.9.9)
rspec (2.1.0)
rspec-core (~> 2.1.0)
@@ -32,4 +32,4 @@ DEPENDENCIES
mocha
rcov
rspec
- xdg
+ xdg (= 1.0.0)
View
Oops, something went wrong.
View
@@ -1,5 +1,6 @@
require 'rubygems'
require 'bundler'
+
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
@@ -11,14 +12,13 @@ require 'rake'
require 'jeweler'
Jeweler::Tasks.new do |gem|
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
- gem.name = "shellcast"
- gem.homepage = "http://shell.heroku.com/"
- gem.license = "GPL"
+ gem.name = "shelr"
+ gem.homepage = "http://shelr.tv/"
+ gem.license = "GPLv3"
gem.summary = %Q{Screencasts for Shell Ninjas}
gem.description = %Q{Screencast utility for unix shell junkies :)}
- gem.email = "antono.vasiljev@gmail.com"
- gem.authors = ["Antono Vasiljev"]
+ gem.email = "self@antono.info"
+ gem.authors = ["Antono Vasiljev", "Pete Clark"]
end
Jeweler::RubygemsDotOrgTasks.new
@@ -40,7 +40,7 @@ Rake::RDocTask.new do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
rdoc.rdoc_dir = 'rdoc'
- rdoc.title = "shellcast #{version}"
+ rdoc.title = "shelr #{version}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end
@@ -3,54 +3,55 @@
$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
require 'rubygems'
-require 'shellcast'
+require 'shelr'
BASENAME = File.basename(__FILE__)
-HELP = <<-HELP
+HELP = <<-HELP
Usage: #{BASENAME} option [arg]
- Options:
- setup API_KEY - setup
- record - record new shellcast
- push RECORD_ID - publish
- list - print list of records
- play RECORD_ID - play local record
- play RECORD_URL - play remote record
- HELP
+ Options:
+ setup API_KEY - setup
+ record - record new shellcast
+ push RECORD_ID - publish
+ list - print list of records
+ play RECORD_ID - play local record
+ play RECORD_URL - play remote record
+
+HELP
case ARGV[0]
when '-h', '--help'
puts HELP
when 'record'
- ShellCast::Recorder.record!
+ Shelr::Recorder.record!
when 'list'
- ShellCast::Player.list
+ Shelr::Player.list
when 'play'
if ARGV[1]
if ARGV[1] =~ /^http:.*/
- ShellCast::Player.play_remote(ARGV[1])
+ Shelr::Player.play_remote(ARGV[1])
else
- ShellCast::Player.play(ARGV[1])
+ Shelr::Player.play(ARGV[1])
end
else
puts "Missing id for shellcast"
- ShellCast::Player.list
+ Shelr::Player.list
puts "Select one..."
exit
end
when 'push'
if ARGV[1]
- ShellCast::Publisher.new.publish(ARGV[1])
+ Shelr::Publisher.new.publish(ARGV[1])
else
puts "What do you want to publish"
- ShellCast::Player.list
+ Shelr::Player.list
puts "Select one..."
exit
end
when 'setup'
if ARGV[1]
- ShellCast.api_key = ARGV[1]
+ Shelr.api_key = ARGV[1]
else
puts "\n\tUsage: #{BASENAME} setup API_KEY\n\n"
exit
@@ -1,101 +0,0 @@
-# encoding: utf-8
-require 'net/http'
-require 'tmpdir'
-require 'fileutils'
-require 'pathname'
-
-module ShellCast
- class Player
-
- HEADER = <<-EOH
-
- █ ███ ███
- ▓███▒ █ █ █ ░███▒ █
- █▓ ░█ █ █ █ ░█▒ ░█ █
- █ █▒██▒ ███ █ █ █▒ ░███░ ▒███▒ █████
- █▓░ █▓ ▒█ ▓▓ ▒█ █ █ █ █▒ ▒█ █▒ ░█ █
- ▓██▓ █ █ █ █ █ █ █ █ █▒░ █
- ▓█ █ █ █████ █ █ █ ▒████ ░███▒ █
- █ █ █ █ █ █ █▒ █▒ █ ▒█ █
- █░ ▓█ █ █ ▓▓ █ █░ █░ ░█▒ ░▓ █░ ▓█ █░ ▒█ █░
- ▒████░ █ █ ███▒ ▒██ ▒██ ▒███▒ ▒██▒█ ▒███▒ ▒██
-
-
- .----------------.
- ' Playback started '
- EOH
-
- FOOTER = <<-EOF
- █ █
- ███████ █ ██████ █
- █ █ █ █
- █ █▒██▒ ███ █ █▒██▒ ██▓█
- █ █▓ ▒█ ▓▓ ▒█ █ █▓ ▒█ █▓ ▓█
- █ █ █ █ █ ██████ █ █ █ █
- █ █ █ █████ █ █ █ █ █
- █ █ █ █ █ █ █ █ █
- █ █ █ ▓▓ █ █ █ █ █▓ ▓█
- █ █ █ ███▒ ██████ █ █ ██▓█
-
- EOF
-
-
- def self.play(id)
- new(id).play
- end
-
- def self.play_remote(url)
- puts ".==> Fetching #{url}".white_on_black
- resp = Net::HTTP.get(URI.parse(url))
- parts = JSON.parse(resp)
-
- print "| Title:\t".yellow
- puts parts['title']
- print "| Description:\t".yellow
- puts parts['description']
-
- Dir.mktmpdir do |dir|
- %w(typescript timing).each do |type|
- File.open(File.join(dir, type), 'w') { |f| f.puts(parts[type]) }
- end
- puts "+==> Playing... ".white_on_black
- system "scriptreplay #{File.join(dir, 'timing')} #{File.join(dir, 'typescript')}"
- puts "+\n+"
- print "| Title:\t".yellow
- puts parts['title']
- print "| Description:\t".yellow
- puts parts['description']
- puts "`==> The end... ".white_on_black
- end
- end
-
- def self.list
- Dir[File.join(ShellCast::DATA_DIR, "**", 'meta')].each do |path|
- metadata = JSON.parse(IO.read(path))
- puts "#{metadata["created_at"]}: #{metadata["title"]}"
- end
- end
-
- def initialize(id)
- @shellcast_id = id
- end
-
- def play
- puts HEADER.black_on_white
- puts
- system(scriptreplay_cmd)
- puts
- puts FOOTER.black_on_white
- end
-
- private
-
- def shellcast_file(name)
- File.join(ShellCast.shellcast_dir(@shellcast_id), name)
- end
-
- def scriptreplay_cmd
- "scriptreplay #{shellcast_file('timing')} #{shellcast_file('typescript')}"
- end
- end
-end
@@ -1,100 +0,0 @@
-# encoding: utf-8
-module ShellCast
- class Recorder
-
- HEADER = <<-EOH
- █ █
- █████ █
- █ ▓█ █
- █ █ ███ ▓██▒ ███ █▒██▒ ██▓█ ███ █▒██▒ ██▓█
- █ ▒█ ▓▓ ▒█ ▓█ ▓ █▓ ▓█ ██ █ █▓ ▓█ █ █▓ ▒█ █▓ ▓█
- █████ █ █ █░ █ █ █ █ █ █ █ █ █ █
- █ ░█▒ █████ █ █ █ █ █ █ █ █ █ █ █
- █ ░█ █ █░ █ █ █ █ █ █ █ █ █ █
- █ █ ▓▓ █ ▓█ ▓ █▓ ▓█ █ █▓ ▓█ █ █ █ █▓ ▓█ █ █
- █ ▒ ███▒ ▓██▒ ███ █ ██▓█ █████ █ █ ██▒█ █ █
-
- ▓ ▒█
- ▒██░
- EOH
-
- FOOTER = <<-EOF
- █ █ █ █
- ██████ █ █ █
- █ █ █ █
- █ ███ █▒██▒ ███ ▒███▒ █▒██▒ ███ ██▓█ █
- █ █ █▓ ▒█ █ █▒ ░█ █▓ ▒█ ▓▓ ▒█ █▓ ▓█ █
- ██████ █ █ █ █ █▒░ █ █ █ █ █ █ █
- █ █ █ █ █ ░███▒ █ █ █████ █ █ █
- █ █ █ █ █ ▒█ █ █ █ █ █
- █ █ █ █ █ █░ ▒█ █ █ ▓▓ █ █▓ ▓█ █
- █ █████ █ █ █████ ▒███▒ █ █ ███▒ ██▓█ █
-
- EOF
-
- def self.record!
- new.record!
- end
-
- def initialize
- @meta = {}
- end
-
- def record!
- test_shellcast_data_dir
- request_metadata
- puts HEADER.black_on_white
- puts "Your session started"
- puts "Type Ctrl+D or exit to finish recording"
- init_terminal
- system(script_cmd)
- restore_terminal
- puts FOOTER.black_on_white
- puts "hint $ shellcast play #{shellcast_id}".green
- end
-
- def request_metadata
- print "Provide name for Your shellcast: "
- @meta["title"] = STDIN.gets.strip
- @meta["created_at"] = shellcast_id
- puts shellcast_file('meta')
- File.open(shellcast_file('meta'), 'w+') do |meta|
- meta.puts @meta.to_json
- end
- end
-
- private
-
- def test_shellcast_data_dir
- FileUtils.mkdir_p(shellcast_dir) unless File.exists?(shellcast_dir)
- end
-
- def init_terminal
- stty_data = `stty -a`
- @user_columns = stty_data.match(/columns (\d+)/)[1]
- @user_rows = stty_data.match(/rows (\d+)/)[1]
- puts "Saved terminal size #{@user_columns}X#{@user_rows}"
- system("stty columns 80 rows 24")
- end
-
- def restore_terminal
- system("stty columns #{@user_columns} rows #{@user_rows}")
- end
-
- def shellcast_dir
- @shellcast_dir ||= ShellCast.shellcast_dir(shellcast_id)
- end
-
- def shellcast_id
- @shellcast_id ||= Time.now.to_i.to_s
- end
-
- def shellcast_file(name)
- File.join(ShellCast.shellcast_dir(shellcast_id), name)
- end
-
- def script_cmd
- "script -c 'bash' #{shellcast_file('typescript')} -t 2> #{shellcast_file('timing')}"
- end
- end
-end
@@ -5,13 +5,17 @@
require 'yaml'
require 'json'
-module ShellCast
+module Shelr
- APP_NAME = 'shellcast'
+ APP_NAME = 'shelr'
DATA_DIR = File.join(XDG['DATA_HOME'].to_s, APP_NAME)
CONFIG_DIR = File.join(XDG['CONFIG_HOME'].to_s, APP_NAME)
API_KEY = File.join(CONFIG_DIR, 'api_key')
- API_URL = ENV['SC_LOCAL'] ? 'http://localhost:3000' : 'http://shell.heroku.com'
+ API_URL = ENV['SC_LOCAL'] ? 'http://localhost:3000' : 'http://shelr.tv'
+
+ autoload :Recorder, 'shelr/recorder.rb'
+ autoload :Player, 'shelr/player.rb'
+ autoload :Publisher, 'shelr/publisher.rb'
class << self
def api_key
@@ -21,18 +25,12 @@ def api_key
def api_key=(key)
FileUtils.mkdir_p(CONFIG_DIR) unless File.exist?(CONFIG_DIR)
- File.open(API_KEY, 'w+') do |f|
- f.puts(key.strip)
- end
+ File.open(API_KEY, 'w+') { |f| f.puts(key.strip) }
end
- def shellcast_dir(shellcast_id)
- File.join(ShellCast::DATA_DIR, shellcast_id.to_s)
+ def data_dir(record_id)
+ File.join(Shelr::DATA_DIR, record_id.to_s)
end
end
- autoload :Recorder, 'shellcast/recorder.rb'
- autoload :Player, 'shellcast/player.rb'
- autoload :Publisher, 'shellcast/publisher.rb'
-
end
Oops, something went wrong.

0 comments on commit 4adb327

Please sign in to comment.