Module: Rsm::Actions
- Included in:
- Base
- Defined in:
- lib/rsm/actions.rb
Constant Summary
- TAR_OPTS =
{:gz => '-z', :bz2 => '-j'}.freeze
Instance Method Summary (collapse)
- - (Object) application_root
-
- (Object) downloaded_file(name, compressor)
relative downloaded filename
name
application name
compressor
:gz or :bz2.
-
- (Object) fetch_temporary_archive(name, uri, compressor)
download archive form uri and temporary save it
name
application name
uri
source URI - supported by open-uri.
- - (Object) run_ruby_binary(command, config = {})
-
- (Object) unpack_compressed_archive(name, compressor)
unpack temporary archive file
name
application name
compressor
:gz or :bz2.
Instance Method Details
- (Object) application_root
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/rsm/actions.rb', line 5 def application_root unless @application_root @application_root = if [:capistrano] "#{[:apps_root]}/#{name}/#{[:capistrano]}/current" else "#{[:apps_root]}/#{name}" end @application_root = Pathname.new(@application_root) say "Application root: #{@application_root}" if [:verbose] end @application_root end |
- (Object) downloaded_file(name, compressor)
relative downloaded filename
name |
application name |
compressor |
:gz or :bz2 |
31 32 33 |
# File 'lib/rsm/actions.rb', line 31 def downloaded_file(name, compressor) "#{name}.tar.#{compressor}" end |
- (Object) fetch_temporary_archive(name, uri, compressor)
download archive form uri and temporary save it
name |
application name |
uri |
source URI - supported by open-uri. |
compressor |
:gz or :bz2 |
39 40 41 |
# File 'lib/rsm/actions.rb', line 39 def fetch_temporary_archive(name, uri, compressor) get uri, downloaded_file(name, compressor) end |
- (Object) run_ruby_binary(command, config = {})
18 19 20 21 22 23 24 25 26 |
# File 'lib/rsm/actions.rb', line 18 def run_ruby_binary(command, config = {}) rvmrc = application_root.join(".rvmrc") with = if rvmrc.exist? File.new(rvmrc).readline.strip + " exec" else "#{Thor::Util.ruby_command} -S" end run(command, config.merge(:with => with)) end |
- (Object) unpack_compressed_archive(name, compressor)
unpack temporary archive file
name |
application name |
compressor |
:gz or :bz2 |
46 47 48 49 |
# File 'lib/rsm/actions.rb', line 46 def unpack_compressed_archive(name, compressor) opt = TAR_OPTS[compressor] run "tar --remove-files #{opt} -xf #{downloaded_file(name, compressor)}" end |