changeset 8:6e0a63c318f0

Support revision number input
author Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
date Mon, 21 Jul 2014 21:22:05 +0900
parents 442e7e73781c
children f01a96fbf6c7
files lib/pmuxinator/assets/debugger.yml lib/pmuxinator/config.rb
diffstat 2 files changed, 19 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lib/pmuxinator/assets/debugger.yml	Mon Jul 21 20:57:42 2014 +0900
+++ b/lib/pmuxinator/assets/debugger.yml	Mon Jul 21 21:22:05 2014 +0900
@@ -1,7 +1,7 @@
 # lib/pmuxinator/assets/debugger.yml
 
 name: debugger
-root: ~/Desktop
+root: <%= ENV['PWD'] %>
 pre: |
     echo     $ mkdir .parallel_debugger
     echo     $ hg clone . .parallel_debugger/left
@@ -9,8 +9,8 @@
 
 windows:
   - main:
-      layout: main-horizontal
+      layout: main-vertical
       panes:
-        - echo hg update -r 100
-        - echo hg update -r 50
+        - echo hg update -r <%= left_panel_revision_number %>
+        - echo hg update -r <%= right_panel_revision_number %>
       synchronize: true
--- a/lib/pmuxinator/config.rb	Mon Jul 21 20:57:42 2014 +0900
+++ b/lib/pmuxinator/config.rb	Mon Jul 21 21:22:05 2014 +0900
@@ -73,7 +73,7 @@
         config_path = Pmuxinator::Config.project(name)
 
         yaml = begin
-          YAML.load(File.read(config_path))
+          YAML.load(Erubis::Eruby.new(File.read(config_path)).result(binding))
         rescue SyntaxError, StandardError
           puts "Failed to parse config file. Please check your formatting."
           exit!
@@ -93,6 +93,20 @@
 
         project
       end
+
+      def method_missing name, *args
+        if name =~ /number$/
+          print "Please input #{name}:"
+          value = STDIN.gets.chomp
+
+          if value.blank?
+            raise 'Please input valid number'
+          end
+          return value.to_i
+        end
+
+        super name, *args
+      end
     end
   end
 end