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.
Files changed (50) hide show
  1. data/.gitignore +1 -0
  2. data/.gitmodules +3 -3
  3. data/Gemfile.lock +7 -7
  4. data/README.md +31 -23
  5. data/Rakefile +21 -4
  6. data/bin/elocal_nightly.sh +12 -6
  7. data/bin/loggly +166 -0
  8. data/bin/repl.sh +6 -0
  9. data/config/Gemfile +19 -0
  10. data/config/bundle/config +3 -0
  11. data/config/gemrc +0 -1
  12. data/config/gitconfig +9 -5
  13. data/config/gitignore +102 -0
  14. data/config/muttrc.example +79 -0
  15. data/config/osx.zsh +162 -0
  16. data/config/railsrc +1 -1
  17. data/config/rspec +1 -2
  18. data/config/vimrc +320 -0
  19. data/config/zshenv +26 -9
  20. data/config/zshrc +14 -0
  21. data/etc/rails/template/.env +2 -0
  22. data/etc/rails/template/.travis.yml +27 -0
  23. data/etc/rails/template.rb +28 -1401
  24. data/lib/dots/aliases.zsh +48 -23
  25. data/lib/dots/directories.zsh +0 -4
  26. data/lib/dots/functions.zsh +62 -17
  27. data/lib/dots/plugins.zsh +18 -11
  28. data/lib/plugins/git/git.plugin.zsh +11 -18
  29. data/lib/plugins/git-process/git-process.plugin.zsh +20 -0
  30. data/lib/plugins/osx/osx.plugin.zsh +3 -1
  31. data/lib/plugins/rails3/rails3.plugin.zsh +1 -1
  32. data/lib/plugins/ruby/ruby.plugin.zsh +8 -5
  33. data/lib/ruby/dots/bootstrap.rb +56 -0
  34. data/lib/ruby/dots/command.rb +28 -49
  35. data/lib/ruby/dots/installation.rb +53 -0
  36. data/lib/ruby/dots/installer.rb +2 -0
  37. data/lib/ruby/dots/persistence.rb +41 -0
  38. data/lib/ruby/dots/version.rb +1 -1
  39. data/lib/ruby/dots.rb +33 -3
  40. data/{config/aws → lib/tasks/.gitkeep} +0 -0
  41. data/spec/integration/command_spec.rb +3 -3
  42. metadata +42 -18
  43. data/.rvmrc +0 -47
  44. data/config/.dot_file +0 -1
  45. data/config/rvmrc +0 -1
  46. data/config/zlogin +0 -1
  47. data/lib/plugins/aws/aws.plugin.zsh +0 -20
  48. data/lib/tasks/db.rake +0 -55
  49. data/lib/tasks/dots.rake +0 -32
  50. data/vendor/antigen.zsh +0 -251
data/lib/dots/aliases.zsh CHANGED
@@ -1,40 +1,65 @@
1
- # = Aliases
2
- #
3
- # General purpose, time-saving aliases for everyday use.
4
-
5
- # Access the superuser for a single command.
1
+ # System administration
6
2
  alias _='sudo'
7
-
8
- # Show command history.
9
3
  alias history='fc -l 1'
10
-
11
- # Use grep with ack.
12
4
  alias afind='ack-grep -il'
13
5
 
14
- # Reload DOTS after a change.
15
- alias reload="source $HOME/.zshenv; source $HOME/.zshrc"
6
+ # Reload the DOTS framework and clear the screen.
16
7
  alias refresh="reload && clear"
17
-
18
- # Reload TextMate bundles.
19
- alias tmbundle="osascript -e 'tell app \"TextMate\" to reload bundles'"
20
-
21
- # Find all ._* files in the directory and remove them.
22
- alias rmbs="find . -type f -name '._*' -exec rm {} + && echo \"Removed all ._ files\""
23
-
24
- # Make `ed` easier to use.
8
+ alias rmbs="rhombus"
25
9
  alias ed='ed -p "ed> "'
26
10
 
27
11
  # Dotfiles persistence
28
12
  alias persist='dots persist'
