[DRE-commits] [SCM] shelr.git branch, master, updated. upstream/0.11.6-21-gaa98287

Antono Vasiljev self at antono.info
Sat Apr 7 15:05:11 UTC 2012


The following commit has been merged in the master branch:
commit 4bc84eecf3090bcb8f4762fa3fb846646de6e365
Author: Antono Vasiljev <self at antono.info>
Date:   Sat Apr 7 18:01:54 2012 +0300

    Revert "Lock record while recording. Disable publishing when locked"
    
    This reverts commit 9cb47e851db8afefa98aa38602c15b9f89e9f108.
    It was wrong repository for this change!

diff --git a/lib/shelr/publisher.rb b/lib/shelr/publisher.rb
index 4485d89..ff57273 100644
--- a/lib/shelr/publisher.rb
+++ b/lib/shelr/publisher.rb
@@ -5,7 +5,6 @@ module Shelr
   class Publisher
 
     def publish(id)
-      ensure_unlocked(id)
       with_exception_handler do
         uri = URI.parse(Shelr::API_URL + '/records')
         params = { 'record' => prepare(id) }
@@ -25,17 +24,6 @@ module Shelr
 
     private
 
-    def ensure_unlocked(id)
-      lock_path = File.join(Shelr.data_dir(id), 'lock')
-      if File.exist?(lock_path)
-        puts "=> Cannot publish"
-        puts "=> Record locked on #{File.read(lock_path)}"
-        puts "=> Esure no other shelr process running"
-        puts "=> Or remove lock file manually: #{lock_path}"
-        exit 0
-      end
-    end
-
     def with_exception_handler(&block)
       yield
     rescue => e
diff --git a/lib/shelr/recorder.rb b/lib/shelr/recorder.rb
index 53fad6b..f35c6f4 100644
--- a/lib/shelr/recorder.rb
+++ b/lib/shelr/recorder.rb
@@ -14,21 +14,19 @@ module Shelr
 
     def record!
       check_record_dir
-      with_lock_file do
-        init_terminal
-        request_metadata
-        STDOUT.puts "-=" * (Shelr.terminal.size[:width] / 2)
-        STDOUT.puts "=> Your session started"
-        STDOUT.puts "=> Please, do not resize your terminal while recording"
-        STDOUT.puts "=> Press Ctrl+D or 'exit' to finish recording"
-        system(recorder_cmd)
-        save_as_typescript if Shelr.backend == 'ttyrec'
-        STDOUT.puts "-=" * (Shelr.terminal.size[:width] / 2)
-        STDOUT.puts "=> Session finished"
-        STDOUT.puts
-        STDOUT.puts "Replay  : #{Shelr::APP_NAME} play last"
-        STDOUT.puts "Publish : #{Shelr::APP_NAME} push last"
-      end
+      init_terminal
+      request_metadata
+      STDOUT.puts "-=" * (Shelr.terminal.size[:width] / 2)
+      STDOUT.puts "=> Your session started"
+      STDOUT.puts "=> Please, do not resize your terminal while recording"
+      STDOUT.puts "=> Press Ctrl+D or 'exit' to finish recording"
+      system(recorder_cmd)
+      save_as_typescript if Shelr.backend == 'ttyrec'
+      STDOUT.puts "-=" * (Shelr.terminal.size[:width] / 2)
+      STDOUT.puts "=> Session finished"
+      STDOUT.puts
+      STDOUT.puts "Replay  : #{Shelr::APP_NAME} play last"
+      STDOUT.puts "Publish : #{Shelr::APP_NAME} push last"
     end
 
     def request_metadata
@@ -45,15 +43,6 @@ module Shelr
 
     private
 
-    def with_lock_file
-      lock_path = record_file('lock')
-      File.open(lock_path, 'w') do |f|
-        f.puts Time.now.to_s
-      end
-      yield
-      FileUtils.rm(lock_path)
-    end
-
     def save_as_typescript
       puts '=> Converting ttyrec -> typescript'
 
diff --git a/spec/shelr/publisher_spec.rb b/spec/shelr/publisher_spec.rb
index 577cd9f..fd0039f 100644
--- a/spec/shelr/publisher_spec.rb
+++ b/spec/shelr/publisher_spec.rb
@@ -9,20 +9,12 @@ describe Shelr::Publisher do
   end
 
   describe "#publish(id)" do
-    before do
+    it "prepares record as json" do
       STDIN.stub(:gets).and_return('something')
       subject.stub(:handle_response)
       subject.stub(:prepare).and_return(Fixture::load('record1.json'))
-    end
-
-    it "prepares record as json" do
       subject.should_receive(:prepare).with('hello')
-      subject.publish('hello')
-    end
 
-    it "it checks that file is not locked" do
-      subject.stub(:ensure_unlocked)
-      subject.should_receive(:ensure_unlocked).with('hello')
       subject.publish('hello')
     end
   end
diff --git a/spec/shelr/recorder_spec.rb b/spec/shelr/recorder_spec.rb
index 8a7f32e..8b4f199 100644
--- a/spec/shelr/recorder_spec.rb
+++ b/spec/shelr/recorder_spec.rb
@@ -12,19 +12,12 @@ describe Shelr::Recorder do
   describe "#record!" do
     before do
       subject.stub(:system).with(anything).and_return(true)
-      subject.stub(:record_id => "1")
-      subject.stub(:with_lock_file).and_yield
     end
 
     it "starts script session" do
       subject.should_receive(:system).with(/script/)
       subject.record!
     end
-
-    it "creates lock file" do
-      subject.should_receive(:with_lock_file)
-      subject.record!
-    end
   end
 
   describe "#request_metadata" do

-- 
shelr.git



More information about the Pkg-ruby-extras-commits mailing list