Permalink
Browse files

wip1

  • Loading branch information...
1 parent 90d80c2 commit 38f73c7d65293af877fd8a189e06820b589b4b03 Rebs Guarina committed Mar 9, 2012
Showing with 26 additions and 1 deletion.
  1. +2 −1 Rakefile
  2. +1 −0 lib/rush.rb
  3. +22 −0 lib/rush/dir.rb
  4. +1 −0 lib/rush/shell.rb
View
3 Rakefile
@@ -22,7 +22,8 @@ Jeweler::GemcutterTasks.new
######################################################
-require 'spec/rake/spectask'
+#require 'spec/rake/spectask'
+require 'rspec/core/rake_task'
desc "Run all specs"
Spec::Rake::SpecTask.new('spec') do |t|
View
1 lib/rush.rb
@@ -66,6 +66,7 @@ module Rush::Connection; end
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'rush/exceptions'
+require 'rush/base_commands'
require 'rush/config'
require 'rush/commands'
require 'rush/access'
View
22 lib/rush/dir.rb
@@ -125,6 +125,28 @@ def bash(command, options={})
box.bash "cd #{quoted_path} && #{command}", options
end
+ # Get the current working directory
+ def self.pwd
+ @@pwd ||= new(::Dir.pwd)
+ end
+
+ # Change to this directory
+ def chdir
+ # Ensure that the directory exists
+ stat
+
+ if box.host == "localhost"
+ ::Dir.chdir(to_s)
+ else
+ # cd away to avoid unexpected "resource busy" situations
+ ::Dir.chdir("/")
+ end
+ @@pwd = self
+ self
+ end
+
+ alias :cd :chdir
+
# Destroy all of the contents of the directory, leaving it fresh and clean.
def purge
connection.purge full_path
View
1 lib/rush/shell.rb
@@ -26,6 +26,7 @@ def initialize
$last_res = nil
eval @config.load_env, @pure_binding
+ eval "extend Rush::BaseCommands", @pure_binding
commands = @config.load_commands
Rush::Dir.class_eval commands

0 comments on commit 38f73c7

Please sign in to comment.