i2cssh 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "bundler", "~> 1.0.0"
10
+ gem "jeweler", "~> 1.6.2"
11
+ gem "rcov"
12
+ gem "shoulda"
13
+ end
14
+
data/Gemfile.lock ADDED
@@ -0,0 +1,20 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ git (1.2.5)
5
+ jeweler (1.6.2)
6
+ bundler (~> 1.0)
7
+ git (>= 1.2.5)
8
+ rake
9
+ rake (0.8.7)
10
+ rcov (0.9.9)
11
+ shoulda (2.11.3)
12
+
13
+ PLATFORMS
14
+ ruby
15
+
16
+ DEPENDENCIES
17
+ bundler (~> 1.0.0)
18
+ jeweler (~> 1.6.2)
19
+ rcov
20
+ shoulda
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Wouter de Bie
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.markdown ADDED
@@ -0,0 +1,34 @@
1
+ # i2cssh
2
+
3
+ i2cssh is a http://code.google.com/p/csshx/ like tool for connecting over ssh to multiple machines. But instead of creating separate windows and having
4
+ a master window for input, i2cssh uses iterm2 split panes and "Send input to all sessions" (cmd-shift-i) to send commands
5
+ to all sessions.
6
+
7
+ ## Installing
8
+
9
+ $ gem install i2cssh
10
+
11
+ ## Usage
12
+
13
+ Usage: i2cssh [options]
14
+ -d, --debug Start RIPL after creating terminals
15
+ -f, --file FILE Cluster file
16
+ -F, --fullscreen Fullscreen
17
+ -g, --grid WxH Grid size
18
+ -u, --username USERNAME SSH username
19
+
20
+ ## Contributing to i2cssh
21
+
22
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
23
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
24
+ * Fork the project
25
+ * Start a feature/bugfix branch
26
+ * Commit and push until you are happy with your contribution
27
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
28
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
29
+
30
+ ## Copyright
31
+
32
+ Copyright (c) 2011 Wouter de Bie. See LICENSE.txt for
33
+ further details.
34
+
data/Rakefile ADDED
@@ -0,0 +1,55 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "i2cssh"
18
+ gem.homepage = "http://github.com/wouterdebie/i2cssh"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{csshX like cluster ssh using iTerm2 panes}
21
+ gem.description = %Q{csshX like cluster ssh using iTerm2 panes}
22
+ gem.email = "wouter@evenflow.se"
23
+ gem.authors = ["Wouter de Bie"]
24
+ # dependencies defined in Gemfile
25
+ gem.add_dependency 'rb-appscript', "~> 0.6.1"
26
+ gem.add_dependency 'ripl', '~> 0.4.1'
27
+ end
28
+ Jeweler::RubygemsDotOrgTasks.new
29
+
30
+ require 'rake/testtask'
31
+ Rake::TestTask.new(:test) do |test|
32
+ test.libs << 'lib' << 'test'
33
+ test.pattern = 'test/**/test_*.rb'
34
+ test.verbose = true
35
+ end
36
+
37
+ require 'rcov/rcovtask'
38
+ Rcov::RcovTask.new do |test|
39
+ test.libs << 'test'
40
+ test.pattern = 'test/**/test_*.rb'
41
+ test.verbose = true
42
+ test.rcov_opts << '--exclude "gems/*"'
43
+ end
44
+
45
+ task :default => :test
46
+
47
+ require 'rake/rdoctask'
48
+ Rake::RDocTask.new do |rdoc|
49
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
50
+
51
+ rdoc.rdoc_dir = 'rdoc'
52
+ rdoc.title = "i2cssh #{version}"
53
+ rdoc.rdoc_files.include('README*')
54
+ rdoc.rdoc_files.include('lib/**/*.rb')
55
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
data/bin/i2cssh ADDED
@@ -0,0 +1,84 @@
1
+ #!/usr/bin/ruby
2
+ require 'rubygems'
3
+ require 'appscript'
4
+ require 'optparse'
5
+
6
+ options = {}
7
+
8
+ rows = nil
9
+ columns = nil
10
+
11
+ optparse = OptionParser.new do |opts|
12
+ opts.banner = "Usage: #{File.basename(__FILE__)} [options]"
13
+ options[:debug] = false
14
+ options[:fullscreen] = false
15
+ opts.on('-d', '--debug', "Start RIPL after creating terminals") { options[:debug] = true }
16
+ opts.on('-f', '--file FILE', "Cluster file") { |f| options[:file] = f }
17
+ opts.on('-F', '--fullscreen', "Fullscreen") { options[:fullscreen] = true }
18
+ opts.on('-g', '--grid WxH', "Grid size") { |f| options[:grid] = f.split("x")}
19
+ opts.on('-u', '--username USERNAME', "SSH username") { |u| options[:username] = u }
20
+ end
21
+
22
+ optparse.parse!
23
+
24
+ unless options[:file] || options[:grid] then
25
+ puts optparse.help
26
+ exit
27
+ end
28
+
29
+ if options[:file] && options[:grid] then
30
+ puts "ERROR: -g and -f can't be used at the same time"
31
+ puts optparse.help
32
+ exit
33
+ end
34
+
35
+ ssh_prefix = "ssh " + (options[:username] ? "#{options[:username]}@" : "")
36
+
37
+ if options[:file] then
38
+ servers = File.read(options[:file]).split("\n")
39
+
40
+ count = servers.size
41
+ rows = Math.sqrt(count).ceil
42
+ columns = (count / rows.to_f).ceil
43
+ elsif options[:grid] then
44
+ columns = options[:grid][0].to_i
45
+ rows = options[:grid][1].to_i
46
+ end
47
+
48
+ iterm = Appscript.app.by_name('iTerm')
49
+ finder = Appscript.app.by_name('Finder')
50
+ sys_events = Appscript.app.by_name('System Events')
51
+
52
+ window_bounds = finder.desktop.window.bounds
53
+
54
+ term = iterm.make(:new => :terminal)
55
+ session = term.sessions.after.make(:new => :session)
56
+ session.exec(:command => "/bin/bash -l")
57
+
58
+ if options[:fullscreen] then
59
+ window = iterm.windows.get.sort_by{|x| x.id_.get}.last
60
+ window.bounds.set(window_bounds.get)
61
+ end
62
+
63
+ (columns - 1).times do
64
+ sys_events.keystroke("d", :using => :command_down)
65
+ end
66
+ (rows - 1).times do
67
+ (columns - 1).times do
68
+ sys_events.key_code(123, :using => [:command_down, :option_down])
69
+ end
70
+ (columns).times do |x|
71
+ sys_events.keystroke("D", :using => :command_down)
72
+ sys_events.key_code(124, :using => [:command_down, :option_down]) unless (columns - 1) == x
73
+ end
74
+ end
75
+
76
+ (rows * columns).times do |i|
77
+ term.sessions[i+1].write(:text => "#{ssh_prefix}#{servers[i]}") if servers && servers[i]
78
+ end
79
+ if options[:debug] then
80
+ require 'ripl'
81
+ Ripl.start :binding => binding
82
+ end
83
+
84
+
data/lib/i2cssh.rb ADDED
File without changes
data/test/helper.rb ADDED
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+ require 'shoulda'
12
+
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
15
+ require 'i2cssh'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestI2cssh < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,169 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: i2cssh
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Wouter de Bie
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-06-12 00:00:00 +02:00
19
+ default_executable: i2cssh
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ prerelease: false
23
+ type: :development
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 23
30
+ segments:
31
+ - 1
32
+ - 0
33
+ - 0
34
+ version: 1.0.0
35
+ name: bundler
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ prerelease: false
39
+ type: :development
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ hash: 11
46
+ segments:
47
+ - 1
48
+ - 6
49
+ - 2
50
+ version: 1.6.2
51
+ name: jeweler
52
+ version_requirements: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ prerelease: false
55
+ type: :development
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ hash: 3
62
+ segments:
63
+ - 0
64
+ version: "0"
65
+ name: rcov
66
+ version_requirements: *id003
67
+ - !ruby/object:Gem::Dependency
68
+ prerelease: false
69
+ type: :development
70
+ requirement: &id004 !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ hash: 3
76
+ segments:
77
+ - 0
78
+ version: "0"
79
+ name: shoulda
80
+ version_requirements: *id004
81
+ - !ruby/object:Gem::Dependency
82
+ prerelease: false
83
+ type: :runtime
84
+ requirement: &id005 !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ hash: 5
90
+ segments:
91
+ - 0
92
+ - 6
93
+ - 1
94
+ version: 0.6.1
95
+ name: rb-appscript
96
+ version_requirements: *id005
97
+ - !ruby/object:Gem::Dependency
98
+ prerelease: false
99
+ type: :runtime
100
+ requirement: &id006 !ruby/object:Gem::Requirement
101
+ none: false
102
+ requirements:
103
+ - - ~>
104
+ - !ruby/object:Gem::Version
105
+ hash: 13
106
+ segments:
107
+ - 0
108
+ - 4
109
+ - 1
110
+ version: 0.4.1
111
+ name: ripl
112
+ version_requirements: *id006
113
+ description: csshX like cluster ssh using iTerm2 panes
114
+ email: wouter@evenflow.se
115
+ executables:
116
+ - i2cssh
117
+ extensions: []
118
+
119
+ extra_rdoc_files:
120
+ - LICENSE.txt
121
+ - README.markdown
122
+ files:
123
+ - .document
124
+ - Gemfile
125
+ - Gemfile.lock
126
+ - LICENSE.txt
127
+ - README.markdown
128
+ - Rakefile
129
+ - VERSION
130
+ - bin/i2cssh
131
+ - lib/i2cssh.rb
132
+ - test/helper.rb
133
+ - test/test_i2cssh.rb
134
+ has_rdoc: true
135
+ homepage: http://github.com/wouterdebie/i2cssh
136
+ licenses:
137
+ - MIT
138
+ post_install_message:
139
+ rdoc_options: []
140
+
141
+ require_paths:
142
+ - lib
143
+ required_ruby_version: !ruby/object:Gem::Requirement
144
+ none: false
145
+ requirements:
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ hash: 3
149
+ segments:
150
+ - 0
151
+ version: "0"
152
+ required_rubygems_version: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ hash: 3
158
+ segments:
159
+ - 0
160
+ version: "0"
161
+ requirements: []
162
+
163
+ rubyforge_project:
164
+ rubygems_version: 1.6.2
165
+ signing_key:
166
+ specification_version: 3
167
+ summary: csshX like cluster ssh using iTerm2 panes
168
+ test_files: []
169
+