terminitor 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/Termfile ADDED
@@ -0,0 +1,11 @@
1
+ # COMMENT OF SCRIPT HERE
2
+ # you can make as many tabs as you wish...
3
+ # tab names are actually arbitrary at this point too.
4
+ ---
5
+ - tab1:
6
+ - gitx
7
+ - tab2:
8
+ - mate .
9
+ - irb
10
+ - tab3:
11
+ - open 'http://github.com/achiu/terminitor'
data/lib/terminitor.rb CHANGED
@@ -29,8 +29,9 @@ module Terminitor
29
29
 
30
30
  desc "list", "lists all terminitor scripts"
31
31
  def list
32
+ say "Global scripts: \n"
32
33
  Dir.glob("#{ENV['HOME']}/.terminitor/*").each do |file|
33
- say "#{File.basename(file)} - #{File.read(file).first.gsub("#",'')}"
34
+ say " * #{File.basename(file)} #{grab_comment_for_file(file)}"
34
35
  end
35
36
  end
36
37
 
@@ -52,6 +53,14 @@ module Terminitor
52
53
  def create
53
54
  invoke :open, [], :root => options[:root]
54
55
  end
56
+
57
+ no_tasks do
58
+
59
+ def grab_comment_for_file(file)
60
+ first_line = File.read(file).first
61
+ first_line =~ /^\s*?#/ ? ("-" + first_line.gsub("#","")) : "\n"
62
+ end
63
+ end
55
64
 
56
65
  end
57
66
  end
@@ -16,6 +16,7 @@ module Terminitor
16
16
 
17
17
  tab = self.open_tab(terminal)
18
18
  cmds = [cmds].flatten
19
+ cmds.insert(0, "cd \"#{@working_dir}\" ; clear") unless @working_dir.to_s.empty?
19
20
  cmds.each do |cmd|
20
21
  terminal.windows.last.do_script(cmd, :in => tab)
21
22
  end
@@ -48,6 +49,7 @@ module Terminitor
48
49
  end
49
50
  @got_first_tab_already = true
50
51
  local_window = active_window(terminal)
52
+ @working_dir = Dir.pwd
51
53
  local_tabs = local_window.tabs if local_window
52
54
  local_tabs.last.get if local_tabs
53
55
  end
@@ -1,3 +1,3 @@
1
1
  module Terminitor
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -18,8 +18,8 @@ context "Terminitor" do
18
18
  setup { File.open(File.join(@path,'foo.yml'),"w") { |f| f.puts @template } }
19
19
  setup { File.open(File.join(@path,'bar.yml'),"w") { |f| f.puts @template } }
20
20
  setup { capture(:stdout) { Terminitor::Cli.start(['list']) } }
21
- asserts_topic.matches %r{foo.yml - COMMENT OF SCRIPT HERE}
22
- asserts_topic.matches %r{bar.yml - COMMENT OF SCRIPT HERE}
21
+ asserts_topic.matches %r{foo.yml - COMMENT OF SCRIPT HERE}
22
+ asserts_topic.matches %r{bar.yml - COMMENT OF SCRIPT HERE}
23
23
  end
24
24
 
25
25
  context "setup" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terminitor
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Arthur Chiu
@@ -124,6 +124,7 @@ files:
124
124
  - Gemfile
125
125
  - README.md
126
126
  - Rakefile
127
+ - Termfile
127
128
  - bin/terminitor
128
129
  - lib/templates/example.yml.tt
129
130
  - lib/terminitor.rb