From 02779015611a171364d62df6c2b55476758f875e Mon Sep 17 00:00:00 2001 From: Joshua Nichols Date: Thu, 4 Mar 2010 00:19:35 -0500 Subject: [PATCH] SPIIIIIKE --- .document | 5 +++++ .gitignore | 39 ++++++++++++++++++++++++++++++++ Gemfile | 18 +++++++++++++++ LICENSE | 20 +++++++++++++++++ README.rdoc | 17 ++++++++++++++ Rakefile | 49 ++++++++++++++++++++++++++++++++++++++++ bin/homesick | 9 ++++++++ lib/homesick.rb | 52 +++++++++++++++++++++++++++++++++++++++++++ spec/homesick_spec.rb | 7 ++++++ spec/spec.opts | 1 + spec/spec_helper.rb | 10 +++++++++ 11 files changed, 227 insertions(+) create mode 100644 .document create mode 100644 .gitignore create mode 100644 Gemfile create mode 100644 LICENSE create mode 100644 README.rdoc create mode 100644 Rakefile create mode 100755 bin/homesick create mode 100644 lib/homesick.rb create mode 100644 spec/homesick_spec.rb create mode 100644 spec/spec.opts create mode 100644 spec/spec_helper.rb diff --git a/.document b/.document new file mode 100644 index 0000000..ecf3673 --- /dev/null +++ b/.document @@ -0,0 +1,5 @@ +README.rdoc +lib/**/*.rb +bin/* +features/**/*.feature +LICENSE diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..194a02c --- /dev/null +++ b/.gitignore @@ -0,0 +1,39 @@ +# rcov generated +coverage + +# rdoc generated +rdoc + +# yard generated +doc +.yardoc + +# jeweler generated +pkg + +# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore: +# +# * Create a file at ~/.gitignore +# * Include files you want ignored +# * Run: git config --global core.excludesfile ~/.gitignore +# +# After doing this, these files will be ignored in all your git projects, +# saving you from having to 'pollute' every project you touch with them +# +# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line) +# +# For MacOS: +# +#.DS_Store +# +# For TextMate +#*.tmproj +#tmtags +# +# For emacs: +#*~ +#\#* +#.\#* +# +# For vim: +#*.swp diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..d663289 --- /dev/null +++ b/Gemfile @@ -0,0 +1,18 @@ +# Add dependencies required to use your gem here. +group :runtime do + #gem 'bundler', '>= 0.9.5' +end + +# Add dependencies to develop your gem here. +# Include everything needed to run rake, tests, features, etc. +group :development do + + gem "rspec", ">= 1.2.9" + + gem "bundler", ">= 0.9.5" + + gem "jeweler", ">= 1.4.0" + + gem "rcov", ">= 0" + +end diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d2e5d86 --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2009 Joshua Nichols + +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: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +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. diff --git a/README.rdoc b/README.rdoc new file mode 100644 index 0000000..3ee760b --- /dev/null +++ b/README.rdoc @@ -0,0 +1,17 @@ += homesick + +Description goes here. + +== Note on Patches/Pull Requests + +* Fork the project. +* Make your feature addition or bug fix. +* Add tests for it. This is important so I don't break it in a + future version unintentionally. +* Commit, do not mess with rakefile, version, or history. + (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull) +* Send me a pull request. Bonus points for topic branches. + +== Copyright + +Copyright (c) 2010 Joshua Nichols. See LICENSE for details. diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..7f721a2 --- /dev/null +++ b/Rakefile @@ -0,0 +1,49 @@ +require 'rubygems' +require 'bundler' +begin + Bundler.setup(:runtime, :development) +rescue Bundler::BundlerError => e + $stderr.puts e.message + $stderr.puts "Run `bundle install` to install missing gems" + exit e.status_code +end +require 'rake' + +require 'jeweler' +Jeweler::Tasks.new do |gem| + gem.name = "homesick" + gem.summary = %Q{TODO: one-line summary of your gem} + gem.description = %Q{TODO: longer description of your gem} + gem.email = "josh@technicalpickles.com" + gem.homepage = "http://github.com/technicalpickles/homesick" + gem.authors = ["Joshua Nichols"] + # Have dependencies? Add them to Gemfile + + # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings +end + + +require 'spec/rake/spectask' +Spec::Rake::SpecTask.new(:spec) do |spec| + spec.libs << 'lib' << 'spec' + spec.spec_files = FileList['spec/**/*_spec.rb'] +end + +Spec::Rake::SpecTask.new(:rcov) do |spec| + spec.libs << 'lib' << 'spec' + spec.pattern = 'spec/**/*_spec.rb' + spec.rcov = true +end + +task :default => :spec + +require 'rake/rdoctask' +Rake::RDocTask.new do |rdoc| + version = File.exist?('VERSION') ? File.read('VERSION') : "" + + rdoc.rdoc_dir = 'rdoc' + rdoc.title = "homesick #{version}" + rdoc.rdoc_files.include('README*') + rdoc.rdoc_files.include('lib/**/*.rb') +end + diff --git a/bin/homesick b/bin/homesick new file mode 100755 index 0000000..06e6161 --- /dev/null +++ b/bin/homesick @@ -0,0 +1,9 @@ +#!/usr/bin/env ruby + +require 'pathname' +lib = Pathname.new(__FILE__).dirname.join('..', 'lib').expand_path +$LOAD_PATH.unshift.unshift lib.to_s unless $LOAD_PATH.include?(lib.to_s) + +require 'homesick' + +Homesick.start diff --git a/lib/homesick.rb b/lib/homesick.rb new file mode 100644 index 0000000..b193fd4 --- /dev/null +++ b/lib/homesick.rb @@ -0,0 +1,52 @@ +require 'thor' + +class Homesick < Thor + include Thor::Actions + + desc "clone URI", "Clone home's +uri+ for use with homesick" + def clone(uri) + empty_directory homes_dir + inside homes_dir do + run "git clone #{uri}" + end + end + + desc "link NAME", "Links everything" + def link(home) + inside home_dir(home) do + files = Pathname.glob('.*')[2..-1] # skip . and .., ie the first two + files.each do |path| + absolute_path = path.expand_path + + inside user_dir do + adjusted_path = (user_dir + path).basename + run "ln -sf #{absolute_path} #{adjusted_path}" + end + end + end + end + + desc "list", "List installed widgets" + def list + inside homes_dir do + Pathname.glob('*') do |home| + puts home + end + end + end + + protected + + def user_dir + @user_dir ||= Pathname.new('~').expand_path + end + + def homes_dir + @homes_dir ||= Pathname.new('~/.homesick/repos').expand_path + end + + def home_dir(name) + homes_dir.join(name, 'home') + end + +end diff --git a/spec/homesick_spec.rb b/spec/homesick_spec.rb new file mode 100644 index 0000000..fb81f68 --- /dev/null +++ b/spec/homesick_spec.rb @@ -0,0 +1,7 @@ +require File.expand_path(File.dirname(__FILE__) + '/spec_helper') + +describe "Homesick" do + it "fails" do + fail "hey buddy, you should probably rename this file and start specing for real" + end +end diff --git a/spec/spec.opts b/spec/spec.opts new file mode 100644 index 0000000..4e1e0d2 --- /dev/null +++ b/spec/spec.opts @@ -0,0 +1 @@ +--color diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..fa49e24 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,10 @@ +$LOAD_PATH.unshift(File.dirname(__FILE__)) +$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) +require 'homesick' +require 'spec' +require 'spec/autorun' + + +Spec::Runner.configure do |config| + +end