From b80b132a7a8aa47c5197c5e0c67f55689bc6dca1 Mon Sep 17 00:00:00 2001 From: Joshua Nichols Date: Thu, 18 Mar 2010 23:38:45 -0400 Subject: [PATCH] Adding in pretend options. --- lib/homesick.rb | 6 ++++-- lib/homesick/actions.rb | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/homesick.rb b/lib/homesick.rb index d3cac95..04abfa3 100644 --- a/lib/homesick.rb +++ b/lib/homesick.rb @@ -7,13 +7,15 @@ class Homesick < Thor include Thor::Actions include Homesick::Actions + add_runtime_options! + + GITHUB_NAME_REPO_PATTERN = /\A([A-Za-z_-]+)\/([A-Za-z_-]+)\Z/ + def initialize(args=[], options={}, config={}) super self.shell = Homesick::Shell.new end - GITHUB_NAME_REPO_PATTERN = /\A([A-Za-z_-]+)\/([A-Za-z_-]+)\Z/ - desc "clone URI", "Clone +uri+ as a castle for homesick" def clone(uri) empty_directory repos_dir, :verbose => false diff --git a/lib/homesick/actions.rb b/lib/homesick/actions.rb index 7931b53..ac2e385 100644 --- a/lib/homesick/actions.rb +++ b/lib/homesick/actions.rb @@ -28,12 +28,12 @@ class Homesick say_status :conflict, "#{destination} exists and points to #{destination.readlink}", :red if shell.file_collision(destination) { source } - system "ln -sf #{source} #{destination}" + system "ln -sf #{source} #{destination}" unless options[:pretend] end end else say_status :symlink, "#{source.expand_path} to #{destination.expand_path}", :green - system "ln -s #{source} #{destination}" + system "ln -s #{source} #{destination}" unless options[:pretend] end end end