zsh_dots 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +25 -0
- data/.gitmodules +3 -0
- data/.rvmrc +47 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +38 -0
- data/README.md +115 -0
- data/Rakefile +9 -0
- data/bin/dots +7 -0
- data/bin/elocal_nightly.sh +12 -0
- data/bin/gbrt +42 -0
- data/bin/git_cwd_info +40 -0
- data/bin/lein +229 -0
- data/bin/reattach-to-user-namespace +0 -0
- data/bin/ssh-copy-id +54 -0
- data/bin/stock +83 -0
- data/config/.dot_file +1 -0
- data/config/aws +0 -0
- data/config/example.aws.zsh +13 -0
- data/config/gemrc +9 -0
- data/config/gitconfig +46 -0
- data/config/railsrc +2 -0
- data/config/rspec +2 -0
- data/config/rvmrc +1 -0
- data/config/screenrc +1 -0
- data/config/tmux.conf +6 -0
- data/config/zlogin +1 -0
- data/config/zshenv +59 -0
- data/config/zshrc +8 -0
- data/etc/mandlebrot.c +59 -0
- data/etc/rails/composer.yml +30 -0
- data/etc/rails/ember_template.rb +60 -0
- data/etc/rails/recipes/haml_views.rb +20 -0
- data/etc/rails/recipes/html5.rb +84 -0
- data/etc/rails/recipes/readme_markdown.rb +87 -0
- data/etc/rails/template.rb +1419 -0
- data/lib/dots/aliases.zsh +40 -0
- data/lib/dots/directories.zsh +28 -0
- data/lib/dots/functions.zsh +41 -0
- data/lib/dots/plugins.zsh +18 -0
- data/lib/dots.sh +11 -0
- data/lib/plugins/aws/aws.plugin.zsh +20 -0
- data/lib/plugins/bundler/_bundler +82 -0
- data/lib/plugins/bundler/bundler.plugin.zsh +7 -0
- data/lib/plugins/git/git.plugin.zsh +126 -0
- data/lib/plugins/git-flow/git-flow.plugin.zsh +340 -0
- data/lib/plugins/knife/_knife +183 -0
- data/lib/plugins/knife/knife.plugin.zsh +1 -0
- data/lib/plugins/macvim/macvim.plugin.zsh +13 -0
- data/lib/plugins/osx/_man-preview +5 -0
- data/lib/plugins/osx/osx.plugin.zsh +101 -0
- data/lib/plugins/rails3/rails3.plugin.zsh +75 -0
- data/lib/plugins/rake/rake.plugin.zsh +6 -0
- data/lib/plugins/ruby/ruby.plugin.zsh +58 -0
- data/lib/ruby/dots/command.rb +58 -0
- data/lib/ruby/dots/dot_file.rb +73 -0
- data/lib/ruby/dots/version.rb +3 -0
- data/lib/ruby/dots.rb +9 -0
- data/lib/tasks/db.rake +55 -0
- data/lib/tasks/dots.rake +32 -0
- data/spec/integration/command_spec.rb +34 -0
- data/spec/models/dot_file_spec.rb +45 -0
- data/spec/spec_helper.rb +6 -0
- data/vendor/antigen.zsh +251 -0
- data/vendor/oh-my-zsh/check_for_upgrade.sh +45 -0
- data/vendor/oh-my-zsh/install.sh +43 -0
- data/vendor/oh-my-zsh/require_tool.sh +161 -0
- data/vendor/oh-my-zsh/uninstall.sh +20 -0
- data/vendor/oh-my-zsh/upgrade.sh +6 -0
- data/zsh_dots.gemspec +28 -0
- metadata +163 -0
data/.gitignore
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
locals.zsh
|
2
|
+
log/.zsh_history
|
3
|
+
projects.zsh
|
4
|
+
cache
|
5
|
+
*.swp
|
6
|
+
config/npmrc
|
7
|
+
config/shsh/**
|
8
|
+
config/ssh/**
|
9
|
+
config/webbynode
|
10
|
+
config/aws.zsh
|
11
|
+
*.gem
|
12
|
+
*.rbc
|
13
|
+
.bundle
|
14
|
+
.config
|
15
|
+
.yardoc
|
16
|
+
Gemfile.lock
|
17
|
+
InstalledFiles
|
18
|
+
_yardoc
|
19
|
+
coverage
|
20
|
+
doc/
|
21
|
+
lib/ruby/bundler/man
|
22
|
+
pkg
|
23
|
+
rdoc
|
24
|
+
spec/reports
|
25
|
+
tmp
|
data/.gitmodules
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1,47 @@
|
|
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/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
dots (0.5.0)
|
5
|
+
activemodel
|
6
|
+
thor
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
activemodel (3.2.8)
|
12
|
+
activesupport (= 3.2.8)
|
13
|
+
builder (~> 3.0.0)
|
14
|
+
activesupport (3.2.8)
|
15
|
+
i18n (~> 0.6)
|
16
|
+
multi_json (~> 1.0)
|
17
|
+
builder (3.0.3)
|
18
|
+
diff-lcs (1.1.3)
|
19
|
+
i18n (0.6.1)
|
20
|
+
multi_json (1.3.6)
|
21
|
+
rake (0.9.2.2)
|
22
|
+
rspec (2.11.0)
|
23
|
+
rspec-core (~> 2.11.0)
|
24
|
+
rspec-expectations (~> 2.11.0)
|
25
|
+
rspec-mocks (~> 2.11.0)
|
26
|
+
rspec-core (2.11.1)
|
27
|
+
rspec-expectations (2.11.3)
|
28
|
+
diff-lcs (~> 1.1.3)
|
29
|
+
rspec-mocks (2.11.3)
|
30
|
+
thor (0.16.0)
|
31
|
+
|
32
|
+
PLATFORMS
|
33
|
+
ruby
|
34
|
+
|
35
|
+
DEPENDENCIES
|
36
|
+
dots!
|
37
|
+
rake
|
38
|
+
rspec
|
data/README.md
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
DOTS
|
2
|
+
====
|
3
|
+
|
4
|
+
DOTS is a framework for ZSH that helps you manage your dot-files, ZSH sugar functionality, and your general shell experience. It began its life as a fork off the popular [Oh My ZSH framework][omz]. It has similar design philosophies and functionality, but different goals. Where Oh My ZSH is meant for new users to get more acclamated with ZSH, DOTS is meant for the slightly more advanced user who wants the built-in functionality of Oh My ZSH but wants additional customization and functionality, such as the copying and synchronization of "dot-files".
|
5
|
+
|
6
|
+
Features
|
7
|
+
--------
|
8
|
+
|
9
|
+
- Modular plugin architecture inspired by [Oh My ZSH][omz], but using Antigen for greater efficiency.
|
10
|
+
Only code that's specific to your repo needs to be in your repo.
|
11
|
+
- Simplified prompt string themeing in the `lib/dots/prompt.zsh` directory.
|
12
|
+
- Configuration persistence via the `persist` command. This copies your dot-files to the **config/**
|
13
|
+
directory and allows you to optionally store them in Git. Add your persisted configs to your fork's
|
14
|
+
`.gitignore` if you don't want them synchronized, and `forget` them when you don't want them symlinked
|
15
|
+
anymore. Keeping your configuration files in a place that's easily accessible with a text editor helps you
|
16
|
+
keep an eye on your configuration.
|
17
|
+
- Aliases for common shell functionality like searching for a running
|
18
|
+
process, opening your text editor, viewing files with a pager, setting
|
19
|
+
the title of the current iTerm tab, [optimizing your OS X environment](osx4h),
|
20
|
+
and much more.
|
21
|
+
|
22
|
+
Installation
|
23
|
+
------------
|
24
|
+
|
25
|
+
### One line install:
|
26
|
+
|
27
|
+
If you really trust me, you can run this simple command in your Terminal to download and install the DOTS framework!
|
28
|
+
|
29
|
+
curl -L https://github.com/tubbo/dots/raw/master/tools/install.sh | sh
|
30
|
+
|
31
|
+
### Manual install:
|
32
|
+
|
33
|
+
For the more paranoid users, here's basically what the above script does:
|
34
|
+
|
35
|
+
git clone git://github.com/tubbo/dots.git ~/.dots
|
36
|
+
ln -s ~/.dots/config/zshrc ~/.zshrc
|
37
|
+
chsh -s /bin/zsh
|
38
|
+
|
39
|
+
Then start (or restart) ZSH by reloading or opening a new terminal window.
|
40
|
+
|
41
|
+
### Problems?
|
42
|
+
|
43
|
+
You *might* need to modify your $PATH in **~/.zshrc** if you're not able to find some
|
44
|
+
commands after switching to **DOTS**.
|
45
|
+
|
46
|
+
Usage
|
47
|
+
-----
|
48
|
+
|
49
|
+
There are a number of commands built-in to the DOTS framework:
|
50
|
+
|
51
|
+
### persist <dot-file>
|
52
|
+
|
53
|
+
You can persist any dot file with DOTS. Simply run this command on the file...it will copy the
|
54
|
+
file to your `$DOTS` folder and symlink that new file in its original place, preserving your
|
55
|
+
settings in a git repository but making it accessible for the application needing to use it.
|
56
|
+
|
57
|
+
### forget <dot-file>
|
58
|
+
|
59
|
+
The opposite of `persist`. Deletes the symlink and restores your file. For when you just need to
|
60
|
+
fuggeddaboutit...
|
61
|
+
|
62
|
+
### osx_for_hackers
|
63
|
+
|
64
|
+
For Mac OS X users, this runs a bunch of settings that I found very helpful for browsing and using
|
65
|
+
my Mac. It's totally optional, but this alias simply runs the `tools/osx.zsh` script.
|
66
|
+
|
67
|
+
Forking
|
68
|
+
-------
|
69
|
+
|
70
|
+
It's recommended that you fork this project so you can store your own custom settings in **config/**, and get the most use out of this framework.
|
71
|
+
|
72
|
+
To do so, click the **Fork** button at the top of this page.
|
73
|
+
|
74
|
+
Then, type the following into your Terminal:
|
75
|
+
|
76
|
+
git remote add <your-github-username> git@github.com:<your-github-username>/dots.git
|
77
|
+
|
78
|
+
And to make sure it works, type
|
79
|
+
|
80
|
+
git pull <your-github-username> master
|
81
|
+
|
82
|
+
We like the follow the convention for fork names set forth in [the hub plugin][hub] by [Chris Wernstrath][cw]. You can feasibly name the fork anything you like.
|
83
|
+
|
84
|
+
You can either modify **tools/upgrade.sh** to `git pull` from your fork and `git push` to your fork after the upgrade is complete to keep it in sync, or do it manually by setting `DISABLE_AUTO_UPDATE="true"` (which is disabled by default in **config/zshrc**).
|
85
|
+
|
86
|
+
Usage
|
87
|
+
-----
|
88
|
+
|
89
|
+
Edit `lib/dots/prompt.zsh` to change your prompt string.
|
90
|
+
|
91
|
+
Type `persist .vimrc` or `forget .vimrc` to either add or remove your configs to the .dots/ directory, wherein they can then be pushed to your GitHub fork.
|
92
|
+
|
93
|
+
License
|
94
|
+
-------
|
95
|
+
|
96
|
+
DOTS is released under **The MIT License**:
|
97
|
+
|
98
|
+
Copyright (c) 2012 Tom Scott
|
99
|
+
|
100
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
101
|
+
|
102
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
103
|
+
|
104
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
105
|
+
|
106
|
+
Contributors
|
107
|
+
------------
|
108
|
+
|
109
|
+
Just me, [@tubbo][twt]
|
110
|
+
|
111
|
+
[omz]: https://github.com/robbyrussell/oh-my-zsh
|
112
|
+
[twt]: https://twitter.com/tubbo
|
113
|
+
[hub]: https://github.com/defunkt/hub
|
114
|
+
[cw]: https://defunkt.io
|
115
|
+
[osx4h]: https://gist.github.com/2260182
|
data/Rakefile
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
require 'rake'
|
3
|
+
require 'rspec/core/rake_task'
|
4
|
+
|
5
|
+
# Global Rake tasks, available anywhere by running `rake -g`
|
6
|
+
Dir["lib/tasks/*.rake"].each { |rake_file| load rake_file }
|
7
|
+
|
8
|
+
# Test task for the local testing suite
|
9
|
+
RSpec::Core::RakeTask.new(:test)
|
data/bin/dots
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/bin/zsh
|
2
|
+
#
|
3
|
+
# Download the latest database from stage.elocal.com and
|
4
|
+
# index the new data with Solr.
|
5
|
+
|
6
|
+
cd /Users/tom/Code/elocal/
|
7
|
+
bundle exec thor db:import:stage
|
8
|
+
bundle exec rake db:migrate
|
9
|
+
bundle exec thor solr:index_accounts
|
10
|
+
bundle exec thor solr:index_categories
|
11
|
+
bundle exec thor solr:index_profiles
|
12
|
+
bundle exec rake email:nightly_db_pull_notification
|
data/bin/gbrt
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
def format_commit_info timestamp, time_desc, commit_id, message, ref_name
|
4
|
+
[
|
5
|
+
"#{timestamp.strftime("%y %b %d")}, #{timestamp.strftime("%l:%M%p").downcase}",
|
6
|
+
"(#{time_desc})",
|
7
|
+
commit_id,
|
8
|
+
message,
|
9
|
+
ref_name
|
10
|
+
]
|
11
|
+
end
|
12
|
+
|
13
|
+
def render_commit_info timestamp, time_desc, commit_id, message, ref_name, merged
|
14
|
+
[
|
15
|
+
timestamp,
|
16
|
+
time_desc,
|
17
|
+
"\e[32m#{ref_name}\e[0m",
|
18
|
+
(merged ? " #{commit_id}" : "+ \e[33m#{commit_id}\e[0m"),
|
19
|
+
"\e[#{message[/^Temp/] ? 31 : 90}m#{message.strip}\e[0m"
|
20
|
+
].join(' ')
|
21
|
+
end
|
22
|
+
|
23
|
+
commit_info = `git branch #{ARGV.join(' ')} | cut -c 3-`.strip.split("\n").reject {|ref_name|
|
24
|
+
ref_name[' -> ']
|
25
|
+
}.map {|ref_name|
|
26
|
+
`git log --no-walk --pretty=format:"%ct\n%cr\n%h\n%s" '#{ref_name}' --`.strip.split("\n").push(ref_name)
|
27
|
+
}.map {|commit_info|
|
28
|
+
[Time.at(commit_info.shift.to_i)].concat(commit_info)
|
29
|
+
}.sort_by {|commit_info|
|
30
|
+
commit_info.first # unix timestamp
|
31
|
+
}.reverse.map {|commit_info|
|
32
|
+
format_commit_info(*commit_info)
|
33
|
+
}.transpose.map {|column|
|
34
|
+
max_col_length = column.sort_by {|i| i.length }.last.length
|
35
|
+
column.map {|i| i.ljust(max_col_length) }
|
36
|
+
}.transpose.map {|commit_info|
|
37
|
+
commit_info.push(
|
38
|
+
`git merge-base HEAD #{commit_info[2]}`.chomp[0...7] == commit_info[2]
|
39
|
+
)
|
40
|
+
}.each {|commit_info|
|
41
|
+
puts render_commit_info(*commit_info)
|
42
|
+
}
|
data/bin/git_cwd_info
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
|
4
|
+
# The methods that get called more than once are memoized.
|
5
|
+
|
6
|
+
def git_repo_path
|
7
|
+
@git_repo_path ||= `git rev-parse --git-dir 2>/dev/null`.strip
|
8
|
+
end
|
9
|
+
|
10
|
+
def in_git_repo
|
11
|
+
!git_repo_path.empty? &&
|
12
|
+
git_repo_path != '~' &&
|
13
|
+
git_repo_path != "#{ENV['HOME']}/.git"
|
14
|
+
end
|
15
|
+
|
16
|
+
def git_parse_branch
|
17
|
+
@git_parse_branch ||= File.read("#{git_repo_path}/HEAD").strip.scan(/(?<=refs\/heads\/).*$/).first
|
18
|
+
end
|
19
|
+
|
20
|
+
def git_head_commit_id
|
21
|
+
`git rev-parse --short HEAD 2>/dev/null`.strip
|
22
|
+
end
|
23
|
+
|
24
|
+
def git_cwd_dirty
|
25
|
+
" %{\e[90m%}✗%{\e[0m%}" unless git_repo_path == '.' || `git ls-files -m`.strip.empty?
|
26
|
+
end
|
27
|
+
|
28
|
+
def rebasing_etc
|
29
|
+
if File.exists?(File.join(git_repo_path, 'BISECT_LOG'))
|
30
|
+
"+bisect"
|
31
|
+
elsif File.exists?(File.join(git_repo_path, 'MERGE_HEAD'))
|
32
|
+
"+merge"
|
33
|
+
elsif %w[rebase rebase-apply rebase-merge ../.dotest].any? {|d| File.exists?(File.join(git_repo_path, d)) }
|
34
|
+
"+rebase"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
if in_git_repo
|
39
|
+
print " %{$fg[cyan]%}#{git_parse_branch}%{$reset_color_with_bg%}@%{$fg[violet]%}#{git_head_commit_id}%{$reset_color_with_bg%}#{rebasing_etc}#{git_cwd_dirty}"
|
40
|
+
end
|
data/bin/lein
ADDED
@@ -0,0 +1,229 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
export LEIN_VERSION="2.0.0-preview6"
|
4
|
+
|
5
|
+
case $LEIN_VERSION in
|
6
|
+
*SNAPSHOT) SNAPSHOT="YES" ;;
|
7
|
+
*) SNAPSHOT="NO" ;;
|
8
|
+
esac
|
9
|
+
|
10
|
+
if [ `id -u` -eq 0 ] && [ "$LEIN_ROOT" = "" ]; then
|
11
|
+
echo "WARNING: You're currently running as root; probably by accident."
|
12
|
+
echo "Press control-C to abort or Enter to continue as root."
|
13
|
+
echo "Set LEIN_ROOT to disable this warning."
|
14
|
+
read _
|
15
|
+
fi
|
16
|
+
|
17
|
+
NOT_FOUND=1
|
18
|
+
ORIGINAL_PWD="$PWD"
|
19
|
+
while [ ! -r "$PWD/project.clj" ] && [ "$PWD" != "/" ] && [ $NOT_FOUND -ne 0 ]
|
20
|
+
do
|
21
|
+
cd ..
|
22
|
+
if [ "$(dirname "$PWD")" = "/" ]; then
|
23
|
+
NOT_FOUND=0
|
24
|
+
cd "$ORIGINAL_PWD"
|
25
|
+
fi
|
26
|
+
done
|
27
|
+
|
28
|
+
export LEIN_HOME=${LEIN_HOME:-"$HOME/.lein"}
|
29
|
+
|
30
|
+
if [ "$OSTYPE" = "cygwin" ]; then
|
31
|
+
export LEIN_HOME=`cygpath -w $LEIN_HOME`
|
32
|
+
fi
|
33
|
+
|
34
|
+
LEIN_JAR="$LEIN_HOME/self-installs/leiningen-$LEIN_VERSION-standalone.jar"
|
35
|
+
|
36
|
+
# normalize $0 on certain BSDs
|
37
|
+
if [ "$(dirname "$0")" = "." ]; then
|
38
|
+
SCRIPT="$(which $(basename "$0"))"
|
39
|
+
else
|
40
|
+
SCRIPT="$0"
|
41
|
+
fi
|
42
|
+
|
43
|
+
# resolve symlinks to the script itself portably
|
44
|
+
while [ -h "$SCRIPT" ] ; do
|
45
|
+
ls=`ls -ld "$SCRIPT"`
|
46
|
+
link=`expr "$ls" : '.*-> \(.*\)$'`
|
47
|
+
if expr "$link" : '/.*' > /dev/null; then
|
48
|
+
SCRIPT="$link"
|
49
|
+
else
|
50
|
+
SCRIPT="$(dirname "$SCRIPT"$)/$link"
|
51
|
+
fi
|
52
|
+
done
|
53
|
+
|
54
|
+
BIN_DIR="$(dirname "$SCRIPT")"
|
55
|
+
|
56
|
+
if [ -r "$BIN_DIR/../src/leiningen/version.clj" ]; then
|
57
|
+
# Running from source checkout
|
58
|
+
LEIN_DIR="$(dirname "$BIN_DIR")"
|
59
|
+
|
60
|
+
# Need to use lein 1.x to bootstrap the leiningen-core library (for aether)
|
61
|
+
if [ "$(ls $LEIN_DIR/leiningen-core/lib/*)" = "" ]; then
|
62
|
+
echo "Leiningen is missing its dependencies."
|
63
|
+
echo "Please see \"Building\" in the README."
|
64
|
+
exit 1
|
65
|
+
fi
|
66
|
+
|
67
|
+
# If project.clj for lein or leiningen-core changes, we must recalculate
|
68
|
+
LAST_PROJECT_CHECKSUM=$(cat "$LEIN_DIR/.lein-project-checksum" 2> /dev/null)
|
69
|
+
PROJECT_CHECKSUM=$(sum "$LEIN_DIR/project.clj" "$LEIN_DIR/leiningen-core/project.clj")
|
70
|
+
if [ "$PROJECT_CHECKSUM" != "$LAST_PROJECT_CHECKSUM" ]; then
|
71
|
+
if [ -r "$LEIN_DIR/.lein-classpath" ]; then
|
72
|
+
rm "$LEIN_DIR/.lein-classpath"
|
73
|
+
fi
|
74
|
+
fi
|
75
|
+
|
76
|
+
# Use bin/lein to calculate its own classpath since src/ and
|
77
|
+
# leiningen-core/lib/*jar suffices to run the classpath task.
|
78
|
+
if [ ! -r "$LEIN_DIR/.lein-classpath" ] && [ "$1" != "classpath" ]; then
|
79
|
+
echo "Recalculating Leiningen's classpath."
|
80
|
+
ORIG_PWD="$PWD"
|
81
|
+
cd "$LEIN_DIR"
|
82
|
+
|
83
|
+
$0 classpath .lein-classpath
|
84
|
+
sum $LEIN_DIR/project.clj $LEIN_DIR/leiningen-core/project.clj > \
|
85
|
+
.lein-project-checksum
|
86
|
+
cd "$ORIG_PWD"
|
87
|
+
fi
|
88
|
+
|
89
|
+
mkdir -p "$LEIN_DIR/target/classes"
|
90
|
+
export LEIN_JVM_OPTS=${LEIN_JVM_OPTS:-"-Dclojure.compile.path=$LEIN_DIR/target/classes"}
|
91
|
+
CLASSPATH="$LEIN_DIR/leiningen-core/src/"
|
92
|
+
CLASSPATH="$CLASSPATH:$LEIN_DIR/leiningen-core/resources/"
|
93
|
+
CLASSPATH="$CLASSPATH:$(cat $LEIN_DIR/.lein-classpath 2> /dev/null)"
|
94
|
+
CLASSPATH="$CLASSPATH:$LEIN_DIR/leiningen-core/lib/*"
|
95
|
+
CLASSPATH="$CLASSPATH:$LEIN_DIR/test:$LEIN_DIR/target/classes"
|
96
|
+
CLASSPATH="$CLASSPATH:$LEIN_DIR/src:$LEIN_DIR/resources:$LEIN_JAR"
|
97
|
+
if [ -f .lein-classpath ]; then
|
98
|
+
CLASSPATH="`cat .lein-classpath`:$CLASSPATH"
|
99
|
+
fi
|
100
|
+
else # Not running from a checkout
|
101
|
+
# apply context specific CLASSPATH entries
|
102
|
+
if [ -f .lein-classpath ]; then
|
103
|
+
CLASSPATH="`cat .lein-classpath`:$LEIN_JAR"
|
104
|
+
else
|
105
|
+
CLASSPATH="$LEIN_JAR"
|
106
|
+
fi
|
107
|
+
|
108
|
+
export LEIN_JVM_OPTS=${LEIN_JVM_OPTS:-"-Xbootclasspath/a:$LEIN_JAR"}
|
109
|
+
|
110
|
+
if [ ! -r "$LEIN_JAR" -a "$1" != "self-install" ]; then
|
111
|
+
"$0" self-install
|
112
|
+
fi
|
113
|
+
fi
|
114
|
+
|
115
|
+
HTTP_CLIENT=${HTTP_CLIENT:-"wget -O"}
|
116
|
+
if type -p curl >/dev/null 2>&1; then
|
117
|
+
if [ "$https_proxy" != "" ]; then
|
118
|
+
CURL_PROXY="-x $https_proxy"
|
119
|
+
fi
|
120
|
+
HTTP_CLIENT="curl $CURL_PROXY -f -L -o"
|
121
|
+
fi
|
122
|
+
|
123
|
+
export JAVA_CMD=${JAVA_CMD:-"java"}
|
124
|
+
export LEIN_JAVA_CMD=${LEIN_JAVA_CMD:-$JAVA_CMD}
|
125
|
+
|
126
|
+
# Support $JAVA_OPTS for backwards-compatibility.
|
127
|
+
export JVM_OPTS="${JVM_OPTS:-"$JAVA_OPTS"}"
|
128
|
+
|
129
|
+
# TODO: investigate http://skife.org/java/unix/2011/06/20/really_executable_jars.html
|
130
|
+
# If you're packaging this for a package manager (.deb, homebrew, etc)
|
131
|
+
# you need to remove the self-install and upgrade functionality or see lein-pkg.
|
132
|
+
if [ "$1" = "self-install" ]; then
|
133
|
+
if [ -r "$LEIN_JAR" ]; then
|
134
|
+
echo "The self-install jar already exists at $LEIN_JAR."
|
135
|
+
echo "If you wish to re-download, delete it and rerun \"$0 self-install\"."
|
136
|
+
exit 1
|
137
|
+
fi
|
138
|
+
echo "Downloading Leiningen now..."
|
139
|
+
LEIN_DIR=`dirname "$LEIN_JAR"`
|
140
|
+
mkdir -p "$LEIN_DIR"
|
141
|
+
LEIN_URL="https://github.com/downloads/technomancy/leiningen/leiningen-$LEIN_VERSION-standalone.jar"
|
142
|
+
$HTTP_CLIENT "$LEIN_JAR" "$LEIN_URL"
|
143
|
+
if [ $? != 0 ]; then
|
144
|
+
echo "Failed to download $LEIN_URL"
|
145
|
+
echo "If you have an old version of libssl you may not have the correct"
|
146
|
+
echo "certificate authority. Either upgrade or set HTTP_CLIENT to insecure:"
|
147
|
+
echo " export HTTP_CLIENT=\"wget --no-check-certificate -O\" # or"
|
148
|
+
echo " export HTTP_CLIENT=\"curl --insecure -f -L -o"
|
149
|
+
if [ $SNAPSHOT = "YES" ]; then
|
150
|
+
echo "If you have Maven installed, you can do"
|
151
|
+
echo "mvn dependency:copy-dependencies; mv target/dependency lib"
|
152
|
+
echo "See README.md for further SNAPSHOT build instructions."
|
153
|
+
fi
|
154
|
+
rm $LEIN_JAR 2> /dev/null
|
155
|
+
exit 1
|
156
|
+
fi
|
157
|
+
elif [ "$1" = "upgrade" ]; then
|
158
|
+
if [ "$LEIN_DIR" != "" ]; then
|
159
|
+
echo "The upgrade task is not meant to be run from a checkout."
|
160
|
+
exit 1
|
161
|
+
fi
|
162
|
+
if [ $SNAPSHOT = "YES" ]; then
|
163
|
+
echo "The upgrade task is only meant for stable releases."
|
164
|
+
echo "See the \"Hacking\" section of the README."
|
165
|
+
exit 1
|
166
|
+
fi
|
167
|
+
if [ ! -w "$SCRIPT" ]; then
|
168
|
+
echo "You do not have permission to upgrade the installation in $SCRIPT"
|
169
|
+
exit 1
|
170
|
+
else
|
171
|
+
TARGET_VERSION="${2:-"preview"}"
|
172
|
+
echo "The script at $SCRIPT will be upgraded to the latest $TARGET_VERSION version."
|
173
|
+
echo -n "Do you want to continue [Y/n]? "
|
174
|
+
read RESP
|
175
|
+
case "$RESP" in
|
176
|
+
y|Y|"")
|
177
|
+
echo
|
178
|
+
echo "Upgrading..."
|
179
|
+
TARGET="/tmp/lein-$$-upgrade"
|
180
|
+
if ["$OSTYPE" = "cygwin" ]; then
|
181
|
+
TARGET=`cygpath -w $TARGET`
|
182
|
+
fi
|
183
|
+
LEIN_SCRIPT_URL="https://github.com/technomancy/leiningen/raw/$TARGET_VERSION/bin/lein"
|
184
|
+
$HTTP_CLIENT "$TARGET" "$LEIN_SCRIPT_URL" \
|
185
|
+
&& mv "$TARGET" "$SCRIPT" \
|
186
|
+
&& chmod +x "$SCRIPT" \
|
187
|
+
&& echo && "$SCRIPT" self-install && echo && echo "Now running" `$SCRIPT version`
|
188
|
+
exit $?;;
|
189
|
+
*)
|
190
|
+
echo "Aborted."
|
191
|
+
exit 1;;
|
192
|
+
esac
|
193
|
+
fi
|
194
|
+
else
|
195
|
+
if [ "$OSTYPE" = "cygwin" ]; then
|
196
|
+
# When running on Cygwin, use Windows-style paths for java
|
197
|
+
ORIGINAL_PWD=`cygpath -w "$ORIGINAL_PWD"`
|
198
|
+
CLASSPATH=`cygpath -wp "$CLASSPATH"`
|
199
|
+
fi
|
200
|
+
|
201
|
+
if [ $DEBUG ]; then
|
202
|
+
echo "Classpath: $CLASSPATH"
|
203
|
+
fi
|
204
|
+
|
205
|
+
TRAMPOLINE_FILE="/tmp/lein-trampoline-$$"
|
206
|
+
if [ "$OSTYPE" = "cygwin" ]; then
|
207
|
+
TRAMPOLINE_FILE=`cygpath -w $TRAMPOLINE_FILE`
|
208
|
+
fi
|
209
|
+
|
210
|
+
$LEIN_JAVA_CMD \
|
211
|
+
-client -XX:+TieredCompilation \
|
212
|
+
$LEIN_JVM_OPTS \
|
213
|
+
-Dfile.encoding=UTF-8 \
|
214
|
+
-Dmaven.wagon.http.ssl.easy=false \
|
215
|
+
-Dleiningen.original.pwd="$ORIGINAL_PWD" \
|
216
|
+
-Dleiningen.trampoline-file=$TRAMPOLINE_FILE \
|
217
|
+
-cp "$CLASSPATH" \
|
218
|
+
clojure.main -m leiningen.core.main "$@"
|
219
|
+
|
220
|
+
EXIT_CODE=$?
|
221
|
+
|
222
|
+
if [ -r $TRAMPOLINE_FILE ]; then
|
223
|
+
TRAMPOLINE="$(cat $TRAMPOLINE_FILE)"
|
224
|
+
rm $TRAMPOLINE_FILE
|
225
|
+
exec sh -c "exec $TRAMPOLINE"
|
226
|
+
else
|
227
|
+
exit $EXIT_CODE
|
228
|
+
fi
|
229
|
+
fi
|
Binary file
|
data/bin/ssh-copy-id
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# Shell script to install your public key on a remote machine
|
4
|
+
# Takes the remote machine name as an argument.
|
5
|
+
# Obviously, the remote machine must accept password authentication,
|
6
|
+
# or one of the other keys in your ssh-agent, for this to work.
|
7
|
+
|
8
|
+
ID_FILE="${HOME}/.ssh/id_rsa.pub"
|
9
|
+
|
10
|
+
if [ "-i" = "$1" ]; then
|
11
|
+
shift
|
12
|
+
# check if we have 2 parameters left, if so the first is the new ID file
|
13
|
+
if [ -n "$2" ]; then
|
14
|
+
if expr "$1" : ".*\.pub" > /dev/null ; then
|
15
|
+
ID_FILE="$1"
|
16
|
+
else
|
17
|
+
ID_FILE="$1.pub"
|
18
|
+
fi
|
19
|
+
shift # and this should leave $1 as the target name
|
20
|
+
fi
|
21
|
+
else
|
22
|
+
if [ x$SSH_AUTH_SOCK != x ] && ssh-add -L >/dev/null 2>&1; then
|
23
|
+
GET_ID="$GET_ID ssh-add -L"
|
24
|
+
fi
|
25
|
+
fi
|
26
|
+
|
27
|
+
if [ -z "`eval $GET_ID`" ] && [ -r "${ID_FILE}" ] ; then
|
28
|
+
GET_ID="cat ${ID_FILE}"
|
29
|
+
fi
|
30
|
+
|
31
|
+
if [ -z "`eval $GET_ID`" ]; then
|
32
|
+
echo "$0: ERROR: No identities found" >&2
|
33
|
+
exit 1
|
34
|
+
fi
|
35
|
+
|
36
|
+
if [ "$#" -lt 1 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
|
37
|
+
echo "Usage: $0 [-i [identity_file]] [user@]machine" >&2
|
38
|
+
exit 1
|
39
|
+
fi
|
40
|
+
|
41
|
+
# strip any trailing colon
|
42
|
+
host=`echo $1 | sed 's/:$//'`
|
43
|
+
|
44
|
+
{ eval "$GET_ID" ; } | ssh $host "umask 077; test -d ~/.ssh || mkdir ~/.ssh ; cat >> ~/.ssh/authorized_keys" || exit 1
|
45
|
+
|
46
|
+
cat <<EOF
|
47
|
+
Now try logging into the machine, with "ssh '$host'", and check in:
|
48
|
+
|
49
|
+
~/.ssh/authorized_keys
|
50
|
+
|
51
|
+
to make sure we haven't added extra keys that you weren't expecting.
|
52
|
+
|
53
|
+
EOF
|
54
|
+
|