lib/shuttle/deploy.rb in shuttle-deploy-0.2.0.beta2 vs lib/shuttle/deploy.rb in shuttle-deploy-0.2.0.beta3
- old
+ new
@@ -20,7 +20,28 @@
@version = (res.empty? ? 1 : Integer(res) + 1).to_s
else
@version = 1
end
end
+
+ # Get current deploy version
+ # @return [Integer]
+ def last_version
+ @last_version ||= ssh.read_file(version_path).to_i
+ end
+
+ # Get list of all existing releases
+ # @return [Array<Integer>]
+ def available_releases
+ if ssh.directory_exists?(deploy_path('releases'))
+ releases = ssh.capture("ls --color=never #{deploy_path}/releases")
+
+ releases.
+ scan(/[\d]+/).
+ map { |s| s.strip.to_i }.
+ sort
+ else
+ []
+ end
+ end
end
end
\ No newline at end of file