From 1a5fd8b15c4ba83a61e87a6b5be3f73b21fd9685 Mon Sep 17 00:00:00 2001 From: Jakukyo Friel Date: Sun, 22 Mar 2015 21:27:23 +0800 Subject: [PATCH 1/3] Add a wget installer which downloads file from web. --- lib/sprinkle/installers/wget.rb | 39 +++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 lib/sprinkle/installers/wget.rb diff --git a/lib/sprinkle/installers/wget.rb b/lib/sprinkle/installers/wget.rb new file mode 100644 index 0000000..7b09bc5 --- /dev/null +++ b/lib/sprinkle/installers/wget.rb @@ -0,0 +1,39 @@ +module Sprinkle + module Installers + # The wget package installer downloads file from web. + # + # == Example Usage + # + # package :magic_beans do + # description "Beans beans they're good for your heart..." + # wget 'http://example.com/magic_beans.sh', '/usr/local/bin/magic_beans' + # end + # + # After downloading, we chomd 755 to magic_beans. + class Wget < Installer + + api do + def wget(url, path, options = {}, &block) + install Wget.new(self, url, path, options, &block) + end + end + + attr_accessor :url, :path #:nodoc: + + def initialize(parent, url, path, options = {}, &block) #:nodoc: + super parent, options, &block + @url = url + @path = path + end + + + protected + + + def install_commands #:nodoc: + cmd = "#{sudo_cmd}wget -O #{path} #{url} && #{sudo_cmd} chmod 755 #{path}" + end + + end + end +end From 288e5a34517cd56ffb529db6819e63f102552d9d Mon Sep 17 00:00:00 2001 From: Jakukyo Friel Date: Sun, 10 Jul 2016 16:48:18 +0800 Subject: [PATCH 2/3] wget: resume downloading (`-c`). --- lib/sprinkle/installers/wget.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sprinkle/installers/wget.rb b/lib/sprinkle/installers/wget.rb index 7b09bc5..1b19c9c 100644 --- a/lib/sprinkle/installers/wget.rb +++ b/lib/sprinkle/installers/wget.rb @@ -31,7 +31,7 @@ def initialize(parent, url, path, options = {}, &block) #:nodoc: def install_commands #:nodoc: - cmd = "#{sudo_cmd}wget -O #{path} #{url} && #{sudo_cmd} chmod 755 #{path}" + cmd = "#{sudo_cmd}wget -c -O #{path} #{url} && #{sudo_cmd} chmod 755 #{path}" end end From 38a7323664d04783967a67e89953f9bda916b09e Mon Sep 17 00:00:00 2001 From: Jakukyo Friel Date: Mon, 11 Jul 2016 18:15:28 +0800 Subject: [PATCH 3/3] wget: fix indent and typo. --- lib/sprinkle/installers/wget.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sprinkle/installers/wget.rb b/lib/sprinkle/installers/wget.rb index 1b19c9c..4dd262f 100644 --- a/lib/sprinkle/installers/wget.rb +++ b/lib/sprinkle/installers/wget.rb @@ -9,7 +9,7 @@ module Installers # wget 'http://example.com/magic_beans.sh', '/usr/local/bin/magic_beans' # end # - # After downloading, we chomd 755 to magic_beans. + # After downloading, we chmod 755 to magic_beans. class Wget < Installer api do @@ -23,7 +23,7 @@ def wget(url, path, options = {}, &block) def initialize(parent, url, path, options = {}, &block) #:nodoc: super parent, options, &block @url = url - @path = path + @path = path end