termup 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +28 -0
- data/LICENSE.txt +20 -0
- data/README.md +53 -0
- data/README.rdoc +19 -0
- data/Rakefile +34 -0
- data/VERSION +1 -0
- data/bin/termup +3 -0
- data/lib/templates/template.yml +12 -0
- data/lib/termup.rb +4 -0
- data/lib/termup/base.rb +33 -0
- data/lib/termup/cli.rb +48 -0
- data/spec/spec_helper.rb +12 -0
- data/spec/termup_spec.rb +4 -0
- data/termup.gemspec +68 -0
- metadata +120 -0
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.1.2)
|
5
|
+
git (1.2.5)
|
6
|
+
jeweler (1.6.0)
|
7
|
+
bundler (~> 1.0.0)
|
8
|
+
git (>= 1.2.5)
|
9
|
+
rake
|
10
|
+
rake (0.8.7)
|
11
|
+
rb-appscript (0.6.1)
|
12
|
+
rspec (2.6.0)
|
13
|
+
rspec-core (~> 2.6.0)
|
14
|
+
rspec-expectations (~> 2.6.0)
|
15
|
+
rspec-mocks (~> 2.6.0)
|
16
|
+
rspec-core (2.6.0)
|
17
|
+
rspec-expectations (2.6.0)
|
18
|
+
diff-lcs (~> 1.1.2)
|
19
|
+
rspec-mocks (2.6.0)
|
20
|
+
|
21
|
+
PLATFORMS
|
22
|
+
ruby
|
23
|
+
|
24
|
+
DEPENDENCIES
|
25
|
+
bundler (~> 1.0.13)
|
26
|
+
jeweler (~> 1.6.0)
|
27
|
+
rb-appscript (~> 0.6.1)
|
28
|
+
rspec (~> 2.6.0)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Kenn Ejima
|
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.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
Termup
|
2
|
+
======
|
3
|
+
|
4
|
+
Initialize your terminal tabs with preset commands.
|
5
|
+
|
6
|
+
Compatible with Terminal.app on Mac OS X 10.6 and Ruby 1.9.2.
|
7
|
+
|
8
|
+
Installation
|
9
|
+
------------
|
10
|
+
|
11
|
+
$ gem install termup
|
12
|
+
|
13
|
+
Usage
|
14
|
+
-----
|
15
|
+
|
16
|
+
#### Getting Started ####
|
17
|
+
|
18
|
+
Call the following command:
|
19
|
+
|
20
|
+
$ termup create new_project
|
21
|
+
|
22
|
+
This will create a new project at `~/.config/termup/new_project.yml`. Edit the file:
|
23
|
+
|
24
|
+
$ termup edit new_project
|
25
|
+
|
26
|
+
And now you're good to go:
|
27
|
+
|
28
|
+
$ termup start new_project
|
29
|
+
|
30
|
+
#### YAML Syntax ####
|
31
|
+
|
32
|
+
# ~/.config/termup/new_project.yml
|
33
|
+
---
|
34
|
+
- tab1:
|
35
|
+
- cd ~/foo/bar
|
36
|
+
- git status
|
37
|
+
- tab2:
|
38
|
+
- mysql -u root
|
39
|
+
- show databases;
|
40
|
+
- tab3: echo "hello world"
|
41
|
+
- tab4:
|
42
|
+
- cd ~/foo/project
|
43
|
+
- autotest
|
44
|
+
|
45
|
+
Tabs can contain a single command, or YAML arrays to execute multiple commands.
|
46
|
+
|
47
|
+
#### Shortcut ####
|
48
|
+
|
49
|
+
Commands have a shortcut for even fewer keystrokes.
|
50
|
+
|
51
|
+
$ termup s new_project
|
52
|
+
|
53
|
+
That's equivalent to `termup start new_project`.
|
data/README.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= termup
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Contributing to termup
|
6
|
+
|
7
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
8
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
9
|
+
* Fork the project
|
10
|
+
* Start a feature/bugfix branch
|
11
|
+
* Commit and push until you are happy with your contribution
|
12
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
+
* 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.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2011 Kenn Ejima. See LICENSE.txt for
|
18
|
+
further details.
|
19
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
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 = "termup"
|
18
|
+
gem.homepage = "http://github.com/kenn/termup"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = "Initialize terminal tabs with preset commands"
|
21
|
+
gem.description = "Initialize terminal tabs with preset commands"
|
22
|
+
gem.email = "kenn.ejima@gmail.com"
|
23
|
+
gem.authors = ["Kenn Ejima"]
|
24
|
+
gem.executables = ["termup"]
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rspec/core'
|
29
|
+
require 'rspec/core/rake_task'
|
30
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
31
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
32
|
+
end
|
33
|
+
|
34
|
+
task :default => :spec
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.1
|
data/bin/termup
ADDED
data/lib/termup.rb
ADDED
data/lib/termup/base.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rubygems'
|
3
|
+
require 'appscript'
|
4
|
+
require 'yaml'
|
5
|
+
|
6
|
+
module Termup
|
7
|
+
class Base
|
8
|
+
include Appscript
|
9
|
+
|
10
|
+
def initialize(project)
|
11
|
+
@terminal = app('Terminal')
|
12
|
+
tabs = YAML.load(File.read("#{TERMUP_DIR}/#{project}.yml"))
|
13
|
+
tabs.each do |hash|
|
14
|
+
tabname = hash.keys.first
|
15
|
+
cmds = hash.values.first
|
16
|
+
cmds = [cmds].flatten
|
17
|
+
tab = new_tab
|
18
|
+
cmds.each do |cmd|
|
19
|
+
@terminal.do_script(cmd, :in => tab)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def new_tab
|
25
|
+
if @got_first_tab_already
|
26
|
+
app("System Events").application_processes["Terminal.app"].keystroke("t", :using => :command_down)
|
27
|
+
end
|
28
|
+
@got_first_tab_already = true
|
29
|
+
sleep 0.01 # Allow some time to complete opening a new tab
|
30
|
+
@terminal.windows[1].tabs.last.get
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/termup/cli.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
module Termup
|
4
|
+
TERMUP_DIR = File.join(ENV['HOME'],'.config','termup')
|
5
|
+
|
6
|
+
class Cli < Thor
|
7
|
+
include Thor::Actions
|
8
|
+
|
9
|
+
class << self
|
10
|
+
def source_root
|
11
|
+
File.expand_path('../../',__FILE__)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
map "c" => :create
|
16
|
+
map "e" => :edit
|
17
|
+
map "l" => :list
|
18
|
+
map "s" => :start
|
19
|
+
|
20
|
+
desc "create PROJECT", "Create termup project (Shortcut: c)"
|
21
|
+
def create(project)
|
22
|
+
empty_directory TERMUP_DIR
|
23
|
+
template "templates/template.yml", path(project)
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "edit PROJECT", "Edit termup project (Shortcut: e)"
|
27
|
+
def edit(project)
|
28
|
+
say "please set $EDITOR in your .bash_profile." and return unless editor = ENV['EDITOR']
|
29
|
+
system("#{editor} #{path(project)}")
|
30
|
+
end
|
31
|
+
|
32
|
+
desc "list", "List termup projects (Shortcut: l)"
|
33
|
+
def list
|
34
|
+
projects = Dir["#{TERMUP_DIR}/*.yml"].map{|file| File.basename(file,'.yml') }
|
35
|
+
say "Your projects: #{projects.join(', ')}"
|
36
|
+
end
|
37
|
+
|
38
|
+
desc "start PROJECT", "Start termup project (Shortcut: s)"
|
39
|
+
def start(project)
|
40
|
+
Termup::Base.new(project)
|
41
|
+
end
|
42
|
+
|
43
|
+
protected
|
44
|
+
def path(project)
|
45
|
+
"#{TERMUP_DIR}/#{project}.yml"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'rspec'
|
4
|
+
require 'termup'
|
5
|
+
|
6
|
+
# Requires supporting files with custom matchers and macros, etc,
|
7
|
+
# in ./support/ and its subdirectories.
|
8
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
|
12
|
+
end
|
data/spec/termup_spec.rb
ADDED
data/termup.gemspec
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{termup}
|
8
|
+
s.version = "1.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Kenn Ejima"]
|
12
|
+
s.date = %q{2011-05-15}
|
13
|
+
s.default_executable = %q{termup}
|
14
|
+
s.description = %q{Initialize terminal tabs with preset commands}
|
15
|
+
s.email = %q{kenn.ejima@gmail.com}
|
16
|
+
s.executables = ["termup"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE.txt",
|
19
|
+
"README.md",
|
20
|
+
"README.rdoc"
|
21
|
+
]
|
22
|
+
s.files = [
|
23
|
+
".document",
|
24
|
+
".rspec",
|
25
|
+
"Gemfile",
|
26
|
+
"Gemfile.lock",
|
27
|
+
"LICENSE.txt",
|
28
|
+
"README.md",
|
29
|
+
"README.rdoc",
|
30
|
+
"Rakefile",
|
31
|
+
"VERSION",
|
32
|
+
"bin/termup",
|
33
|
+
"lib/templates/template.yml",
|
34
|
+
"lib/termup.rb",
|
35
|
+
"lib/termup/base.rb",
|
36
|
+
"lib/termup/cli.rb",
|
37
|
+
"spec/spec_helper.rb",
|
38
|
+
"spec/termup_spec.rb",
|
39
|
+
"termup.gemspec"
|
40
|
+
]
|
41
|
+
s.homepage = %q{http://github.com/kenn/termup}
|
42
|
+
s.licenses = ["MIT"]
|
43
|
+
s.require_paths = ["lib"]
|
44
|
+
s.rubygems_version = %q{1.6.2}
|
45
|
+
s.summary = %q{Initialize terminal tabs with preset commands}
|
46
|
+
|
47
|
+
if s.respond_to? :specification_version then
|
48
|
+
s.specification_version = 3
|
49
|
+
|
50
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
51
|
+
s.add_runtime_dependency(%q<rb-appscript>, ["~> 0.6.1"])
|
52
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.6.0"])
|
53
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.13"])
|
54
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.0"])
|
55
|
+
else
|
56
|
+
s.add_dependency(%q<rb-appscript>, ["~> 0.6.1"])
|
57
|
+
s.add_dependency(%q<rspec>, ["~> 2.6.0"])
|
58
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.13"])
|
59
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
|
60
|
+
end
|
61
|
+
else
|
62
|
+
s.add_dependency(%q<rb-appscript>, ["~> 0.6.1"])
|
63
|
+
s.add_dependency(%q<rspec>, ["~> 2.6.0"])
|
64
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.13"])
|
65
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
metadata
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: termup
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 1.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Kenn Ejima
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-05-15 00:00:00 -07:00
|
14
|
+
default_executable: termup
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: rb-appscript
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ~>
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.6.1
|
24
|
+
type: :runtime
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ~>
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 2.6.0
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: bundler
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.0.13
|
46
|
+
type: :development
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: jeweler
|
51
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ~>
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 1.6.0
|
57
|
+
type: :development
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: *id004
|
60
|
+
description: Initialize terminal tabs with preset commands
|
61
|
+
email: kenn.ejima@gmail.com
|
62
|
+
executables:
|
63
|
+
- termup
|
64
|
+
extensions: []
|
65
|
+
|
66
|
+
extra_rdoc_files:
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
- README.rdoc
|
70
|
+
files:
|
71
|
+
- .document
|
72
|
+
- .rspec
|
73
|
+
- Gemfile
|
74
|
+
- Gemfile.lock
|
75
|
+
- LICENSE.txt
|
76
|
+
- README.md
|
77
|
+
- README.rdoc
|
78
|
+
- Rakefile
|
79
|
+
- VERSION
|
80
|
+
- bin/termup
|
81
|
+
- lib/templates/template.yml
|
82
|
+
- lib/termup.rb
|
83
|
+
- lib/termup/base.rb
|
84
|
+
- lib/termup/cli.rb
|
85
|
+
- spec/spec_helper.rb
|
86
|
+
- spec/termup_spec.rb
|
87
|
+
- termup.gemspec
|
88
|
+
has_rdoc: true
|
89
|
+
homepage: http://github.com/kenn/termup
|
90
|
+
licenses:
|
91
|
+
- MIT
|
92
|
+
post_install_message:
|
93
|
+
rdoc_options: []
|
94
|
+
|
95
|
+
require_paths:
|
96
|
+
- lib
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
hash: 4478408603716674738
|
103
|
+
segments:
|
104
|
+
- 0
|
105
|
+
version: "0"
|
106
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: "0"
|
112
|
+
requirements: []
|
113
|
+
|
114
|
+
rubyforge_project:
|
115
|
+
rubygems_version: 1.6.2
|
116
|
+
signing_key:
|
117
|
+
specification_version: 3
|
118
|
+
summary: Initialize terminal tabs with preset commands
|
119
|
+
test_files: []
|
120
|
+
|