terminitor 0.0.3 → 0.0.4
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/Termfile +11 -0
- data/lib/terminitor.rb +10 -1
- data/lib/terminitor/runner.rb +2 -0
- data/lib/terminitor/version.rb +1 -1
- data/test/terminitor_test.rb +2 -2
- metadata +4 -3
data/Termfile
ADDED
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)}
|
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
|
data/lib/terminitor/runner.rb
CHANGED
@@ -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
|
data/lib/terminitor/version.rb
CHANGED
data/test/terminitor_test.rb
CHANGED
@@ -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 -
|
22
|
-
asserts_topic.matches %r{bar.yml -
|
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:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
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
|