push_dir 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,6 +1,9 @@
1
+ === 1.0.1 / 2011-02-01
2
+ * Fixed some small errors
3
+
4
+
1
5
  === 1.0.0 / 2011-02-01
2
6
 
3
- * 1 major enhancement
7
+ * First version, includes some problems.
4
8
 
5
- * Birthday!
6
9
 
data/README.txt CHANGED
@@ -12,7 +12,8 @@ Push_dir allows for easy working directory management. No more old_pwd = Dir.pwd
12
12
 
13
13
  == SYNOPSIS:
14
14
 
15
- # Dir.pwd => '/var/'
15
+ include PushDir
16
+ # Dir.pwd => '/var/'
16
17
  push_dir '/' do
17
18
  # Dir.pwd => '/'
18
19
  push_dir '/home/' do
data/lib/push_dir.rb CHANGED
@@ -1,10 +1,25 @@
1
- class PushDir
2
- VERSION = '1.0.0'
3
- end
1
+ # Include this to get push_dir, or call PushDir.push_dir
2
+ module PushDir
3
+ # Current PushDir version number
4
+ VERSION = '1.0.1'
4
5
 
5
- def push_dir path
6
- old_pwd = Dir.pwd
7
- Dir.chdir(path)
8
- yield
9
- Dir.chdir(old_pwd)
6
+ # Simplifies directory management
7
+ # Dir.pwd => '/var/'
8
+ # push_dir '/' do
9
+ # # Dir.pwd => '/'
10
+ # push_dir '/home/' do
11
+ # # Dir.pwd => '/home/'
12
+ # end
13
+ # # Dir.pwd => '/'
14
+ # end
15
+ # # Dir.pwd => '/var/'
16
+ #
17
+ # The code is very simple, and consists of saving the old pwd, moving
18
+ # to the new pwd, yielding, then changing back to the old pwd.
19
+ def push_dir path
20
+ old_pwd = Dir.pwd
21
+ Dir.chdir(path)
22
+ yield
23
+ Dir.chdir(old_pwd)
24
+ end
10
25
  end
@@ -1,7 +1,7 @@
1
1
  require "test/unit"
2
2
  require "push_dir"
3
3
 
4
- #include PushDir
4
+ include PushDir
5
5
 
6
6
  class TestPushDir < Test::Unit::TestCase
7
7
  def test_change_dir
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 0
9
- version: 1.0.0
8
+ - 1
9
+ version: 1.0.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Indigo Casson