13
+ alias pst='persist'
29
14
  alias forget='dots forget'
15
+ alias fgt='forget'
30
16
 
31
17
  # File viewing and editing
32
18
  alias v=$PAGER
19
+ alias e='editor'
33
20
 
34
21
  # Terminal support
35
22
  alias c='clear'
36
- aliasias ti='set_title'
37
- alias o='open .'
23
+ alias ti='set_title'
24
+ alias o='open_file_or_directory'
25
+ alias p='echo'
26
+
27
+ # iOS development
28
+ alias ripple='canary'
29
+
30
+ # Application deployment
31
+ alias dp='bundle exec rain on production'
32
+ alias ds='bundle exec rain on stage'
33
+
34
+ # Language REPLs
35
+ alias rb='ruby'
36
+ alias py='python'
37
+ alias js='node'
38
+ alias json='jsonlint'
39
+
40
+ # Running Ruby tests
41
+ alias t='run_single_test'
42
+ alias rts='rtest_rake'
43
+
44
+ # Kill the first Ruby process.
45
+ alias kill_first_ruby_process="kill -9 `ps -A | grep ruby | awk '{ print $1 }' | head -n 1`"
46
+ alias krp='kill_first_ruby_process'
47
+
48
+ alias fs='foreman start'
49
+ alias reload='dots update'
50
+
51
+ alias guard='nocorrect guard --no-bundler-warning'
52
+ alias rspec='nocorrect rspec'
53
+ alias rain='nocorrect rain'
54
+
55
+ # Kill it with fire
56
+ alias k9='kill -9'
57
+
58
+ # Sane defaults for the `patch` command, reverts a given diff.
59
+ alias revert='patch -R -p1'
60
+
61
+ # Set up Autoenv for this directory.
62
+ alias cfg='source .env'
38
63
 
39
- # Ripple
40
- alias ripple='open /Applications/Google\ Chrome\ Canary.app --args -disable-web-security'
64
+ # Just in case..
65
+ alias dots='nocorrect dots'
@@ -1,7 +1,3 @@
1
- # = Directories
2
- #
3
- # Quick aliases for development endpoints.
4
-
5
1
  # eLocal web application
6
2
  elocal=$HOME/Code/elocal
7
3
  alias elocal='nocorrect elocal'
@@ -1,8 +1,3 @@
1
- # = Functions
2
- #
3
- # New commands that were a bit complicated for simple aliases, or otherwise didn't
4
- # work in the alias world. All kinds of functionality here.
5
-
6
1
  # Installs the "OSX For Hackers" shellscript, which plays with some of the OS X defaults to give you
7
2
  # a faster and more enjoyable experience, albeit with a little less minimalism going on.
8
3
  #
@@ -17,20 +12,42 @@ function proc() {
17
12
  ps -A | grep $1
18
13
  }
19
14
 
20
- # Load the README.md file into mvim as well as the current directory, as defined by the
21
- # functionality of the macvim_drawer plugin. Requires macvim_drawer to be installed,
15
+ # Load the README.md file into mvim as well as the current
16
+ # directory, as defined by the functionality of the
17
+ # macvim_drawer plugin. Requires macvim_drawer to be installed,
22
18
  # regular MacVim will break with this function.
