Sha256: bf3c552db209781a7053a860d00bf2da160b85423fbe309ffd0b7cdc4154034a
Contents?: true
Size: 674 Bytes
Versions: 2
Compression:
Stored size: 674 Bytes
Contents
class JenkinsCron::Job::Command def initialize(command, opts = {}) @command = command @opts = opts end def shell_command script = export_env script += "#{sh} -c '#{command}'\n" end private def export_env env = @opts[:env] || {} export = "" env.each do |key, value| export += "export #{key}=#{value}\n" end export end def sh if @opts[:user] #TODO use each user's shell "sudo -u #{@opts[:user]} -H bash -l" else "bash" end end def cd if @opts[:cwd] "cd #{@opts[:cwd].shellescape} && " else "" end end def command "#{cd}#{@command}" end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jenkins_cron-0.0.3 | lib/jenkins_cron/job/command.rb |
jenkins_cron-0.0.2 | lib/jenkins_cron/job/command.rb |