open_terms 0.0.2 → 0.0.3
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/Rakefile +4 -3
- data/lib/open_terms/gnome_terminal.rb +2 -11
- data/lib/open_terms/version.rb +1 -1
- data/spec/open_terms/gnome_terminal_spec.rb +2 -10
- data/spec/open_terms_spec.rb +19 -0
- data/spec/spec_helper.rb +3 -3
- metadata +6 -4
data/Rakefile
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
require
|
|
2
|
-
|
|
1
|
+
require 'bundler'
|
|
2
|
+
Bundler::GemHelper.install_tasks
|
|
3
3
|
|
|
4
|
+
require 'rake/testtask'
|
|
4
5
|
Rake::TestTask.new do |t|
|
|
5
|
-
t.libs << "spec"
|
|
6
|
+
t.libs << "lib" << "spec"
|
|
6
7
|
t.test_files = FileList['spec/**/*_spec.rb']
|
|
7
8
|
t.verbose = true
|
|
8
9
|
end
|
|
@@ -9,16 +9,7 @@ module OpenTerms
|
|
|
9
9
|
commands.each do |tab_name, command|
|
|
10
10
|
run "xdotool windowfocus #{term_pid}"
|
|
11
11
|
run "xdotool key ctrl+shift+t"
|
|
12
|
-
|
|
13
|
-
run "xdotool key ctrl+shift+alt+t"
|
|
14
|
-
run "xdotool type #{tab_name}"
|
|
15
|
-
run "xdotool key Return"
|
|
16
|
-
|
|
17
|
-
command.split(" ").each do |command_part|
|
|
18
|
-
run "xdotool type #{command_part}"
|
|
19
|
-
run "xdotool key space"
|
|
20
|
-
end
|
|
21
|
-
|
|
12
|
+
run "xdotool type '#{command}'"
|
|
22
13
|
run "xdotool key Return"
|
|
23
14
|
end
|
|
24
15
|
end
|
|
@@ -26,7 +17,7 @@ module OpenTerms
|
|
|
26
17
|
protected
|
|
27
18
|
|
|
28
19
|
def run(command)
|
|
29
|
-
system(command) && sleep(
|
|
20
|
+
system(command) && sleep(1) || raise("Command #{command.inspect} failed")
|
|
30
21
|
end
|
|
31
22
|
end
|
|
32
23
|
end
|
data/lib/open_terms/version.rb
CHANGED
|
@@ -25,19 +25,11 @@ describe OpenTerms::GnomeTerminal do
|
|
|
25
25
|
$executor.should_receive(:run).with('xdotool getactivewindow').and_return(2)
|
|
26
26
|
execs = ["xdotool windowfocus 2",
|
|
27
27
|
"xdotool key ctrl+shift+t",
|
|
28
|
-
"xdotool
|
|
29
|
-
"xdotool type title1",
|
|
30
|
-
"xdotool key Return",
|
|
31
|
-
"xdotool type command1",
|
|
32
|
-
"xdotool key space",
|
|
28
|
+
"xdotool type 'command1'",
|
|
33
29
|
"xdotool key Return",
|
|
34
30
|
"xdotool windowfocus 2",
|
|
35
31
|
"xdotool key ctrl+shift+t",
|
|
36
|
-
"xdotool
|
|
37
|
-
"xdotool type title2",
|
|
38
|
-
"xdotool key Return",
|
|
39
|
-
"xdotool type command2",
|
|
40
|
-
"xdotool key space",
|
|
32
|
+
"xdotool type 'command2'",
|
|
41
33
|
"xdotool key Return"].each do |cmd|
|
|
42
34
|
$executor.should_receive(:run).with(cmd)
|
|
43
35
|
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'open_terms'
|
|
3
|
+
module Rails
|
|
4
|
+
def self.root
|
|
5
|
+
"RAILS_ROOT"
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
describe OpenTerms do
|
|
9
|
+
it "should open the 3 default terminals for a Rails app" do
|
|
10
|
+
project_dir = "RAILS_ROOT"
|
|
11
|
+
@commands = [
|
|
12
|
+
[:application, %Q{cd "#{project_dir}" && script/rails server}],
|
|
13
|
+
[:console, %Q{cd "#{project_dir}" && script/rails console}],
|
|
14
|
+
[:logs, %Q{cd "#{project_dir}" && tail -f log/development.log}]
|
|
15
|
+
]
|
|
16
|
+
OpenTerms.should_receive(:run_commands).with(@commands)
|
|
17
|
+
OpenTerms.rails_defaults
|
|
18
|
+
end
|
|
19
|
+
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
require 'rubygems'
|
|
2
|
-
require 'bundler/setup'
|
|
3
|
-
require 'rspec/autorun'
|
|
4
1
|
require 'simplecov'
|
|
5
2
|
SimpleCov.start do
|
|
6
3
|
add_filter "/spec/"
|
|
7
4
|
end
|
|
8
5
|
|
|
6
|
+
require 'rubygems'
|
|
7
|
+
require 'bundler/setup'
|
|
8
|
+
require 'rspec/autorun'
|
|
9
9
|
require 'open_terms' # and any other gems you need
|
|
10
10
|
|
|
11
11
|
RSpec.configure do |config|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: open_terms
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.3
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,11 +9,11 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2011-12-
|
|
12
|
+
date: 2011-12-29 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rspec
|
|
16
|
-
requirement: &
|
|
16
|
+
requirement: &70329628833020 !ruby/object:Gem::Requirement
|
|
17
17
|
none: false
|
|
18
18
|
requirements:
|
|
19
19
|
- - ! '>='
|
|
@@ -21,7 +21,7 @@ dependencies:
|
|
|
21
21
|
version: 2.0.0
|
|
22
22
|
type: :development
|
|
23
23
|
prerelease: false
|
|
24
|
-
version_requirements: *
|
|
24
|
+
version_requirements: *70329628833020
|
|
25
25
|
description: Easy way to open many terminals for OSX and Linux
|
|
26
26
|
email:
|
|
27
27
|
- rodrigo@urubatan.com.br
|
|
@@ -47,6 +47,7 @@ files:
|
|
|
47
47
|
- spec/open_terms/gnome_terminal_spec.rb
|
|
48
48
|
- spec/open_terms/osx_iterm_spec.rb
|
|
49
49
|
- spec/open_terms/osx_terminal_spec.rb
|
|
50
|
+
- spec/open_terms_spec.rb
|
|
50
51
|
- spec/spec_helper.rb
|
|
51
52
|
homepage: http://www.urubatan.com.br
|
|
52
53
|
licenses: []
|
|
@@ -77,4 +78,5 @@ test_files:
|
|
|
77
78
|
- spec/open_terms/gnome_terminal_spec.rb
|
|
78
79
|
- spec/open_terms/osx_iterm_spec.rb
|
|
79
80
|
- spec/open_terms/osx_terminal_spec.rb
|
|
81
|
+
- spec/open_terms_spec.rb
|
|
80
82
|
- spec/spec_helper.rb
|