Method: Pawnee::Actions#compile
- Defined in:
- lib/pawnee/pawnee/actions/compile.rb
#compile(url, temp_dir, options = {}) ⇒ Object
Takes a tar.gz or zip file and unzips it, and runs the standard ./configure, make, sudo make install
It attempts to raise an exception at any compilation failure.
compile 'http://nginx.org/download/nginx-1.2.0.tar.gz'
Parameters
- url<String>
-
The url to download
- temp_dir<String>
-
Where the compilation should take place
- options<Hash>
-
Hash of options, see below
Options
#compile requires that you either specify a :bin_file option that the method can check for on the remote system, or that you pass a block that returns true if the app has already been installed
:bin_file - the name of an executable that the method can check for in the path :config_options - a string of options to pass to the ./configure command. :skip_configure - skips the configure step
Block
You can also pass a block that if it returns true, it will not recompile. So the general idea is return true if the exe is already installed.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/pawnee/pawnee/actions/compile.rb', line 31 def compile(url, temp_dir, ={}) # TODO: Add invoke/revoke support using action(...), maybe # make things run via Thor::Group installed = false if [:bin_file] # Check if the bin file is installed installed = exec("which #{[:bin_file]}", :log_stderr => false).strip != '' else raise "You must pass :bin_file or a block to compile" unless block_given? installed = yield() end if installed say_status :already_compiled, url, :blue return true else track_modification! # Compile and install Compile.new(self, url, temp_dir, ) end end |