Sha256: 6157241f63808d7cf849b7a2b452ddcb0267b36f8d0d505d6d4cf764d8ae22b8
Contents?: true
Size: 1.33 KB
Versions: 2
Compression:
Stored size: 1.33 KB
Contents
#!/usr/bin/env ruby # WANT_JSON # Reinstate Bundler ENV vars if they have been moved load ENV['QB_REBUNDLE_PATH'] if ENV['QB_REBUNDLE_PATH'] require 'nrser' require 'qb' require 'qb/ansible/module' require 'cmds' class Stream < QB::Ansible::Module def main template = @args['template'] || @args['cmd'] if template.nil? raise ArgumentError, "Must supply `template` or `cmd` argument." end if @args['creates'] && File.exists?( @args['creates'] ) debug "File #{ @args['creates'] } exists, skipping" return nil end opts = {} [:args, :kwds, :input, :assert, :env, :chdir].each { |key| opts[key] = @args[key.to_s] if @args.key?(key.to_s) } [:format, :env_mode].each { |key| opts[key] = @args[key.to_s].to_sym if @args.key?(key.to_s) } cmd = Cmds.new(template, **opts) if @args['log'] info binding.erb <<-END STREAMING ======================================================================== Template: <%= template %> Options: <%= opts.pretty_inspect %> Prepared command: <%= cmd.prepare %> END end qb_unbundle! { cmd.stream! } changed! end end Stream.run!
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
qb-0.4.1 | library/stream |
qb-0.4.0 | library/stream |