zsh_dots 0.5.1 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.gitmodules +3 -3
- data/Gemfile.lock +7 -7
- data/README.md +31 -23
- data/Rakefile +21 -4
- data/bin/elocal_nightly.sh +12 -6
- data/bin/loggly +166 -0
- data/bin/repl.sh +6 -0
- data/config/Gemfile +19 -0
- data/config/bundle/config +3 -0
- data/config/gemrc +0 -1
- data/config/gitconfig +9 -5
- data/config/gitignore +102 -0
- data/config/muttrc.example +79 -0
- data/config/osx.zsh +162 -0
- data/config/railsrc +1 -1
- data/config/rspec +1 -2
- data/config/vimrc +320 -0
- data/config/zshenv +26 -9
- data/config/zshrc +14 -0
- data/etc/rails/template/.env +2 -0
- data/etc/rails/template/.travis.yml +27 -0
- data/etc/rails/template.rb +28 -1401
- data/lib/dots/aliases.zsh +48 -23
- data/lib/dots/directories.zsh +0 -4
- data/lib/dots/functions.zsh +62 -17
- data/lib/dots/plugins.zsh +18 -11
- data/lib/plugins/git/git.plugin.zsh +11 -18
- data/lib/plugins/git-process/git-process.plugin.zsh +20 -0
- data/lib/plugins/osx/osx.plugin.zsh +3 -1
- data/lib/plugins/rails3/rails3.plugin.zsh +1 -1
- data/lib/plugins/ruby/ruby.plugin.zsh +8 -5
- data/lib/ruby/dots/bootstrap.rb +56 -0
- data/lib/ruby/dots/command.rb +28 -49
- data/lib/ruby/dots/installation.rb +53 -0
- data/lib/ruby/dots/installer.rb +2 -0
- data/lib/ruby/dots/persistence.rb +41 -0
- data/lib/ruby/dots/version.rb +1 -1
- data/lib/ruby/dots.rb +33 -3
- data/{config/aws → lib/tasks/.gitkeep} +0 -0
- data/spec/integration/command_spec.rb +3 -3
- metadata +42 -18
- data/.rvmrc +0 -47
- data/config/.dot_file +0 -1
- data/config/rvmrc +0 -1
- data/config/zlogin +0 -1
- data/lib/plugins/aws/aws.plugin.zsh +0 -20
- data/lib/tasks/db.rake +0 -55
- data/lib/tasks/dots.rake +0 -32
- data/vendor/antigen.zsh +0 -251
@@ -8,7 +8,7 @@ describe Dots::Command do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
describe "persist PATH" do
|
11
|
-
|
11
|
+
subject { %x(./bin/dots persist ~/.dot_file) }
|
12
12
|
|
13
13
|
it "copies the file to the dots repo" do
|
14
14
|
subject.should_not be_blank
|
@@ -16,7 +16,7 @@ describe Dots::Command do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
describe "forget PATH" do
|
19
|
-
|
19
|
+
subject { %x(./bin/dots forget ~/.dot_file) }
|
20
20
|
|
21
21
|
it "restores the file to its original location" do
|
22
22
|
subject.should_not be_blank
|
@@ -24,7 +24,7 @@ describe Dots::Command do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
describe "bare invocation" do
|
27
|
-
|
27
|
+
subject { %x(./bin/dots) }
|
28
28
|
|
29
29
|
it "shows usage information" do
|
30
30
|
subject.should_not be_blank
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zsh_dots
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.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: 2012-
|
12
|
+
date: 2012-12-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: activemodel
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: rake
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,7 +53,12 @@ dependencies:
|
|
43
53
|
version: '0'
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
47
62
|
description: DOTS is an advanced ZSH framework.
|
48
63
|
email:
|
49
64
|
- tubbo@psychedeli.ca
|
@@ -53,7 +68,9 @@ executables:
|
|
53
68
|
- gbrt
|
54
69
|
- git_cwd_info
|
55
70
|
- lein
|
71
|
+
- loggly
|
56
72
|
- reattach-to-user-namespace
|
73
|
+
- repl.sh
|
57
74
|
- ssh-copy-id
|
58
75
|
- stock
|
59
76
|
extensions: []
|
@@ -61,7 +78,6 @@ extra_rdoc_files: []
|
|
61
78
|
files:
|
62
79
|
- .gitignore
|
63
80
|
- .gitmodules
|
64
|
-
- .rvmrc
|
65
81
|
- Gemfile
|
66
82
|
- Gemfile.lock
|
67
83
|
- README.md
|
@@ -71,20 +87,24 @@ files:
|
|
71
87
|
- bin/gbrt
|
72
88
|
- bin/git_cwd_info
|
73
89
|
- bin/lein
|
90
|
+
- bin/loggly
|
74
91
|
- bin/reattach-to-user-namespace
|
92
|
+
- bin/repl.sh
|
75
93
|
- bin/ssh-copy-id
|
76
94
|
- bin/stock
|
77
|
-
- config
|
78
|
-
- config/
|
95
|
+
- config/Gemfile
|
96
|
+
- config/bundle/config
|
79
97
|
- config/example.aws.zsh
|
80
98
|
- config/gemrc
|
81
99
|
- config/gitconfig
|
100
|
+
- config/gitignore
|
101
|
+
- config/muttrc.example
|
102
|
+
- config/osx.zsh
|
82
103
|
- config/railsrc
|
83
104
|
- config/rspec
|
84
|
-
- config/rvmrc
|
85
105
|
- config/screenrc
|
86
106
|
- config/tmux.conf
|
87
|
-
- config/
|
107
|
+
- config/vimrc
|
88
108
|
- config/zshenv
|
89
109
|
- config/zshrc
|
90
110
|
- etc/mandlebrot.c
|
@@ -94,15 +114,17 @@ files:
|
|
94
114
|
- etc/rails/recipes/html5.rb
|
95
115
|
- etc/rails/recipes/readme_markdown.rb
|
96
116
|
- etc/rails/template.rb
|
117
|
+
- etc/rails/template/.env
|
118
|
+
- etc/rails/template/.travis.yml
|
97
119
|
- lib/dots.sh
|
98
120
|
- lib/dots/aliases.zsh
|
99
121
|
- lib/dots/directories.zsh
|
100
122
|
- lib/dots/functions.zsh
|
101
123
|
- lib/dots/plugins.zsh
|
102
|
-
- lib/plugins/aws/aws.plugin.zsh
|
103
124
|
- lib/plugins/bundler/_bundler
|
104
125
|
- lib/plugins/bundler/bundler.plugin.zsh
|
105
126
|
- lib/plugins/git-flow/git-flow.plugin.zsh
|
127
|
+
- lib/plugins/git-process/git-process.plugin.zsh
|
106
128
|
- lib/plugins/git/git.plugin.zsh
|
107
129
|
- lib/plugins/knife/_knife
|
108
130
|
- lib/plugins/knife/knife.plugin.zsh
|
@@ -113,15 +135,17 @@ files:
|
|
113
135
|
- lib/plugins/rake/rake.plugin.zsh
|
114
136
|
- lib/plugins/ruby/ruby.plugin.zsh
|
115
137
|
- lib/ruby/dots.rb
|
138
|
+
- lib/ruby/dots/bootstrap.rb
|
116
139
|
- lib/ruby/dots/command.rb
|
117
140
|
- lib/ruby/dots/dot_file.rb
|
141
|
+
- lib/ruby/dots/installation.rb
|
142
|
+
- lib/ruby/dots/installer.rb
|
143
|
+
- lib/ruby/dots/persistence.rb
|
118
144
|
- lib/ruby/dots/version.rb
|
119
|
-
- lib/tasks
|
120
|
-
- lib/tasks/dots.rake
|
145
|
+
- lib/tasks/.gitkeep
|
121
146
|
- spec/integration/command_spec.rb
|
122
147
|
- spec/models/dot_file_spec.rb
|
123
148
|
- spec/spec_helper.rb
|
124
|
-
- vendor/antigen.zsh
|
125
149
|
- vendor/oh-my-zsh/check_for_upgrade.sh
|
126
150
|
- vendor/oh-my-zsh/install.sh
|
127
151
|
- vendor/oh-my-zsh/require_tool.sh
|
@@ -148,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
172
|
version: '0'
|
149
173
|
requirements: []
|
150
174
|
rubyforge_project:
|
151
|
-
rubygems_version: 1.8.
|
175
|
+
rubygems_version: 1.8.23
|
152
176
|
signing_key:
|
153
177
|
specification_version: 3
|
154
178
|
summary: DOTS is an advanced ZSH framework. It abstracts a lot of hard-to-remember
|
data/.rvmrc
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
#
|
3
|
-
# WARNING
|
4
|
-
#
|
5
|
-
# THIS IS NOT YOUR ~/.rvmrc FILE!!!
|
6
|
-
#
|
7
|
-
# That file is located in ~/.dots/config/rvmrc. Please go there to edit your global RVM changes.
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
# This is an RVM Project .rvmrc file, used to automatically load the ruby
|
17
|
-
# development environment upon cd'ing into the directory
|
18
|
-
|
19
|
-
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
|
20
|
-
# Only full ruby name is supported here, for short names use:
|
21
|
-
# echo "rvm use 1.9.3" > .rvmrc
|
22
|
-
environment_id="ruby-1.9.3-p125@global"
|
23
|
-
|
24
|
-
# Uncomment the following lines if you want to verify rvm version per project
|
25
|
-
# rvmrc_rvm_version="1.12.5 (stable)" # 1.10.1 seams as a safe start
|
26
|
-
# eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
|
27
|
-
# echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
|
28
|
-
# return 1
|
29
|
-
# }
|
30
|
-
|
31
|
-
# First we attempt to load the desired environment directly from the environment
|
32
|
-
# file. This is very fast and efficient compared to running through the entire
|
33
|
-
# CLI and selector. If you want feedback on which environment was used then
|
34
|
-
# insert the word 'use' after --create as this triggers verbose mode.
|
35
|
-
if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
|
36
|
-
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
|
37
|
-
then
|
38
|
-
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
|
39
|
-
[[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
|
40
|
-
\. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
|
41
|
-
else
|
42
|
-
# If the environment file has not yet been created, use the RVM CLI to select.
|
43
|
-
rvm --create "$environment_id" || {
|
44
|
-
echo "Failed to create RVM environment '${environment_id}'."
|
45
|
-
return 1
|
46
|
-
}
|
47
|
-
fi
|
data/config/.dot_file
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
This is my config
|
data/config/rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm_trust_rvmrcs_flag=1
|
data/config/zlogin
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
|
@@ -1,20 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Amazon AWS Dev Tools
|
3
|
-
#
|
4
|
-
|
5
|
-
# Used by all CLI tools produced by Amazon
|
6
|
-
export JAVA_HOME="$(/usr/libexec/java_home)"
|
7
|
-
export EC2_PRIVATE_KEY="$(/bin/ls "$HOME"/.ec2/pk-*.pem | /usr/bin/head -1)"
|
8
|
-
export EC2_CERT="$(/bin/ls "$HOME"/.ec2/cert-*.pem | /usr/bin/head -1)"
|
9
|
-
|
10
|
-
# ec2-dev-tools
|
11
|
-
export EC2_HOME="/usr/local/Library/LinkedKegs/ec2-api-tools/jars"
|
12
|
-
|
13
|
-
# ec2-ami-tools
|
14
|
-
export EC2_AMITOOL_HOME="/usr/local/Library/LinkedKegs/ec2-ami-tools/jars"
|
15
|
-
|
16
|
-
# aws-sns-cli
|
17
|
-
export AWS_SNS_HOME="/usr/local/Library/LinkedKegs/aws-sns-cli/jars"
|
18
|
-
|
19
|
-
# Further AWS configuration that must be hidden from Git.
|
20
|
-
source "$ZSH/config/aws.zsh"
|
data/lib/tasks/db.rake
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
require 'logger'
|
2
|
-
require 'fileutils'
|
3
|
-
|
4
|
-
namespace :db do
|
5
|
-
HOME = ENV['HOME']
|
6
|
-
EMAIL = ENV['EMAIL'] || "tubbo@psychedeli.ca"
|
7
|
-
DRY_RUN = ENV['DRY_RUN'] || false
|
8
|
-
RAILS_ENV = ENV['RAILS_ENV'] || "stage"
|
9
|
-
|
10
|
-
desc "Import the eLocal stage database and send an email when it's done."
|
11
|
-
task :import do
|
12
|
-
puts "Writing logs to #{HOME}/log/tasklog"
|
13
|
-
sh "cat /dev/null > #{HOME}/log/tasklog"
|
14
|
-
logger = Logger.new("#{HOME}/log/tasklog")
|
15
|
-
logger.formatter = proc do |severity, datetime, progname, msg|
|
16
|
-
puts msg
|
17
|
-
"#{severity}: #{msg}\n"
|
18
|
-
end
|
19
|
-
|
20
|
-
logger.info "Entering eLocal app directory"
|
21
|
-
cd "#{HOME}/Code/elocal"
|
22
|
-
|
23
|
-
logger.info "Importing #{RAILS_ENV} database content"
|
24
|
-
sh "bundle exec thor db:import:#{RAILS_ENV} > /dev/null" unless DRY_RUN
|
25
|
-
logger.info "..done"
|
26
|
-
|
27
|
-
logger.info "Migrating database structure"
|
28
|
-
sh "bundle exec rake db:migrate > log/tasklog" unless DRY_RUN
|
29
|
-
logger.info "..done"
|
30
|
-
|
31
|
-
logger.info "Database import complete."
|
32
|
-
|
33
|
-
logger.info "Indexing accounts"
|
34
|
-
sh "bundle exec thor solr:index_accounts > /dev/null" unless DRY_RUN
|
35
|
-
logger.info "..done"
|
36
|
-
|
37
|
-
logger.info "Indexing categories"
|
38
|
-
sh "bundle exec thor solr:index_categories > /dev/null" unless DRY_RUN
|
39
|
-
logger.info "..done"
|
40
|
-
|
41
|
-
logger.info "Indexing profiles"
|
42
|
-
sh "bundle exec thor solr:index_profiles > /dev/null" unless DRY_RUN
|
43
|
-
logger.info "..done"
|
44
|
-
|
45
|
-
logger.info "Solr index complete."
|
46
|
-
|
47
|
-
puts "Building email notification to '#{EMAIL}'"
|
48
|
-
raw_log = IO.read("#{HOME}/log/tasklog")
|
49
|
-
logs = "<code><pre>#{raw_log}</pre></code>"
|
50
|
-
subject = "#{RAILS_ENV.capitalize} database import succeeded."
|
51
|
-
body = "<p>Successfully imported the eLocal #{RAILS_ENV} database to playa.</p><p>#{logs}</p>"
|
52
|
-
sh %x(echo 'To: tubbo@psychedeli.ca\nSubject: #{subject}\nContent-Type: text/html;charset="us-ascii"\n\n<html><body>#{body}</body></html>' | sendmail -t)
|
53
|
-
puts "Delivered email notification to '#{EMAIL}'"
|
54
|
-
end
|
55
|
-
end
|
data/lib/tasks/dots.rake
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
task :config do
|
2
|
-
Dir["config/*"].each do |config_file|
|
3
|
-
unless File.directory? config_file
|
4
|
-
config_file.gsub! /config\/|.example/, ""
|
5
|
-
config_file_path = File.expand_path "~/.dots/config/#{config_file}"
|
6
|
-
dot_file_path = File.expand_path "~/.#{config_file}"
|
7
|
-
global_rake_path = File.expand_path "~/.rake"
|
8
|
-
|
9
|
-
if File.exists? dot_file_path
|
10
|
-
puts "Did not symlink #{config_file} since one already exists"
|
11
|
-
else
|
12
|
-
File.symlink config_file_path, dot_file_path
|
13
|
-
puts "Symlinked ~/.#{config_file}"
|
14
|
-
end
|
15
|
-
|
16
|
-
unless File.exists? global_rake_path
|
17
|
-
File.symlink global_rake_path, File.expand_path("~/.dots/lib/tasks")
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
puts "Please reload your DOTS."
|
22
|
-
end
|
23
|
-
|
24
|
-
desc "Update all installed plugins"
|
25
|
-
task :update do
|
26
|
-
sh "cd ~/.dots && git pull origin master"
|
27
|
-
|
28
|
-
antigen_repos = Dir[File.join(File.expand_path("../.antigen/repos"), "*")]
|
29
|
-
antigen_repos.each do |repo|
|
30
|
-
sh "cd #{repo} && git pull origin master"
|
31
|
-
end
|
32
|
-
end
|
data/vendor/antigen.zsh
DELETED
@@ -1,251 +0,0 @@
|
|
1
|
-
#!/bin/zsh
|
2
|
-
#
|
3
|
-
# Antigen is a bundled plugin loader.
|
4
|
-
|
5
|
-
# Each line in this string has the following entries separated by a space
|
6
|
-
# character.
|
7
|
-
# <repo-url>, <plugin-location>, <bundle-type>
|
8
|
-
# FIXME: Is not kept local by zsh!
|
9
|
-
local _ANTIGEN_BUNDLE_RECORD=""
|
10
|
-
|
11
|
-
# Syntaxes
|
12
|
-
# antigen-bundle <url> [<loc>=/]
|
13
|
-
antigen-bundle () {
|
14
|
-
|
15
|
-
# Bundle spec arguments' default values.
|
16
|
-
local url="$ANTIGEN_DEFAULT_REPO_URL"
|
17
|
-
local loc=/
|
18
|
-
local btype=plugin
|
19
|
-
|
20
|
-
# Set spec values based on the positional arguments.
|
21
|
-
local position_args='url loc'
|
22
|
-
local i=1
|
23
|
-
while ! [[ -z $1 || $1 == --*=* ]]; do
|
24
|
-
local arg_name="$(echo "$position_args" | cut -d\ -f$i)"
|
25
|
-
local arg_value="$1"
|
26
|
-
eval "local $arg_name='$arg_value'"
|
27
|
-
shift
|
28
|
-
i=$(($i + 1))
|
29
|
-
done
|
30
|
-
|
31
|
-
# Check if url is just the plugin name. Super short syntax.
|
32
|
-
if [[ "$url" != */* ]]; then
|
33
|
-
loc="plugins/$url"
|
34
|
-
url="$ANTIGEN_DEFAULT_REPO_URL"
|
35
|
-
fi
|
36
|
-
|
37
|
-
# Set spec values from keyword arguments, if any. The remaining arguments
|
38
|
-
# are all assumed to be keyword arguments.
|
39
|
-
while [[ $1 == --*=* ]]; do
|
40
|
-
local arg_name="$(echo "$1" | cut -d= -f1 | sed 's/^--//')"
|
41
|
-
local arg_value="$(echo "$1" | cut -d= -f2)"
|
42
|
-
eval "local $arg_name='$arg_value'"
|
43
|
-
shift
|
44
|
-
done
|
45
|
-
|
46
|
-
# Resolve the url.
|
47
|
-
if [[ $url != git://* && $url != https://* && $url != /* ]]; then
|
48
|
-
url="${url%.git}"
|
49
|
-
url="https://github.com/$url.git"
|
50
|
-
fi
|
51
|
-
|
52
|
-
# Add it to the record.
|
53
|
-
_ANTIGEN_BUNDLE_RECORD="$_ANTIGEN_BUNDLE_RECORD\n$url $loc $btype"
|
54
|
-
|
55
|
-
-antigen-ensure-repo "$url"
|
56
|
-
|
57
|
-
-antigen-load "$url" "$loc" "$btype"
|
58
|
-
|
59
|
-
}
|
60
|
-
|
61
|
-
antigen-bundles () {
|
62
|
-
# Bulk add many bundles at one go. Empty lines and lines starting with a `#`
|
63
|
-
# are ignored. Everything else is given to `antigen-bundle` as is, no
|
64
|
-
# quoting rules applied.
|
65
|
-
|
66
|
-
local line
|
67
|
-
|
68
|
-
grep -v '^\s*$\|^#' | while read line; do
|
69
|
-
# Using `eval` so that we can use the shell-style quoting in each line
|
70
|
-
# piped to `antigen-bundles`.
|
71
|
-
eval "antigen-bundle $line"
|
72
|
-
done
|
73
|
-
}
|
74
|
-
|
75
|
-
antigen-update () {
|
76
|
-
# Update your bundles, i.e., `git pull` in all the plugin repos.
|
77
|
-
-antigen-echo-record | awk '{print $1}' | sort -u | while read url; do
|
78
|
-
-antigen-ensure-repo --update "$url"
|
79
|
-
done
|
80
|
-
}
|
81
|
-
|
82
|
-
-antigen-get-clone-dir () {
|
83
|
-
# Takes a repo url and gives out the path that this url needs to be cloned
|
84
|
-
# to. Doesn't actually clone anything.
|
85
|
-
# TODO: Memoize?
|
86
|
-
echo -n $ADOTDIR/repos/
|
87
|
-
echo "$1" | sed \
|
88
|
-
-e 's/\.git$//' \
|
89
|
-
-e 's./.-SLASH-.g' \
|
90
|
-
-e 's.:.-COLON-.g'
|
91
|
-
}
|
92
|
-
|
93
|
-
-antigen-get-clone-url () {
|
94
|
-
# Takes a repo's clone dir and gives out the repo's original url that was
|
95
|
-
# used to create the given directory path.
|
96
|
-
# TODO: Memoize?
|
97
|
-
echo "$1" | sed \
|
98
|
-
-e "s:^$ADOTDIR/repos/::" \
|
99
|
-
-e 's/$/.git/' \
|
100
|
-
-e 's.-SLASH-./.g' \
|
101
|
-
-e 's.-COLON-.:.g'
|
102
|
-
}
|
103
|
-
|
104
|
-
-antigen-ensure-repo () {
|
105
|
-
|
106
|
-
local update=false
|
107
|
-
if [[ $1 == --update ]]; then
|
108
|
-
update=true
|
109
|
-
shift
|
110
|
-
fi
|
111
|
-
|
112
|
-
local url="$1"
|
113
|
-
local clone_dir="$(-antigen-get-clone-dir $url)"
|
114
|
-
|
115
|
-
if [[ ! -d $clone_dir ]]; then
|
116
|
-
git clone "$url" "$clone_dir"
|
117
|
-
elif $update; then
|
118
|
-
git --git-dir "$clone_dir/.git" --work-tree "$clone_dir" pull
|
119
|
-
fi
|
120
|
-
|
121
|
-
}
|
122
|
-
|
123
|
-
-antigen-load () {
|
124
|
-
|
125
|
-
local url="$1"
|
126
|
-
local location="$(-antigen-get-clone-dir "$url")/$2"
|
127
|
-
local btype="$3"
|
128
|
-
|
129
|
-
if [[ $btype == theme ]]; then
|
130
|
-
|
131
|
-
# Of course, if its a theme, the location would point to the script
|
132
|
-
# file.
|
133
|
-
source "$location"
|
134
|
-
|
135
|
-
else
|
136
|
-
|
137
|
-
# Source the plugin script
|
138
|
-
# FIXME: I don't know. Looks very very ugly. Needs a better
|
139
|
-
# implementation once tests are ready.
|
140
|
-
local script_loc="$(ls "$location" | grep -m1 '.plugin.zsh$')"
|
141
|
-
if [[ -f $script_loc ]]; then
|
142
|
-
# If we have a `*.plugin.zsh`, source it.
|
143
|
-
source "$script_loc"
|
144
|
-
elif [[ ! -z "$(ls "$location" | grep -m1 '.zsh$')" ]]; then
|
145
|
-
# If there is no `*.plugin.zsh` file, source *all* the `*.zsh`
|
146
|
-
# files.
|
147
|
-
for script ($location/*.zsh) source "$script"
|
148
|
-
elif [[ ! -z "$(ls "$location" | grep -m1 '.sh$')" ]]; then
|
149
|
-
# If there are no `*.zsh` files either, we look for and source any
|
150
|
-
# `*.sh` files instead.
|
151
|
-
for script ($location/*.sh) source "$script"
|
152
|
-
fi
|
153
|
-
|
154
|
-
# Add to $fpath, for completion(s)
|
155
|
-
fpath=($location $fpath)
|
156
|
-
|
157
|
-
fi
|
158
|
-
|
159
|
-
}
|
160
|
-
|
161
|
-
antigen-cleanup () {
|
162
|
-
|
163
|
-
if [[ ! -d "$ADOTDIR/repos" || -z "$(ls "$ADOTDIR/repos/")" ]]; then
|
164
|
-
echo "You don't have any bundles."
|
165
|
-
return 0
|
166
|
-
fi
|
167
|
-
|
168
|
-
# Find directores in ADOTDIR/repos, that are not in the bundles record.
|
169
|
-
local unused_clones="$(comm -13 \
|
170
|
-
<(-antigen-echo-record | awk '{print $1}' | sort -u) \
|
171
|
-
<(ls "$ADOTDIR/repos" | while read line; do
|
172
|
-
-antigen-get-clone-url "$line"
|
173
|
-
done))"
|
174
|
-
|
175
|
-
if [[ -z $unused_clones ]]; then
|
176
|
-
echo "You don't have any unidentified bundles."
|
177
|
-
return 0
|
178
|
-
fi
|
179
|
-
|
180
|
-
echo 'You have clones for the following repos, but are not used.'
|
181
|
-
echo "$unused_clones" | sed 's/^/ /'
|
182
|
-
|
183
|
-
echo -n '\nDelete them all? [y/N] '
|
184
|
-
if read -q; then
|
185
|
-
echo
|
186
|
-
echo
|
187
|
-
echo "$unused_clones" | while read url; do
|
188
|
-
echo -n "Deleting clone for $url..."
|
189
|
-
rm -rf "$(-antigen-get-clone-dir $url)"
|
190
|
-
echo ' done.'
|
191
|
-
done
|
192
|
-
else
|
193
|
-
echo
|
194
|
-
echo Nothing deleted.
|
195
|
-
fi
|
196
|
-
}
|
197
|
-
|
198
|
-
antigen-lib () {
|
199
|
-
antigen-bundle --loc=lib
|
200
|
-
}
|
201
|
-
|
202
|
-
antigen-theme () {
|
203
|
-
local name="${1:-robbyrussell}"
|
204
|
-
antigen-bundle --loc=themes/$name.zsh-theme --btype=theme
|
205
|
-
}
|
206
|
-
|
207
|
-
antigen-apply () {
|
208
|
-
# Initialize completion.
|
209
|
-
# TODO: Only load completions if there are any changes to the bundle
|
210
|
-
# repositories.
|
211
|
-
compinit -i
|
212
|
-
}
|
213
|
-
|
214
|
-
antigen-list () {
|
215
|
-
# List all currently installed bundles
|
216
|
-
if [[ -z "$_ANTIGEN_BUNDLE_RECORD" ]]; then
|
217
|
-
echo "You don't have any bundles." >&2
|
218
|
-
return 1
|
219
|
-
else
|
220
|
-
-antigen-echo-record
|
221
|
-
fi
|
222
|
-
}
|
223
|
-
|
224
|
-
# Echo the bundle specs as in the record. The first line is not echoed since it
|
225
|
-
# is a blank line.
|
226
|
-
-antigen-echo-record () {
|
227
|
-
echo "$_ANTIGEN_BUNDLE_RECORD" | sed -n '1!p'
|
228
|
-
}
|
229
|
-
|
230
|
-
-antigen-env-setup () {
|
231
|
-
# Pre-startup initializations
|
232
|
-
-set-default ANTIGEN_DEFAULT_REPO_URL \
|
233
|
-
https://github.com/robbyrussell/oh-my-zsh.git
|
234
|
-
-set-default ADOTDIR $HOME/.antigen
|
235
|
-
|
236
|
-
# Load the compinit module
|
237
|
-
autoload -U compinit
|
238
|
-
|
239
|
-
# Without the following, `compdef` function is not defined.
|
240
|
-
compinit -i
|
241
|
-
}
|
242
|
-
|
243
|
-
# Same as `export $1=$2`, but will only happen if the name specified by `$1` is
|
244
|
-
# not already set.
|
245
|
-
-set-default () {
|
246
|
-
local arg_name="$1"
|
247
|
-
local arg_value="$2"
|
248
|
-
eval "test -z \"\$$arg_name\" && export $arg_name='$arg_value'"
|
249
|
-
}
|
250
|
-
|
251
|
-
-antigen-env-setup
|