Showing posts with label ruby/rails. Show all posts
Showing posts with label ruby/rails. Show all posts

Monday, September 21, 2009

Quick Tip: Additional File Types for OS X Quick Look

As I am diving into cucumber, I would like OS X Quick Look to display my .feature files.
(and while I was already at it, I also enabled Quick Look for .properties and .textile files)

This is what I did:
  • I navigated into the TextMate package (right-click->Show Package Contents).
  • I edited Contents/Info.plist with a text-editor.
  • I added the follwing snippet at the end of Info.plist (just before the ending </dict> </plist>)
  • <!-- inserted jb, 20090920 for QuickLook improvement -->  
    <key>UTExportedTypeDeclarations</key>  
     <array>  
       <dict>  
         <key>UTTypeConformsTo</key>  
         <array>  
           <string>public.text</string>  
            <string>public.plain-text</string>  
         </array>  
         <key>UTTypeDescription</key>  
         <string>Code</string>  
         <key>UTTypeIdentifier</key>  
         <string>com.macromates.textmate</string>  
         <key>UTTypeTagSpecification</key>  
         <dict>  
           <key>com.apple.ostype</key>  
           <string>TEXT</string>  
           <key>public.filename-extension</key>  
           <array>  
             <string>properties</string>  
             <string>textile</string>  
             <string>feature</string>
           </array>  
         </dict>  
       </dict>  
     </array>
    
  • Then I set TextMate as the default editor for .feature files.
  • Finally I nudged the system o tell it something has changed with touch /Applications/TextMate.app and qlmanage -r on the commandline.

  • The result:
    Picture 3.png

    Thursday, August 27, 2009

    Learned Today: Rails is a Harvested Framework

    From ASP.NET MVC in Action (chapter 11):
    Unlike many other MVC frameworks, Ruby on Rails is a harvested framework, one that was extracted from a real-world application: 37signals’ application Basecamp. Because Ruby on Rails is a harvested framework, all its features have been used in a production environment ...


    Never heard the term "Harvested Framework". I think that is a good terminology to contrast the every so often encountered "ivory tower framework".

    Wednesday, February 25, 2009

    Web automation with Groovy and Ruby

    For a small private project I need to do some web automation.

    I wanted to use a scripting language and decided to give Ruby and Groovy a try.

    In Ruby there is the Mechanize library. In Groovy there are different options.

    The Ruby Mechanize library seems very intuitive:
      require 'rubygems'
      require 'mechanize'
    
      a = WWW::Mechanize.new { |agent|
        agent.user_agent_alias = 'Mac Safari'
      }
    
      a.get('http://google.com/') do |page|
        search_result = page.form_with(:name => 'f') do |search|
          search.q = 'Hello world'
        end.submit
    
        search_result.links.each do |link|
          puts link.text
        end
      end
    
    

    I like the DSLish way to both, scrape (eg: earch_result.links.each) and manipulate (eg: search.q = 'Hello world') a web page.

    In Groovy scraping is also pretty DSLish:
    def page = new XmlSlurper(new org.cyberneko.html.parsers.SAXParser()).parse('http://groovy.codehaus.org/')
    def data = page.depthFirst().grep{ it.name() == 'A' && it.@href.toString().endsWith('.html') }.'@href'
    data.each { println it }
    
    But it makes a bit a less concise impression than the Ruby version.

    Manipulating a web page with groovy unfortunately is clumsier:
    import com.gargoylesoftware.htmlunit.WebClient
    
    def webClient = new WebClient()
    def page = webClient.getPage('http://www.google.com')
    // check page title
    assert 'Google' == page.titleText
    // fill in form and submit it
    def form = page.getFormByName('f')
    def field = form.getInputByName('q')
    field.setValueAttribute('Groovy')
    def button = form.getInputByName('btnG')
    def result = button.click()
    // check groovy home page appears in list (assumes it's on page 1)
    assert result.anchors.any{ a -> a.hrefAttribute == 'http://groovy.codehaus.org/' }
    
    
    This is less DSLish and much more old-scool imperative... the different styles for scraping and manipulating is a bit unfortunate (however you can also use HtmlUnit for scraping).

    Tuesday, November 11, 2008

    Work smart not hard: another step in the right direction

    Today SpringSource acquired G2One, THE company behind Grails.

    Read the announcement from SpringSource.
    ... and the blog posts from the Graeme Rocher and Guillaume Laforge.

    I think this is a very pleasant step for getting Groovy and Grails into the enterprise and consequently a big step for enterprise developers that want to work smart not hard.

    In my experience it has been hard to bring Grails or Rails into the enterprise. Decision-makers in corporate-IT seem to be terribly afraid of new languages. In my opinion this is not justified, given the fact that other technologies are happily adapted, regardless of their over-complexity in many cases!

    If Groovy and Grails becomes a part of the Spring portfolio, the argument becomes much easier or even obsolete, because Spring is widely accepted in the enterprise.

    I have to start looking for a Grails project ...

    Thursday, September 25, 2008

    Making money getting real ...

    images.jpg 37signals shows us an elegant way to make money ...

    ... a nice fact to throw into the face of the next one who claims there is no money in Ruby on Rails.

    Sunday, August 17, 2008

    Where are the ruby jobs? (Part 2)

    rails.png Some posts ago I was looking for ruby jobs here in switzerland and the outcome was quite disappointing...

    This weekend I was pointed to rubyonrails.ch. There are lists of rails jobs and companies who offer rails development.

    But the perspectives are still not motivating ...
    Related Posts Plugin for WordPress, Blogger...