Good stuff, Ezra. This is great! I look forward to seeing what the  
standard cap recipes look like with this.

Thanks!

- Jamis

On Jan 21, 2007, at 8:05 PM, Ezra Zygmuntowicz wrote:

>
> Hey Folks-
>
>       I spent the weekend working on a shell script builder DSL for
> writing your capistrano tasks in ruby instead of putting shell script
> snippets in strings to the run method.
>
>       I wrote about this on my blog with a call for some input on look and
> feel and whatnot.
>
> http://brainspl.at/articles/2007/01/22/shellscriptbuilder-for- 
> capistrano
> http://brainspl.at/shell_script_builder.tar.gz
>
>       Right now it is just a standalone library that generates shell
> scripts. I haven't made the mechanism that will allow cap to upload
> these scripts to the servers and execute them but thats an easy task.
> I am going to try to rewrite all the standard cap recipes to use this
> Builder instead of shell scripts.
>
>       The reasoning is that with this dsl you will not have to remember
> what all the flags to bash's if statements are. And you also don';t
> have to worry about shell escaping or the way capistrano escapes
> commands itself.
>
>       I would love some feedback and thoughts from folks as to whether
> they would use this or not.
>
> Here is a small example:
>
> script = shell do |sh|
>    sh.sudo.ln_nsf "foo/bar", "bar/bar"
>
>    sh.echo "some string" => "/path/to/log.txt"
>
>    sh.if :directory? => "some/dir" do |sub|
>      sub.rm_rf 'some/dir'
>      sub.ln_nsf "shared/foo", "some/dir"
>      sub.if_not :file? => 'foo' do |ssub|
>        ssub.mkdir_p "some/foo"
>      end
>    end
>
>    sh.unless :file? => 'foo/bario' do |sub|
>      sub.touch 'foo/bario'
>    end
>
>    sh.if :writable? => "some/file.txt" do |sub|
>      sub.echo "#{Time.now}" => 'some/file.txt'
>    end
>    sh.mkdir_p 'foo/bar'
>    sh.rm_rf 'foo/bar'
> end
>
> puts script
> OUTPUT:
>
> #!/bin/sh
> sudo ln -nsf foo/bar bar/bar
> echo "some string" >> /path/to/log.txt
> if [ -d some/dir ]
>    then
>      rm -rf some/dir
>      ln -nsf shared/foo some/dir
>      if [ ! -a foo ]
>        then
>          mkdir -p some/foo
>      fi
> fi
> if [ ! -a foo/bario ]
>    then
>      touch foo/bario
> fi
> if [ -w some/file.txt ]
>    then
>      echo "#{time}" >> some/file.txt
> fi
> mkdir -p foo/bar
> rm -rf foo/bar
>
>       
> Cheers-
> -- Ezra Zygmuntowicz 
> -- Lead Rails Evangelist
> -- [EMAIL PROTECTED]
> -- Engine Yard, Serious Rails Hosting
> -- (866) 518-YARD (9273)
>
>
>
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---

Reply via email to