SPIIIIIKE

This commit is contained in:
Joshua Nichols
2010-03-04 00:19:35 -05:00
commit 0277901561
11 changed files with 227 additions and 0 deletions

5
.document Normal file
View File

@@ -0,0 +1,5 @@
README.rdoc
lib/**/*.rb
bin/*
features/**/*.feature
LICENSE

39
.gitignore vendored Normal file
View File

@@ -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

18
Gemfile Normal file
View File

@@ -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

20
LICENSE Normal file
View File

@@ -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.

17
README.rdoc Normal file
View File

@@ -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.

49
Rakefile Normal file
View File

@@ -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

9
bin/homesick Executable file
View File

@@ -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

52
lib/homesick.rb Normal file
View File

@@ -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

7
spec/homesick_spec.rb Normal file
View File

@@ -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

1
spec/spec.opts Normal file
View File

@@ -0,0 +1 @@
--color

10
spec/spec_helper.rb Normal file
View File

@@ -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