Sha256: 25c72974b4e33586478612f0b0e7b5ae825bc0e7e1a94b94d017bb7efaa79ce6

Contents?: true

Size: 599 Bytes

Versions: 3

Compression:

Stored size: 599 Bytes

Contents

module Pione
  module LiterateAction
    class Handler
      def initialize(action)
        @lang = action[:lang]
        @content = action[:content]
      end

      # Convert the action to a string.
      def textize(domain_info)
        @content.to_s
      end

      # Execute the action.
      def execute(domain_info, dir=Location[Global.pwd])
        text = textize(domain_info)
        location = Location[Temppath.create]
        location.write(("#!/usr/bin/env %s\n" % @lang) + text)
        location.path.chmod(0700)
        `cd #{dir.path}; #{location.path}`
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pione-0.4.1 lib/pione/literate-action/handler.rb
pione-0.4.0 lib/pione/literate-action/handler.rb
pione-0.3.2 lib/pione/literate-action/handler.rb