lib/rvmpow.rb in rvmpow-0.0.1 vs lib/rvmpow.rb in rvmpow-0.0.2
- old
+ new
@@ -20,14 +20,26 @@
fileAction action
end
# create tmp/restart.txt file
def touchRestartFile
- action = -> { FileUtils.touch(RvmPow::RESTART_FILE) }
+ action = -> do
+ createTmpDirIfNeeded
+ FileUtils.touch(RvmPow::RESTART_FILE)
+ end
fileAction action
end
+ # create tmp/always_restart.txt file
+ def touchAlwaysRestartFile
+ action = -> do
+ createTmpDirIfNeeded
+ FileUtils.touch(RvmPow::ALWAYS_RESTART_FILE)
+ end
+ fileAction action
+ end
+
# add .powenv to .gitignore
def gitignorePowenv
action = -> do
File.open(RvmPow::GITIGNORE_FILE, 'a') { |file| file.puts RvmPow::GITIGNORE_ENTRY }
end
@@ -81,10 +93,16 @@
def deleteRestartFile
action = -> { FileUtils.rm_f RvmPow::RESTART_FILE }
fileAction action
end
+ # removes always_restart.txt file from ./tmp/
+ def deleteAlwaysRestartFile
+ action = -> { FileUtils.rm_f RvmPow::ALWAYS_RESTART_FILE }
+ fileAction action
+ end
+
# deletes the link is ~/.pow
def deletePowLink
action = -> { FileUtils.rm_f RvmPow::POW_LINK }
fileAction action
end
@@ -125,9 +143,13 @@
rvm = {}
rvmArray = `rvm-prompt`.chomp.split('@')
rvm[:ruby] = rvmArray[0].split('-')[1]
rvm[:gemset] = rvmArray[1]
rvm
+ end
+
+ def createTmpDirIfNeeded
+ FileUtils.mkdir('tmp') if !File.exist?('tmp')
end
end
end
\ No newline at end of file