23
- function e() {
24
- if [[ $EDITOR == 'mvim']] && [[ $DRAWER == true ]]; then
25
- if [[ -f "./README.md" ]]; then
26
- mvim README.md
27
- elif [[ -f "./README.rdoc" ]]; then
28
- mvim README.rdoc
29
- else
30
- mvim
31
- fi
19
+ function editor() {
20
+ if (($+DRAWER)); then
21
+ #if [[ -f "./README.md" ]]; then
22
+ #let readme = "README.md"
23
+ #elif [[ -f "./README.rdoc" ]]; then
24
+ #let readme = "README.rdoc"
25
+ #elif [[ -f "./README.textile" ]]; then
26
+ #let readme = "README.textile"
27
+ #elif [[ -f "./README" ]]; then
28
+ #let readme = "README"
29
+ #elif [[ -f "./README.txt" ]]; then
30
+ #let readme = "README.txt"
31
+ #else
32
+ #let readme = ""
33
+ #fi
34
+ fi
35
+
36
+ if (($+VISUAL)); then
37
+ $VISUAL $1
38
+ elif (($+EDITOR)); then
39
+ $EDITOR $1
32
40
  else
33
- $EDITOR
41
+ echo "Please set your \$EDITOR or \$VISUAL before using this command."
42
+ fi
43
+ }
44
+
45
+ # Open the given file, or a directory if no input is given.
46
+ function open_file_or_directory() {
47
+ if [[ $1 != "" ]]; then
48
+ open $1
49
+ else
50
+ open .
34
51
  fi
35
52
  }
36
53
 
@@ -43,3 +60,31 @@ function set_title() {
43
60
  function exit_code() {
44
61
  cat /usr/include/sysexits.h | grep "$1"
45
62
  }
63
+
64
+ # Run a line of AppleScript to reload the bundles in TextMate.
65
+ function tmbundle() {
66
+ osascript -e 'tell app \"TextMate\" to reload bundles'
67
+ }
68
+
69
+ function update_dots() {
70
+ dots update > /dev/null
71
+ }
72
+
73
+ # Reload DOTS after a change.
74
+ function reload_dots() {
75
+ source $HOME/.zshenv
76
+ source $HOME/.zshrc
77
+ echo 'DOTS reloaded!'
78
+ }
79
+
80
+ # Open Google Chrome Canary and disable web
81
+ # security. For iOS developers using Ripple.
82
+ function canary() {
83
+ open /Applications/Google\ Chrome\ Canary.app --args -disable-web-security
84
+ }
85
+
86
+ # Remove TextMate junk from the directory.
87
+ function rhombus() {
88
+ find . -type f -name '._*' -exec rm {} +
89
+ echo "Removed all ._ files"
90
+ }
data/lib/dots/plugins.zsh CHANGED
@@ -1,18 +1,25 @@
1
1
  # Load the plugin architecture
2
- source "$ZSH/vendor/antigen.zsh"
2
+ source "$ZSH/vendor/antigen/antigen.zsh"
3
3
 
4
4
  # Set up the plugin architecture
5
5
  antigen-lib
6
6
 
7
- # Load plugins
8
- antigen-bundle tubbo/dots lib/plugins/aws
9
- antigen-bundle tubbo/dots lib/plugins/bundler
7
+ # Bare Oh My ZSH plugins
10
8
  antigen-bundle cap
11
- antigen-bundle tubbo/dots lib/plugins/git
12
- antigen-bundle tubbo/dots lib/plugins/git-flow
13
- antigen-bundle tubbo/dots lib/plugins/knife
14
- antigen-bundle tubbo/dots lib/plugins/macvim
15
- antigen-bundle tubbo/dots lib/plugins/osx
16
- antigen-bundle tubbo/dots lib/plugins/rails3
17
- antigen-bundle tubbo/dots lib/plugins/ruby
9
+
10
+ # Local modifications to OMZ plugins
11
+ antigen-bundle $HOME/.dots lib/plugins/bundler
12
+ antigen-bundle $HOME/.dots lib/plugins/git
13
+ antigen-bundle $HOME/.dots lib/plugins/git-process
14
+ antigen-bundle $HOME/.dots lib/plugins/knife
15
+ antigen-bundle $HOME/.dots lib/plugins/osx
16
+ antigen-bundle $HOME/.dots lib/plugins/rails3
17
+ antigen-bundle $HOME/.dots lib/plugins/ruby
18
+ antigen-bundle kennethreitz/autoenv
19
+
20
+ # From alternative sources
18
21
  antigen-bundle zsh-users/zsh-syntax-highlighting
22
+ #antigen-bundle kennethreitz/autoenv
23
+
24
+ # Apply loaded plugins to the environment
25
+ antigen-apply
@@ -38,13 +38,13 @@ alias glg='git log --graph --max-count=5'
38
38
  compdef _git glg=git-log
39
39
  alias lol='git lol'
40
40
  compdef _git lol=git-log
41
- alias gss='git status -s'
41
+ alias gsts='git status -s'
42
42
  compdef _git gss=git-status
43
43
  alias ga='git add'
44
44
  compdef _git ga=git-add
45
45
  alias gm='git merge'
46
46
  compdef _git gm=git-merge
47
- alias gls="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative"
47
+ alias gls="git l"
48
48
  compdef _git gls=git-log
49
49
  alias grv='git remote -v'
50
50
  compdef _get grv=git-remote
@@ -62,18 +62,16 @@ alias gts='git reset --soft'
62
62
  compdef _get gt=git-reset
63
63
  alias gthh='git reset --hard HEAD'
64
64
  compdef _get gt=git-reset
65
- alias gs='git pull --rebase && git push'
66
- compdef _get gs=git-pull
67
- compdef _get gs=git-push
68
- alias gsf='git pull --rebase && git push tubbo'
69
- compdef _get gs=git-pull
70
- compdef _get gs=git-push
71
- alias gy='git synchronize'
72
- compdef _get gy=git-synchronize
73
65
  alias garc='ga . && grc'
74
66
  compdef _get garc=git-add
75
67
  compdef _get garc=git-rebase
76
68
 
69
+ # Stash
70
+ alias gs='git stash save'
71
+ compdef _get gsh=git-stash
72
+ alias gsp='git stash pop'
73
+ compdef _get gsh=git-stash
74
+
77
75
  # Merging and Rebasing
78
76
  alias gr='git rebase'
79
77
  compdef _get gg=git-rebase
@@ -97,19 +95,17 @@ compdef _get grv=git-status
97
95
  # Git and svn mix
98
96
  alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
99
97
  compdef git-svn-dcommit-push=git
98
+ alias gvr='git svn rebase'
99
+ alias gvd='git svn dcommit'
100
100
 
101
- alias gsr='git svn rebase'
102
- alias gsd='git svn dcommit'
103
- #
104
101
  # Will return the current branch name
105
102
  # Usage example: git pull origin $(current_branch)
106
- #
107
103
  function current_branch() {
108
104
  ref=$(git symbolic-ref HEAD 2> /dev/null) || return
109
105
  echo ${ref#refs/heads/}
110
106
  }
111
107
 
112
- # these aliases take advantage of the previous function
108
+ # These aliases take advantage of the previous function
113
109
  alias ggpull='git pull origin $(current_branch)'
114
110
  compdef ggpull=git
115
111
  alias ggpush='git push origin $(current_branch)'
@@ -121,6 +117,3 @@ compdef ggpnp=git
121
117
  if (( $+commands[hub] )) ; then
122
118
  function git() {hub "$@"}
123
119
  fi
124
-
125
- # SHIP IT
126
- alias ship='echo ">>> SHIP IT <<<"; git checkout master; git pull --rebase origin master; git merge develop; git push origin master'
@@ -0,0 +1,20 @@
1
+ #!zsh
2
+ #
3
+ # git-process plugin
4
+ # -------------------
5
+ #
6
+ # Shortcuts and other useful sugar that goes well with git-process.
7
+
8
+
9
+ # Create a new feature branch based on the integration branch.
10
+ alias gf='git new-fb'
11
+
12
+ # Gets the latest changes that have happened on the integration branch, then pushes your changes to a "private" branch on the server.
13
+ alias gy='git sync --rebase'
14
+ alias gym='git sync' # because merging should be harder to do than rebasing
15
+
16
+ # Creates a Pull Request for the current branch.
17
+ alias gq='git pull-request'
18
+
19
+ # Rebase against the integration branch, then push to it.
20
+ alias gu='git to-master'
@@ -98,4 +98,6 @@ function trash() {
98
98
  }
99
99
 
100
100
  alias ql='quick-look'
101
- alias osx_for_hackers='source $ZSH/lib/plugins/osx/osx_for_hackers.zsh'
101
+
102
+ # Configure OSX using a modified version of 'OSX for Hackers'.
103
+ alias osx_bootstrap='source $DOTS/config/osx.sh'
@@ -61,7 +61,7 @@ alias rsp='bundle exec foreman start' # Rails Server and Processes
61
61
  # Rake tasks
62
62
  alias rdm='rake db:migrate'
63
63
  alias rdr='rake db:rollback'
64
- alias rdbm='rake db:migrate db:test:clone'
64
+ alias rdbm='rake db:migrate db:test:prepare'
65
65
  alias rt='rake test'
66
66
  alias rtu='rake test:units'
67
67
  alias rtf='rake test:functionals'
@@ -49,10 +49,13 @@ eval "function rtest_bare () {_rbtest_without_rake \$@}"
49
49
  alias rtest='nocorrect rtest_bare'
50
50
  alias rtest_rake='nocorrect rtest_rake'
51
51
 
52
- # Shorthand aliases
53
- alias t='rtest'
54
- alias rts='rtest_rake'
52
+ # Framework-agnostic testing command.
53
+ run_single_test() {
54
+ if [ -f "spec/spec_helper.rb" ]; then
55
+ bundle exec rspec $@;
56
+ else
57
+ rtest $@;
58
+ fi
59
+ }
55
60
 
56
- # Run a ruby script
57
- alias rb='ruby'
58
61
 
@@ -0,0 +1,56 @@
1
+ module Dots
2
+ module Bootstrap
3
+ include Thor::Actions
4
+
5
+ # These are the programs we are going to download from Homebrew.
6
+ PROGRAMS = %w(httpie git ruby)
7
+
8
+ # Install C binaries, Python programs, and other useful tools
9
+ # from Homebrew.
10
+ def install_programs
11
+ if installed? "brew"
12
+ programs_to_install = PROGRAMS.reduce([]) { |programs, program|
13
+ programs << program unless installed? program
14
+ }.join " "
15
+
16
+ system "brew install #{programs_to_install}" \
17
+ unless programs_to_install.empty?
18
+ else
19
+ install_homebrew
20
+ end
21
+ end
22
+
23
+ # Install the latest version of all gems to the global gemset. These
24
+ # gems are configured in +~/.Gemfile+.
25
+ def install_bundle
26
+ system "cd #{Dots::HOME} && #{bundle_install}"
27
+ end
28
+
29
+ private
30
+ def installed? command
31
+ `which #{command}` != ""
32
+ end
33
+
34
+ def bundle_install
35
+ return install_global_gemset if installed? 'bundle'
36
+ "#{install_bundler} #{install_global_gemset}"
37
+ end
38
+
39
+ def install_global_gemset
40
+ "bundle install --gemfile=#{global_gemset}"
41
+ end
42
+
43
+ def install_bundler
44
+ "gem install bundler"
45
+ end
46
+
47
+ # Install the latest version of the Homebrew package manager.
48
+ def install_homebrew
49
+ %x[ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"]
50
+ end
51
+
52
+ def global_gemset
53
+ "#{Dots.root}/config/Gemfile"
54
+ end
55
+ end
56
+ end
@@ -1,45 +1,26 @@
1
+ require 'dots/persistence'
2
+ require 'dots/installation'
3
+ require 'dots/bootstrap'
4
+
1
5
  module Dots
2
6
  class Command < Thor
3
- include FileUtils
4
-
7
+ include Thor::Actions, Dots::Persistence, Dots::Installation, Dots::Bootstrap
5
8
  default_task :usage
6
9
 
7
10
  desc :usage, "Show usage information"
8
11
  def usage
9
- say <<-TEXT
10
-
11
- The DOTS Project
12
-
13
- DOTS is a ZSH Framework for managing your dotfiles and other shell configuration.
14
- It also gives you some nice, sensible defaults and time-saver aliases to better
15
- work with and understand your shell environment.
16
-
17
- The following tasks are meant to help you use the shell more efficiently...
18
-
19
- TEXT
20
-
21
- help
12
+ say Dots::USAGE_INFORMATION and help
22
13
  end
23
14
 
24
- desc :update, "Update DOTS to the latest version"
25
- def update
26
- %x(cd ~/.dots && git pull origin master)
27
- end
28
-
29
- desc :install, "Installs DOTS to ~/.dots and links all of your dotfiles"
15
+ desc :install, "Copies DOTS to your home directory."
16
+ alias install install_framework
30
17
  def install
31
- %x(ln -s #{installation_path} ~/.dots)
32
-
33
- Dir[File.expand_path("~/.dots/config")].each do |config_file|
34
- file_name = File.basename config_file
35
- dot_file = File.expand_path "~/.#{file_name}"
18
+ copy_to_home_directory and link_dot_files
19
+ end
36
20
 
37
- if File.exists? dot_file
38
- say "Skipping #{dot_file} as it already exists. Manually merge and symlink later with `dots persist`."
39
- else
40
- %x(ln -s #{config_file} #{dot_file})
41
- end
42
- end
21
+ desc :update, "Update DOTS, Antigen and all plugins to their latest version."
22
+ def update
23
+ update_the_framework
43
24
  end
44
25
 
45
26
  desc :version, "Show the current version of DOTS"
@@ -47,28 +28,26 @@ The following tasks are meant to help you use the shell more efficiently...
47
28
  say "DOTS version #{Dots::VERSION} - http://tubbo.github.com/dots"
48
29
  end
49
30
 
50
- desc :persist, "Copy a dotfile to .dots/config and symlink the original location"
51
- def persist file_name
52
- dot_file = Dots::DotFile.new file_name
31
+ desc :link, "Symlink your ~/.dots/config into dotfiles"
32
+ def link
33
+ link_dot_files
34
+ end
53
35
 
54
- if dot_file.save
55
- say "#{dot_file} saved to DOTS!"
56
- else
57
- say "Error: #{dot_file} could not be symlinked:"
58
- dot_file.errors.full_messages.each { |msg| say "- #{msg}" }
59
- end
36
+ desc :persist, "Copy a dotfile to .dots/config and symlink the original location"
37
+ alias persist persist_file
38
+ def persist_file name
39
+ persist_dot_file name
60
40
  end
61
41
 
62
42
  desc :forget, "Remove the symlink and restore a dotfile back to its original location"
63
- def forget file_name
64
- dot_file = Dots::DotFile.find file_name
43
+ alias forget forget_file
44
+ def forget_file name
45
+ forget_dot_file name
46
+ end
65
47
 
66
- if dot_file.destroy
67
- say "#{dot_file} is no longer being persisted."
68
- else
69
- say "Error: #{dot_file} could not be forgotten:"
70
- dot_file.errors.full_messages.each { |msg| say "- #{msg}" }
71
- end
48
+ desc :bootstrap, "Install the whole shebang: gems, C programs, Python stuff, DOTS."
49
+ def bootstrap
50
+ install_programs and install_bundle and install_framework
72
51
  end
73
52
  end
74
53
  end
@@ -0,0 +1,53 @@
1
+ # = Dots::Installation
2
+ #
3
+ # These are various tasks that DOTS uses to install itself onto each
4
+ # machine. While most RubyGems are served from its directory in
5
+ # GEM_HOME, DOTS is primarily run from the user's home directory,
6
+ # since a user typically makes all kinds of shell configuration
7
+ # enhancements after installing.
8
+ module Dots
9
+ module Installation
10
+ include Thor::Actions
11
+
12
+ # The Git remote we'll be pulling from. Set this in your +~/.zshenv+
13
+ # to use a different fork of the project.
14
+ REMOTE = ENV['DOTS_REMOTE']
15
+
16
+ # Attempts to update DOTS, but fails if changes are detected
17
+ # in the repo beforehand.
18
+ #
19
+ # The +git ls-files -m+ command will return no results when there
20
+ # are no modified files in the repo. This method blocks DOTS from
21
+ # installing itself overtop of your committed changes, as well as
22
+ # saves the user from an ugly Git error...
23
+ def update_the_framework
24
+ if repo_is_clean?
25
+ pull_from_origin and run 'reload_dots'
26
+ else
27
+ say "You have uncommitted changes in ~/.dots. Please resolve them before updating."
28
+ end
29
+ end
30
+
31
+ def copy_to_home_directory
32
+ system "mkdir -p #{Dots.home} cp -R #{Dots.root} #{Dots.home}"
33
+ end
34
+
35
+ # Fetches and rebases the same code stored in +Dots.root+ to
36
+ # +~/.dots+. This essentially replays your own local changes on
37
+ # top of the official updates to the framework. If you're using
38
+ # a fork, you can set +DOTS_REMOTE+ to the remote's name in
39
+ # origin (this will default to your Github username, by the way).
40
+ def pull_latest_changes
41
+ system "cd #{Dots.home} && #{git_pull}"
42
+ end
43
+
44
+ private
45
+ def repo_is_clean?
46
+ `cd #{Dots.home} && git ls-files -m`.split("\n").empty?
47
+ end
48
+
49
+ def git_pull
50
+ "git pull --rebase #{REMOTE} #{Dots::VERSION}"
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,2 @@
1
+ module Installer
2
+ end
@@ -0,0 +1,41 @@
1
+ module Dots
2
+ module Persistence
3
+ include Thor::Actions
4
+
5
+ # Run through every file in +~/.dots/config+ and symlink them to
6
+ # +~/.+.
7
+ def link_dot_files
8
+ Dir[File.expand_path("~/.dots/config/*")].each do |config_file|
9
+ persist_dot_file config_file
10
+ end
11
+ end
12
+
13
+ # Moves the given +~/.file+ to the repo, while saving its original
14
+ # location. It then symlinks the new location to the old location
15
+ # so applications will continue to run.
16
+ def persist_dot_file file_name
17
+ dot_file = Dots::DotFile.new file_name
18
+
19
+ if dot_file.save
20
+ say "#{dot_file} saved to DOTS!"
21
+ else
22
+ say "Error: #{dot_file} could not be symlinked:"
23
+ dot_file.errors.full_messages.each { |msg| say "- #{msg}" }
24
+ end
25
+ end
26
+
27
+ # Restores the given configuration file that's in the repo back
28
+ # to an unremembered state. Deletes the symlink and places the
29
+ # file back to its perceived original location in +~/.file+.
30
+ def forget_dot_file file_name
31
+ dot_file = Dots::DotFile.find file_name
32
+
33
+ if dot_file.destroy
34
+ say "#{dot_file} is no longer being persisted."
35
+ else
36
+ say "Error: #{dot_file} could not be forgotten:"
37
+ dot_file.errors.full_messages.each { |msg| say "- #{msg}" }
38
+ end
39
+ end
40
+ end
41
+ end
@@ -1,3 +1,3 @@
1
1
  module Dots
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.3"
3
3
  end
data/lib/ruby/dots.rb CHANGED
@@ -1,9 +1,39 @@
1
+ require 'rubygems'
2
+ require 'fileutils'
1
3
  require 'thor'
2
4
  require 'active_model'
3
- require 'fileutils'
4
-
5
5
  require 'dots/dot_file'
6
6
  require 'dots/command'
7
7
  require 'dots/version'
8
+ require 'dots/persistence'
9
+ require 'dots/installation'
10
+
11
+ module Dots
12
+ # The root path of the DOTS gem.
13
+ def self.root
14
+ @root_dir ||= begin
15
+ spec = Gem::Specification.find_by_name 'zsh_dots'
16
+ spec.gem_dir
17
+ end
18
+ end
19
+
20
+ # The home directory of DOTS.
21
+ def self.home
22
+ @home_dir ||= File.expand_path "~/.dots"
23
+ end
24
+
25
+ # Usage information for the DOTS command line tool.
26
+ USAGE_INFORMATION = <<-TEXT
27
+
28
+ The DOTS Project
29
+
30
+ DOTS is a ZSH Framework for managing your dotfiles and other shell configuration.
31
+ It also gives you some nice, sensible defaults and time-saver aliases to better
32
+ work with and understand your shell environment.
33
+
34
+ The following tasks are meant to help you use the shell more efficiently...
35
+
36
+ TEXT
37
+
38
+ end
8
39
 
9
- module Dots; end
File without changes