terminal-profile-manager 0.0.1
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.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/Rakefile +5 -0
- data/bin/tpm +6 -0
- data/code_of_conduct.md +15 -0
- data/lib/terminal-profile-manager.rb +4 -0
- data/lib/terminal-profile-manager/osa_script.rb +5 -0
- data/lib/terminal-profile-manager/profile.rb +55 -0
- data/lib/terminal-profile-manager/profile_controller.rb +33 -0
- data/lib/terminal-profile-manager/profile_view.rb +81 -0
- data/profiles.json +17 -0
- data/terminal-profile-manager.gemspec +14 -0
- metadata +56 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 55fbb3ca6f41e1b0ca1a182d76ed2e3909257f96
|
|
4
|
+
data.tar.gz: 9074c6716f5c0d00e904f24a9923616425d894f7
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: ee7e576a6b772b098130b127675147b29dfe5c4af470aea33a108e25ba0e06e8ac0b041d416132fd29ac63e0fc195027b295c615ae5f5d1d4b6934c11e99ecca
|
|
7
|
+
data.tar.gz: e28435ffd0544353ef2c941f30afeb2bad8a6ef8d8cfedb2c6bc10b9495db87fac7d7cbe978b3956702df9ac604bc83f0ad148660351de0ca3fe3981acce11a5
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015 Blaine Schmeisser
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/Rakefile
ADDED
data/bin/tpm
ADDED
data/code_of_conduct.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Contributor Code of Conduct
|
|
2
|
+
|
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
|
4
|
+
|
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
|
6
|
+
|
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
|
8
|
+
|
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
|
10
|
+
|
|
11
|
+
This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
|
|
12
|
+
|
|
13
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
|
14
|
+
|
|
15
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.1.0, available at [http://contributor-covenant.org/version/1/1/0/](http://contributor-covenant.org/version/1/1/0/)
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
require 'pry'
|
|
3
|
+
|
|
4
|
+
class Profile
|
|
5
|
+
def self.all
|
|
6
|
+
OsaTerminal.run('get name of every settings set').split(', ').map do |profile|
|
|
7
|
+
profile.strip
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.all_remote
|
|
12
|
+
path = File.dirname(__FILE__)
|
|
13
|
+
@remote_all ||= JSON.parse(File.read(path + '/../../profiles.json'))
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def self.current
|
|
17
|
+
OsaTerminal
|
|
18
|
+
.run('get name of current settings of selected tab of front window')
|
|
19
|
+
.strip
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def self.default
|
|
23
|
+
OsaTerminal
|
|
24
|
+
.run('get name of default settings')
|
|
25
|
+
.strip
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def self.install(name, profile_path)
|
|
29
|
+
download_path = File.expand_path("~/.tpm/installed/#{name}.terminal")
|
|
30
|
+
system "mkdir -p #{File.dirname(download_path)}"
|
|
31
|
+
system "curl -L -o #{download_path} #{profile_path}"
|
|
32
|
+
system "open #{download_path}"
|
|
33
|
+
OsaTerminal.run('do script "exit" in window 1')
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def self.get_path(name)
|
|
37
|
+
info = self.all_remote[name]
|
|
38
|
+
info and info['url']
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def use_default(name)
|
|
42
|
+
OsaTerminal
|
|
43
|
+
.run("set default settings to settings set \"#{name}\"")
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def use_current(name)
|
|
47
|
+
OsaTerminal
|
|
48
|
+
.run("set current settings of window 0 to settings set \"#{name}\"")
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def use_all(name)
|
|
52
|
+
OsaTerminal
|
|
53
|
+
.run("set current settings of tabs of windows to settings set \"#{name}\"")
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
class ProfileController
|
|
2
|
+
attr_accessor :arguments, :command, :view
|
|
3
|
+
|
|
4
|
+
def run
|
|
5
|
+
@command = (ARGV.first || :help).downcase.to_sym
|
|
6
|
+
@arguments = ARGV[1..999] || []
|
|
7
|
+
@view = ProfileView.new(arguments)
|
|
8
|
+
if [:help, :list, :use].include?(command)
|
|
9
|
+
view.send(command)
|
|
10
|
+
elsif command == :install
|
|
11
|
+
install
|
|
12
|
+
else
|
|
13
|
+
error "Command '#{command}' not found."
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def install
|
|
18
|
+
name, path = arguments
|
|
19
|
+
path ||= Profile.get_path(name)
|
|
20
|
+
if path
|
|
21
|
+
Profile.install(name, path)
|
|
22
|
+
puts "Installed the '#{name}' terminal profile."
|
|
23
|
+
else
|
|
24
|
+
error "No profile for '#{name}' found. Try using a URL."
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def error(message)
|
|
29
|
+
puts "EXCEPTION: #{message}"
|
|
30
|
+
puts
|
|
31
|
+
view.help
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
class ProfileView
|
|
2
|
+
attr_accessor :args
|
|
3
|
+
|
|
4
|
+
def initialize(args)
|
|
5
|
+
@args = args.map(&:downcase)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def list
|
|
9
|
+
if args.include?('--remote')
|
|
10
|
+
list_remote
|
|
11
|
+
else
|
|
12
|
+
list_local
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def list_local
|
|
17
|
+
current = Profile.current
|
|
18
|
+
default = Profile.default
|
|
19
|
+
puts "Installed Profiles:"
|
|
20
|
+
puts "\n"
|
|
21
|
+
Profile.all.each do |profile|
|
|
22
|
+
if current == profile && default == profile
|
|
23
|
+
print ' =* '
|
|
24
|
+
elsif current == profile
|
|
25
|
+
print ' => '
|
|
26
|
+
elsif default == profile
|
|
27
|
+
print ' * '
|
|
28
|
+
else
|
|
29
|
+
print ' '
|
|
30
|
+
end
|
|
31
|
+
print profile + "\n"
|
|
32
|
+
end
|
|
33
|
+
puts "\n"
|
|
34
|
+
puts "# => current"
|
|
35
|
+
puts "# =* current && default"
|
|
36
|
+
puts "# * default"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def list_remote
|
|
40
|
+
puts "Remote Profiles:"
|
|
41
|
+
all = Profile.all
|
|
42
|
+
Profile.all_remote.each do |name, details|
|
|
43
|
+
next if all.include?(name)
|
|
44
|
+
puts
|
|
45
|
+
puts name + ' - ' + details['author']
|
|
46
|
+
puts details['site']
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def use
|
|
51
|
+
name = args.first
|
|
52
|
+
profile = Profile.new
|
|
53
|
+
unless Profile.all.map(&:downcase).include?(name)
|
|
54
|
+
puts "Theme not installed."
|
|
55
|
+
return
|
|
56
|
+
end
|
|
57
|
+
if args.include?('--default')
|
|
58
|
+
profile.use_default(name)
|
|
59
|
+
puts "Using #{name} as the default profile."
|
|
60
|
+
end
|
|
61
|
+
if args.include?('--all')
|
|
62
|
+
profile.use_all(name)
|
|
63
|
+
puts "Using #{name} as on all open terminals."
|
|
64
|
+
else
|
|
65
|
+
profile.use_current(name)
|
|
66
|
+
puts "Using #{name} as on current terminal."
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def help
|
|
71
|
+
[
|
|
72
|
+
"Tasks:",
|
|
73
|
+
" tpm list [--remote]",
|
|
74
|
+
" tpm use PROFILE [--all] [--default]",
|
|
75
|
+
" tpm install NAME [URL] [--apply] [--default]",
|
|
76
|
+
" tpm help"
|
|
77
|
+
].each do |line|
|
|
78
|
+
puts line
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
data/profiles.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"SolarizedDark": {
|
|
3
|
+
"url": "http://git.io/vGL2t",
|
|
4
|
+
"site": "https://github.com/tomislav/osx-terminal.app-colors-solarized",
|
|
5
|
+
"author": "Tomislav Filipčić"
|
|
6
|
+
},
|
|
7
|
+
"SolarizedLight": {
|
|
8
|
+
"url": "http://git.io/vGLaW",
|
|
9
|
+
"site": "https://github.com/tomislav/osx-terminal.app-colors-solarized",
|
|
10
|
+
"author": "Tomislav Filipčić"
|
|
11
|
+
},
|
|
12
|
+
"Tomorrow": {
|
|
13
|
+
"url": "http://git.io/vGLaB",
|
|
14
|
+
"site": "https://github.com/chriskempson/tomorrow-theme",
|
|
15
|
+
"author": "Chris Kempson"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Gem::Specification.new do |s|
|
|
2
|
+
s.authors = 'Blaine Schmeisser'
|
|
3
|
+
s.name = 'terminal-profile-manager'
|
|
4
|
+
s.email = 'blainesch@gmail.com'
|
|
5
|
+
s.homepage = 'https://github.com/blainesch/terminal-profile-manager'
|
|
6
|
+
s.version = '0.0.1'
|
|
7
|
+
s.summary = 'Automate terminal profile management.'
|
|
8
|
+
s.description = 'Try out new profiles, and setup your mac easier.'
|
|
9
|
+
s.licenses = ['MIT']
|
|
10
|
+
s.require_paths = ['lib', 'bin']
|
|
11
|
+
s.files = `git ls-files`.split("\n")
|
|
12
|
+
s.has_rdoc = false
|
|
13
|
+
s.executables << 'tpm'
|
|
14
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: terminal-profile-manager
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Blaine Schmeisser
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-08-30 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Try out new profiles, and setup your mac easier.
|
|
14
|
+
email: blainesch@gmail.com
|
|
15
|
+
executables:
|
|
16
|
+
- tpm
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- LICENSE
|
|
21
|
+
- Rakefile
|
|
22
|
+
- bin/tpm
|
|
23
|
+
- code_of_conduct.md
|
|
24
|
+
- lib/terminal-profile-manager.rb
|
|
25
|
+
- lib/terminal-profile-manager/osa_script.rb
|
|
26
|
+
- lib/terminal-profile-manager/profile.rb
|
|
27
|
+
- lib/terminal-profile-manager/profile_controller.rb
|
|
28
|
+
- lib/terminal-profile-manager/profile_view.rb
|
|
29
|
+
- profiles.json
|
|
30
|
+
- terminal-profile-manager.gemspec
|
|
31
|
+
homepage: https://github.com/blainesch/terminal-profile-manager
|
|
32
|
+
licenses:
|
|
33
|
+
- MIT
|
|
34
|
+
metadata: {}
|
|
35
|
+
post_install_message:
|
|
36
|
+
rdoc_options: []
|
|
37
|
+
require_paths:
|
|
38
|
+
- lib
|
|
39
|
+
- bin
|
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
41
|
+
requirements:
|
|
42
|
+
- - '>='
|
|
43
|
+
- !ruby/object:Gem::Version
|
|
44
|
+
version: '0'
|
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
46
|
+
requirements:
|
|
47
|
+
- - '>='
|
|
48
|
+
- !ruby/object:Gem::Version
|
|
49
|
+
version: '0'
|
|
50
|
+
requirements: []
|
|
51
|
+
rubyforge_project:
|
|
52
|
+
rubygems_version: 2.0.14
|
|
53
|
+
signing_key:
|
|
54
|
+
specification_version: 4
|
|
55
|
+
summary: Automate terminal profile management.
|
|
56
|
+
test_files: []
|