huginn_agent 0.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/bin/huginn_agent +5 -0
 - data/lib/huginn_agent.rb +37 -9
 - data/lib/huginn_agent/cli.rb +17 -0
 - data/lib/huginn_agent/cli/new.rb +87 -0
 - data/lib/huginn_agent/helper.rb +25 -0
 - data/lib/huginn_agent/spec_helper.rb +1 -0
 - data/lib/huginn_agent/spec_runner.rb +65 -0
 - data/lib/huginn_agent/templates/newagent/Gemfile.tt +4 -0
 - data/lib/huginn_agent/templates/newagent/LICENSE.txt.tt +7 -0
 - data/lib/huginn_agent/templates/newagent/README.md.tt +45 -0
 - data/lib/huginn_agent/templates/newagent/Rakefile.tt +5 -0
 - data/lib/huginn_agent/templates/newagent/gitignore.tt +3 -0
 - data/lib/huginn_agent/templates/newagent/lib/new_agent.rb.tt +4 -0
 - data/lib/huginn_agent/templates/newagent/lib/new_agent/new_agent.rb.tt +23 -0
 - data/lib/huginn_agent/templates/newagent/newagent.gemspec.tt +28 -0
 - data/lib/huginn_agent/templates/newagent/spec/new_agent_spec.rb.tt +13 -0
 - data/lib/huginn_agent/templates/newagent/travis.yml.tt +14 -0
 - data/lib/huginn_agent/version.rb +1 -1
 - data/lib/tasks/spec.rake +22 -0
 - data/spec/lib/huginn_agent/cli/new_spec.rb +46 -0
 - data/spec/lib/huginn_agent/helper_spec.rb +31 -0
 - data/spec/lib/huginn_agent/spec_runner_spec.rb +37 -0
 - data/spec/lib/huginn_agent_spec.rb +50 -0
 - data/spec/spec_helper.rb +23 -0
 - metadata +90 -18
 - data/.gitignore +0 -1
 - data/.rspec +0 -2
 - data/.travis.yml +0 -3
 - data/Gemfile +0 -4
 - data/Gemfile.lock +0 -31
 - data/README.md +0 -19
 - data/Rakefile +0 -7
 - data/huginn_agent.gemspec +0 -22
 - data/spec/huginn_agent_spec.rb +0 -7
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 09a1e6125bce5ffb343714b067d84b180c4e3cd3
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 2359ca71f47068eda4145beae7e24bfb91c3fffb
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 48bef47caa15e13e4b0b2adfd149350ad0b7360a74ed43324f145833b547752518ff7e2890806e50d907c0e2b66400ad6f368a201c7d922ceb65b2a7a9c0581c
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 40fa41d8fb2ead907e5cb1b06c1058f2d069a52741e66cf160570b893f040324590b727b045c20dab18b870edf5bbdd3c93b217dac7d9ccacd7d78a0166d2d9a
         
     | 
    
        data/bin/huginn_agent
    ADDED
    
    
    
        data/lib/huginn_agent.rb
    CHANGED
    
    | 
         @@ -1,17 +1,45 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'huginn_agent/version'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            class HuginnAgent
         
     | 
| 
       4 
     | 
    
         
            -
               
     | 
| 
       5 
     | 
    
         
            -
                 
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
      
 4 
     | 
    
         
            +
              class << self
         
     | 
| 
      
 5 
     | 
    
         
            +
                attr_accessor :branch, :remote
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                def load_tasks(options = {})
         
     | 
| 
      
 8 
     | 
    
         
            +
                  @branch = options[:branch] || 'master'
         
     | 
| 
      
 9 
     | 
    
         
            +
                  @remote = options[:remote] || 'https://github.com/cantino/huginn.git'
         
     | 
| 
      
 10 
     | 
    
         
            +
                  Rake.add_rakelib File.join(File.expand_path('../', __FILE__), 'tasks')
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                def load(*paths)
         
     | 
| 
      
 14 
     | 
    
         
            +
                  paths.each do |path|
         
     | 
| 
      
 15 
     | 
    
         
            +
                    load_paths << path
         
     | 
| 
      
 16 
     | 
    
         
            +
                  end
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                def register(*paths)
         
     | 
| 
      
 20 
     | 
    
         
            +
                  paths.each do |path|
         
     | 
| 
      
 21 
     | 
    
         
            +
                    agent_paths << path
         
     | 
| 
      
 22 
     | 
    
         
            +
                  end
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                def require!
         
     | 
| 
      
 26 
     | 
    
         
            +
                  load_paths.each do |path|
         
     | 
| 
      
 27 
     | 
    
         
            +
                    require path
         
     | 
| 
      
 28 
     | 
    
         
            +
                  end
         
     | 
| 
      
 29 
     | 
    
         
            +
                  agent_paths.each do |path|
         
     | 
| 
      
 30 
     | 
    
         
            +
                    require path
         
     | 
| 
      
 31 
     | 
    
         
            +
                    Agent::TYPES << "Agents::#{File.basename(path.to_s).camelize}"
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                private
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                def load_paths
         
     | 
| 
      
 38 
     | 
    
         
            +
                  @load_paths ||= []
         
     | 
| 
       8 
39 
     | 
    
         
             
                end
         
     | 
| 
       9 
     | 
    
         
            -
              end
         
     | 
| 
       10 
40 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
                  require path
         
     | 
| 
       14 
     | 
    
         
            -
                  Agent::TYPES << "Agents::#{File.basename(path.to_s).camelize}"
         
     | 
| 
      
 41 
     | 
    
         
            +
                def agent_paths
         
     | 
| 
      
 42 
     | 
    
         
            +
                  @agent_paths ||= []
         
     | 
| 
       15 
43 
     | 
    
         
             
                end
         
     | 
| 
       16 
44 
     | 
    
         
             
              end
         
     | 
| 
       17 
45 
     | 
    
         
             
            end
         
     | 
| 
         @@ -0,0 +1,17 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'thor'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class HuginnAgent
         
     | 
| 
      
 4 
     | 
    
         
            +
              class CLI < Thor
         
     | 
| 
      
 5 
     | 
    
         
            +
                include Thor::Actions
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                desc "new AGENT_GEM_NAME", "Create a skeleton for creating a new Huginn agent"
         
     | 
| 
      
 8 
     | 
    
         
            +
                def new(name)
         
     | 
| 
      
 9 
     | 
    
         
            +
                  require 'huginn_agent/cli/new'
         
     | 
| 
      
 10 
     | 
    
         
            +
                  New.new(options, name, self).run
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                def self.source_root
         
     | 
| 
      
 14 
     | 
    
         
            +
                  File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
         
     | 
| 
      
 15 
     | 
    
         
            +
                end
         
     | 
| 
      
 16 
     | 
    
         
            +
              end
         
     | 
| 
      
 17 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,87 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'pathname'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'huginn_agent/helper'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            class HuginnAgent
         
     | 
| 
      
 5 
     | 
    
         
            +
              class CLI::New
         
     | 
| 
      
 6 
     | 
    
         
            +
                PREFIX_QUESTION = "We recommend prefixing all Huginn agent gem names with 'huginn_' to make them easily discoverable.\nPrefix gem name with 'huginn_'?".freeze
         
     | 
| 
      
 7 
     | 
    
         
            +
                MIT_QUESTION = "Do you want to license your code permissively under the MIT license?".freeze
         
     | 
| 
      
 8 
     | 
    
         
            +
                DOT_ENV_QUESTION = 'Which .env file do you want to use?'.freeze
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                attr_reader :options, :gem_name, :thor, :target
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                def initialize(options, gem_name, thor)
         
     | 
| 
      
 13 
     | 
    
         
            +
                  @options = options
         
     | 
| 
      
 14 
     | 
    
         
            +
                  @thor = thor
         
     | 
| 
      
 15 
     | 
    
         
            +
                  if !gem_name.start_with?('huginn_') &&
         
     | 
| 
      
 16 
     | 
    
         
            +
                     thor.yes?(PREFIX_QUESTION)
         
     | 
| 
      
 17 
     | 
    
         
            +
                    gem_name = "huginn_#{gem_name}"
         
     | 
| 
      
 18 
     | 
    
         
            +
                  end
         
     | 
| 
      
 19 
     | 
    
         
            +
                  @target = Pathname.pwd.join(gem_name)
         
     | 
| 
      
 20 
     | 
    
         
            +
                  @gem_name = target.basename.to_s
         
     | 
| 
      
 21 
     | 
    
         
            +
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                def run
         
     | 
| 
      
 24 
     | 
    
         
            +
                  thor.say "Creating Huginn agent '#{gem_name}'"
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                  agent_file_name = gem_name.gsub('huginn_', '')
         
     | 
| 
      
 27 
     | 
    
         
            +
                  namespaced_path = gem_name.tr('-', '/')
         
     | 
| 
      
 28 
     | 
    
         
            +
                  constant_name   = gem_name.split('_')[1..-1].map{|p| p[0..0].upcase + p[1..-1] unless p.empty?}.join
         
     | 
| 
      
 29 
     | 
    
         
            +
                  constant_name   = constant_name.split('-').map{|q| q[0..0].upcase + q[1..-1] }.join('::') if constant_name =~ /-/
         
     | 
| 
      
 30 
     | 
    
         
            +
                  git_user_name   = `git config user.name`.chomp
         
     | 
| 
      
 31 
     | 
    
         
            +
                  git_user_email  = `git config user.email`.chomp
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                  opts = {
         
     | 
| 
      
 34 
     | 
    
         
            +
                    :gem_name         => gem_name,
         
     | 
| 
      
 35 
     | 
    
         
            +
                    :agent_file_name  => agent_file_name,
         
     | 
| 
      
 36 
     | 
    
         
            +
                    :namespaced_path  => namespaced_path,
         
     | 
| 
      
 37 
     | 
    
         
            +
                    :constant_name    => constant_name,
         
     | 
| 
      
 38 
     | 
    
         
            +
                    :author           => git_user_name.empty? ? "TODO: Write your name" : git_user_name,
         
     | 
| 
      
 39 
     | 
    
         
            +
                    :email            => git_user_email.empty? ? "TODO: Write your email address" : git_user_email,
         
     | 
| 
      
 40 
     | 
    
         
            +
                  }
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                  templates = {
         
     | 
| 
      
 43 
     | 
    
         
            +
                    "Gemfile.tt" => "Gemfile",
         
     | 
| 
      
 44 
     | 
    
         
            +
                    "gitignore.tt" => ".gitignore",
         
     | 
| 
      
 45 
     | 
    
         
            +
                    "lib/new_agent.rb.tt" => "lib/#{namespaced_path}.rb",
         
     | 
| 
      
 46 
     | 
    
         
            +
                    "lib/new_agent/new_agent.rb.tt" => "lib/#{namespaced_path}/#{agent_file_name}.rb",
         
     | 
| 
      
 47 
     | 
    
         
            +
                    "spec/new_agent_spec.rb.tt" => "spec/#{agent_file_name}_spec.rb",
         
     | 
| 
      
 48 
     | 
    
         
            +
                    "newagent.gemspec.tt" => "#{gem_name}.gemspec",
         
     | 
| 
      
 49 
     | 
    
         
            +
                    "Rakefile.tt" => "Rakefile",
         
     | 
| 
      
 50 
     | 
    
         
            +
                    "README.md.tt" => "README.md",
         
     | 
| 
      
 51 
     | 
    
         
            +
                    "travis.yml.tt" => ".travis.yml"
         
     | 
| 
      
 52 
     | 
    
         
            +
                  }
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
                  if thor.yes?(MIT_QUESTION)
         
     | 
| 
      
 55 
     | 
    
         
            +
                    opts[:mit] = true
         
     | 
| 
      
 56 
     | 
    
         
            +
                    templates.merge!("LICENSE.txt.tt" => "LICENSE.txt")
         
     | 
| 
      
 57 
     | 
    
         
            +
                  end
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
                  templates.each do |src, dst|
         
     | 
| 
      
 61 
     | 
    
         
            +
                    thor.template("newagent/#{src}", target.join(dst), opts)
         
     | 
| 
      
 62 
     | 
    
         
            +
                  end
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                  thor.say "To run the specs of your agent you need to add a .env which configures the database for Huginn"
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
                  possible_paths = Dir['.env', './huginn/.env', '~/huginn/.env']
         
     | 
| 
      
 67 
     | 
    
         
            +
                  if possible_paths.length > 0
         
     | 
| 
      
 68 
     | 
    
         
            +
                    thor.say 'Found possible preconfigured .env files please choose which one you want to use'
         
     | 
| 
      
 69 
     | 
    
         
            +
                    possible_paths.each_with_index do |path, i|
         
     | 
| 
      
 70 
     | 
    
         
            +
                      thor.say "#{i+1} #{path}"
         
     | 
| 
      
 71 
     | 
    
         
            +
                    end
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
                    if (i = thor.ask(DOT_ENV_QUESTION).to_i) != 0
         
     | 
| 
      
 74 
     | 
    
         
            +
                      path = possible_paths[i-1]
         
     | 
| 
      
 75 
     | 
    
         
            +
                      `cp #{path} #{target}`
         
     | 
| 
      
 76 
     | 
    
         
            +
                      thor.say "Copied '#{path}' to '#{target}'"
         
     | 
| 
      
 77 
     | 
    
         
            +
                    end
         
     | 
| 
      
 78 
     | 
    
         
            +
                  end
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
                  thor.say "Initializing git repo in #{target}"
         
     | 
| 
      
 81 
     | 
    
         
            +
                  Dir.chdir(target) { `git init`; `git add .` }
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
                  thor.say 'Installing dependencies'
         
     | 
| 
      
 84 
     | 
    
         
            +
                  Dir.chdir(target) { HuginnAgent::Helper.open3('bundle install') }
         
     | 
| 
      
 85 
     | 
    
         
            +
                end
         
     | 
| 
      
 86 
     | 
    
         
            +
              end
         
     | 
| 
      
 87 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,25 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'open3'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class HuginnAgent
         
     | 
| 
      
 4 
     | 
    
         
            +
              class Helper
         
     | 
| 
      
 5 
     | 
    
         
            +
                def self.open3(command, streaming_output = true)
         
     | 
| 
      
 6 
     | 
    
         
            +
                  output = ""
         
     | 
| 
      
 7 
     | 
    
         
            +
                  print "\n" if streaming_output
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                  status = Open3.popen3(ENV, "#{command} 2>&1") do |stdin, stdout, _stderr, wait_thr|
         
     | 
| 
      
 10 
     | 
    
         
            +
                    stdin.close
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                    until stdout.eof do
         
     | 
| 
      
 13 
     | 
    
         
            +
                      next unless IO.select([stdout])
         
     | 
| 
      
 14 
     | 
    
         
            +
                      data = stdout.read_nonblock(1024)
         
     | 
| 
      
 15 
     | 
    
         
            +
                      print data if streaming_output
         
     | 
| 
      
 16 
     | 
    
         
            +
                      output << data
         
     | 
| 
      
 17 
     | 
    
         
            +
                    end
         
     | 
| 
      
 18 
     | 
    
         
            +
                    wait_thr.value
         
     | 
| 
      
 19 
     | 
    
         
            +
                  end
         
     | 
| 
      
 20 
     | 
    
         
            +
                  [status.exitstatus, output]
         
     | 
| 
      
 21 
     | 
    
         
            +
                rescue IOError => e
         
     | 
| 
      
 22 
     | 
    
         
            +
                  return [1, "#{e} #{e.message}"]
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Dir[File.join(File.expand_path('../'), "support/**/*.rb")].each { |f| require f }
         
     | 
| 
         @@ -0,0 +1,65 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'huginn_agent/helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class HuginnAgent
         
     | 
| 
      
 4 
     | 
    
         
            +
              class SpecRunner
         
     | 
| 
      
 5 
     | 
    
         
            +
                attr_reader :gem_name
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                def initialize
         
     | 
| 
      
 8 
     | 
    
         
            +
                  @gem_name = File.basename(Dir['*.gemspec'].first, '.gemspec')
         
     | 
| 
      
 9 
     | 
    
         
            +
                  $stdout.sync = true
         
     | 
| 
      
 10 
     | 
    
         
            +
                end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                def clone
         
     | 
| 
      
 13 
     | 
    
         
            +
                  unless File.exists?('spec/huginn/.git')
         
     | 
| 
      
 14 
     | 
    
         
            +
                    shell_out "git clone #{HuginnAgent.remote} -b #{HuginnAgent.branch} spec/huginn", 'Cloning huginn source ...'
         
     | 
| 
      
 15 
     | 
    
         
            +
                  end
         
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                def reset
         
     | 
| 
      
 19 
     | 
    
         
            +
                  Dir.chdir('spec/huginn') do
         
     | 
| 
      
 20 
     | 
    
         
            +
                    shell_out "git fetch && git reset --hard origin/#{HuginnAgent.branch}", 'Resetting Huginn source ...'
         
     | 
| 
      
 21 
     | 
    
         
            +
                  end
         
     | 
| 
      
 22 
     | 
    
         
            +
                end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                def bundle
         
     | 
| 
      
 25 
     | 
    
         
            +
                  if File.exists?('.env')
         
     | 
| 
      
 26 
     | 
    
         
            +
                    shell_out "cp .env spec/huginn"
         
     | 
| 
      
 27 
     | 
    
         
            +
                  end
         
     | 
| 
      
 28 
     | 
    
         
            +
                  Dir.chdir('spec/huginn') do
         
     | 
| 
      
 29 
     | 
    
         
            +
                    shell_out "bundle install --without development production -j 4", 'Installing ruby gems ...'
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                def database
         
     | 
| 
      
 35 
     | 
    
         
            +
                  Dir.chdir('spec/huginn') do
         
     | 
| 
      
 36 
     | 
    
         
            +
                    shell_out('bundle exec rake db:create db:migrate', 'Creating database ...')
         
     | 
| 
      
 37 
     | 
    
         
            +
                  end
         
     | 
| 
      
 38 
     | 
    
         
            +
                end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                def spec
         
     | 
| 
      
 41 
     | 
    
         
            +
                  Dir.chdir('spec/huginn') do
         
     | 
| 
      
 42 
     | 
    
         
            +
                    shell_out "bundle exec rspec ../*.rb", 'Running specs ...', true
         
     | 
| 
      
 43 
     | 
    
         
            +
                  end
         
     | 
| 
      
 44 
     | 
    
         
            +
                end
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
                def shell_out(command, message = nil, streaming_output = false)
         
     | 
| 
      
 47 
     | 
    
         
            +
                  print message if message
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                  (status, output) = Bundler.with_clean_env do
         
     | 
| 
      
 50 
     | 
    
         
            +
                    ENV['ADDITIONAL_GEMS'] = "#{gem_name}(path: ../../)"
         
     | 
| 
      
 51 
     | 
    
         
            +
                    ENV['RAILS_ENV'] = 'test'
         
     | 
| 
      
 52 
     | 
    
         
            +
                    HuginnAgent::Helper.open3(command, streaming_output)
         
     | 
| 
      
 53 
     | 
    
         
            +
                  end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
                  if status == 0
         
     | 
| 
      
 56 
     | 
    
         
            +
                    puts "\e[32m [OK]\e[0m" if message
         
     | 
| 
      
 57 
     | 
    
         
            +
                  else
         
     | 
| 
      
 58 
     | 
    
         
            +
                    puts "\e[31m [FAIL]\e[0m" if message
         
     | 
| 
      
 59 
     | 
    
         
            +
                    puts "Tried executing '#{command}'"
         
     | 
| 
      
 60 
     | 
    
         
            +
                    puts output
         
     | 
| 
      
 61 
     | 
    
         
            +
                    fail
         
     | 
| 
      
 62 
     | 
    
         
            +
                  end
         
     | 
| 
      
 63 
     | 
    
         
            +
                end
         
     | 
| 
      
 64 
     | 
    
         
            +
              end
         
     | 
| 
      
 65 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Copyright (c) <%= Time.now.year %> <%= config[:author] %>
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         
     | 
| 
         @@ -0,0 +1,45 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # <%=config[:constant_name]%>
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Welcome to your new agent gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/<%=config[:namespaced_path]%>`. To experiment with that code, run `bin/console` for an interactive prompt.
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            TODO: Delete this and the text above, and describe your gem
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            ## Installation
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            Add this string to your Huginn's .env `ADDITIONAL_GEMS` configuration:
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 12 
     | 
    
         
            +
            <%=config[:gem_name]%>
         
     | 
| 
      
 13 
     | 
    
         
            +
            # when only using this agent gem it should look like hits:
         
     | 
| 
      
 14 
     | 
    
         
            +
            ADDITIONAL_GEMS=<%=config[:gem_name]%>
         
     | 
| 
      
 15 
     | 
    
         
            +
            ```
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            And then execute:
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                $ bundle
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            ## Usage
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            TODO: Write usage instructions here
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            ## Development
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            Running `rake` will clone and set up Huginn in `spec/huginn` to run the specs of the Gem in Huginn as if they would be build-in Agents. The desired Huginn repository and branch can be modified in the `Rakefile`:
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 30 
     | 
    
         
            +
            HuginnAgent.load_tasks(branch: '<your branch>', remote: 'https://github.com/<github user>/huginn.git')
         
     | 
| 
      
 31 
     | 
    
         
            +
            ```
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            Make sure to delete the `spec/huginn` directory and re-run `rake` after changing the `remote` to update the Huginn source code.
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            After the setup is done `rake spec` will only run the tests, without cloning the Huginn source again.
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            ## Contributing
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            1. Fork it ( https://github.com/[my-github-username]/<%=config[:gem_name]%>/fork )
         
     | 
| 
      
 42 
     | 
    
         
            +
            2. Create your feature branch (`git checkout -b my-new-feature`)
         
     | 
| 
      
 43 
     | 
    
         
            +
            3. Commit your changes (`git commit -am 'Add some feature'`)
         
     | 
| 
      
 44 
     | 
    
         
            +
            4. Push to the branch (`git push origin my-new-feature`)
         
     | 
| 
      
 45 
     | 
    
         
            +
            5. Create a new Pull Request
         
     | 
| 
         @@ -0,0 +1,23 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Agents
         
     | 
| 
      
 2 
     | 
    
         
            +
              class <%=config[:constant_name] %> < Agent
         
     | 
| 
      
 3 
     | 
    
         
            +
                default_schedule '12h'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                description <<-MD
         
     | 
| 
      
 6 
     | 
    
         
            +
                  Add a Agent description here
         
     | 
| 
      
 7 
     | 
    
         
            +
                MD
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                def default_options
         
     | 
| 
      
 10 
     | 
    
         
            +
                  {
         
     | 
| 
      
 11 
     | 
    
         
            +
                  }
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                def validate_options
         
     | 
| 
      
 15 
     | 
    
         
            +
                end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            #    def check
         
     | 
| 
      
 18 
     | 
    
         
            +
            #    end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            #    def receive(incoming_events)
         
     | 
| 
      
 21 
     | 
    
         
            +
            #    end
         
     | 
| 
      
 22 
     | 
    
         
            +
              end
         
     | 
| 
      
 23 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,28 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # coding: utf-8
         
     | 
| 
      
 2 
     | 
    
         
            +
            lib = File.expand_path('../lib', __FILE__)
         
     | 
| 
      
 3 
     | 
    
         
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Gem::Specification.new do |spec|
         
     | 
| 
      
 6 
     | 
    
         
            +
              spec.name          = <%= config[:gem_name].inspect %>
         
     | 
| 
      
 7 
     | 
    
         
            +
              spec.version       = '0.1'
         
     | 
| 
      
 8 
     | 
    
         
            +
              spec.authors       = [<%= config[:author].inspect %>]
         
     | 
| 
      
 9 
     | 
    
         
            +
              spec.email         = [<%= config[:email].inspect %>]
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
              spec.summary       = %q{Write a short summary, because Rubygems requires one.}
         
     | 
| 
      
 12 
     | 
    
         
            +
              spec.description   = %q{Write a longer description or delete this line.}
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
              spec.homepage      = "https://github.com/[my-github-username]/<%=config[:gem_name]%>"
         
     | 
| 
      
 15 
     | 
    
         
            +
            <% if config[:mit] %>
         
     | 
| 
      
 16 
     | 
    
         
            +
              spec.license       = "MIT"
         
     | 
| 
      
 17 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
              spec.files         = Dir['LICENSE.txt', 'lib/**/*']
         
     | 
| 
      
 20 
     | 
    
         
            +
              spec.executables   = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
         
     | 
| 
      
 21 
     | 
    
         
            +
              spec.test_files    = Dir['spec/**/*.rb']
         
     | 
| 
      
 22 
     | 
    
         
            +
              spec.require_paths = ["lib"]
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
              spec.add_development_dependency "bundler", "~> 1.7"
         
     | 
| 
      
 25 
     | 
    
         
            +
              spec.add_development_dependency "rake", "~> 10.0"
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
              spec.add_runtime_dependency "huginn_agent", '~> 0.2'
         
     | 
| 
      
 28 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rails_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'huginn_agent/spec_helper'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            describe Agents::<%= config[:constant_name] %> do
         
     | 
| 
      
 5 
     | 
    
         
            +
              before(:each) do
         
     | 
| 
      
 6 
     | 
    
         
            +
                @valid_options = Agents::<%= config[:constant_name] %>.new.default_options
         
     | 
| 
      
 7 
     | 
    
         
            +
                @checker = Agents::<%= config[:constant_name] %>.new(:name => "<%= config[:constant_name] %>", :options => @valid_options)
         
     | 
| 
      
 8 
     | 
    
         
            +
                @checker.user = users(:bob)
         
     | 
| 
      
 9 
     | 
    
         
            +
                @checker.save!
         
     | 
| 
      
 10 
     | 
    
         
            +
              end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              pending "add specs here"
         
     | 
| 
      
 13 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            sudo: false
         
     | 
| 
      
 2 
     | 
    
         
            +
            language: ruby
         
     | 
| 
      
 3 
     | 
    
         
            +
            env:
         
     | 
| 
      
 4 
     | 
    
         
            +
              global:
         
     | 
| 
      
 5 
     | 
    
         
            +
                - APP_SECRET_TOKEN=b2724973fd81c2f4ac0f92ac48eb3f0152c4a11824c122bcf783419a4c51d8b9bba81c8ba6a66c7de599677c7f486242cf819775c433908e77c739c5c8ae118d
         
     | 
| 
      
 6 
     | 
    
         
            +
              matrix:
         
     | 
| 
      
 7 
     | 
    
         
            +
                - DATABASE_ADAPTER=mysql2
         
     | 
| 
      
 8 
     | 
    
         
            +
                - DATABASE_ADAPTER=postgresql DATABASE_USERNAME=postgres
         
     | 
| 
      
 9 
     | 
    
         
            +
            rvm:
         
     | 
| 
      
 10 
     | 
    
         
            +
            - 2.1
         
     | 
| 
      
 11 
     | 
    
         
            +
            - 2.2
         
     | 
| 
      
 12 
     | 
    
         
            +
            - 2.3.0
         
     | 
| 
      
 13 
     | 
    
         
            +
            cache: bundler
         
     | 
| 
      
 14 
     | 
    
         
            +
            script: bundle exec rake
         
     | 
    
        data/lib/huginn_agent/version.rb
    CHANGED
    
    
    
        data/lib/tasks/spec.rake
    ADDED
    
    | 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'huginn_agent/spec_runner'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            unless defined?(Bundler)
         
     | 
| 
      
 4 
     | 
    
         
            +
              fail "Run the rake task with 'bundle exec rake'"
         
     | 
| 
      
 5 
     | 
    
         
            +
            end
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            runner = HuginnAgent::SpecRunner.new
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            desc "Setup Huginn source, install gems and create the database"
         
     | 
| 
      
 10 
     | 
    
         
            +
            task :prepare do
         
     | 
| 
      
 11 
     | 
    
         
            +
              runner.clone
         
     | 
| 
      
 12 
     | 
    
         
            +
              runner.reset
         
     | 
| 
      
 13 
     | 
    
         
            +
              runner.bundle
         
     | 
| 
      
 14 
     | 
    
         
            +
              runner.database
         
     | 
| 
      
 15 
     | 
    
         
            +
            end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            desc "Run the Agent gem specs"
         
     | 
| 
      
 18 
     | 
    
         
            +
            task :spec do
         
     | 
| 
      
 19 
     | 
    
         
            +
              runner.spec
         
     | 
| 
      
 20 
     | 
    
         
            +
            end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            task :default => [:prepare, :spec]
         
     | 
| 
         @@ -0,0 +1,46 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'huginn_agent/cli/new'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            describe HuginnAgent::CLI::New do
         
     | 
| 
      
 6 
     | 
    
         
            +
              sandbox = File.expand_path(File.join(File.dirname(__FILE__), '../../../sandbox'))
         
     | 
| 
      
 7 
     | 
    
         
            +
              let(:cli)  { HuginnAgent::CLI.new }
         
     | 
| 
      
 8 
     | 
    
         
            +
              let(:thor) { Thor.new }
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
              before(:each) do
         
     | 
| 
      
 11 
     | 
    
         
            +
                FileUtils.rm_rf(File.join(sandbox))
         
     | 
| 
      
 12 
     | 
    
         
            +
                allow(Pathname).to receive(:pwd).and_return(Pathname.new(sandbox))
         
     | 
| 
      
 13 
     | 
    
         
            +
              end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
              after(:each) { FileUtils.rm_rf(File.join(sandbox)) }
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              it "prefixes the gem name and copies the MIT license when told" do
         
     | 
| 
      
 18 
     | 
    
         
            +
                expect(cli).to receive(:yes?).with(HuginnAgent::CLI::New::PREFIX_QUESTION) { true }
         
     | 
| 
      
 19 
     | 
    
         
            +
                expect(cli).to receive(:yes?).with(HuginnAgent::CLI::New::MIT_QUESTION) { true }
         
     | 
| 
      
 20 
     | 
    
         
            +
                capture(:stdout) { cli.new('test') }
         
     | 
| 
      
 21 
     | 
    
         
            +
                expect(File.exists?(File.join(sandbox, 'huginn_test'))).to be_truthy
         
     | 
| 
      
 22 
     | 
    
         
            +
                expect(File.exists?(File.join(sandbox, 'huginn_test', 'LICENSE.txt'))).to be_truthy
         
     | 
| 
      
 23 
     | 
    
         
            +
              end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
              it "does not prefix the gem name and does notcopies the MIT license when told" do
         
     | 
| 
      
 26 
     | 
    
         
            +
                expect(cli).to receive(:yes?).with(HuginnAgent::CLI::New::PREFIX_QUESTION) { false }
         
     | 
| 
      
 27 
     | 
    
         
            +
                expect(cli).to receive(:yes?).with(HuginnAgent::CLI::New::MIT_QUESTION) { false }
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                capture(:stdout) { cli.new('test') }
         
     | 
| 
      
 30 
     | 
    
         
            +
                expect(File.exists?(File.join(sandbox, 'huginn_test'))).to be_falsy
         
     | 
| 
      
 31 
     | 
    
         
            +
                expect(File.exists?(File.join(sandbox, 'test'))).to be_truthy
         
     | 
| 
      
 32 
     | 
    
         
            +
                expect(File.exists?(File.join(sandbox, 'test', 'LICENSE.txt'))).to be_falsy
         
     | 
| 
      
 33 
     | 
    
         
            +
              end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
              it "asks to use a .env file" do
         
     | 
| 
      
 36 
     | 
    
         
            +
                expect(cli).to receive(:yes?).with(HuginnAgent::CLI::New::PREFIX_QUESTION) { false }
         
     | 
| 
      
 37 
     | 
    
         
            +
                expect(cli).to receive(:yes?).with(HuginnAgent::CLI::New::MIT_QUESTION) { false }
         
     | 
| 
      
 38 
     | 
    
         
            +
                expect(cli).to receive(:ask).with(HuginnAgent::CLI::New::DOT_ENV_QUESTION) { 1 }
         
     | 
| 
      
 39 
     | 
    
         
            +
                FileUtils.touch('.env')
         
     | 
| 
      
 40 
     | 
    
         
            +
                capture(:stdout) { cli.new('test') }
         
     | 
| 
      
 41 
     | 
    
         
            +
                FileUtils.rm('.env')
         
     | 
| 
      
 42 
     | 
    
         
            +
                expect(File.exists?(File.join(sandbox, 'huginn_test'))).to be_falsy
         
     | 
| 
      
 43 
     | 
    
         
            +
                expect(File.exists?(File.join(sandbox, 'test'))).to be_truthy
         
     | 
| 
      
 44 
     | 
    
         
            +
                expect(File.exists?(File.join(sandbox, 'test', '.env'))).to be_truthy
         
     | 
| 
      
 45 
     | 
    
         
            +
              end
         
     | 
| 
      
 46 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,31 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe HuginnAgent::Helper do
         
     | 
| 
      
 4 
     | 
    
         
            +
              context '#open3' do
         
     | 
| 
      
 5 
     | 
    
         
            +
                it "returns the exit status and output of the command" do
         
     | 
| 
      
 6 
     | 
    
         
            +
                  expect(HuginnAgent::Helper).not_to receive(:print)
         
     | 
| 
      
 7 
     | 
    
         
            +
                  (status, output) = HuginnAgent::Helper.open3("pwd", false)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  expect(status).to eq(0)
         
     | 
| 
      
 9 
     | 
    
         
            +
                  expect(output).to eq("#{Dir.pwd}\n")
         
     | 
| 
      
 10 
     | 
    
         
            +
                end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                it "prints the output directly when specified" do
         
     | 
| 
      
 13 
     | 
    
         
            +
                  expect(HuginnAgent::Helper).to receive(:print).twice
         
     | 
| 
      
 14 
     | 
    
         
            +
                  (status, output) = HuginnAgent::Helper.open3("pwd", true)
         
     | 
| 
      
 15 
     | 
    
         
            +
                  expect(status).to eq(0)
         
     | 
| 
      
 16 
     | 
    
         
            +
                  expect(output).to eq("#{Dir.pwd}\n")
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                it "return 1 as the status for failing command" do
         
     | 
| 
      
 20 
     | 
    
         
            +
                  (status, output) = HuginnAgent::Helper.open3("false", false)
         
     | 
| 
      
 21 
     | 
    
         
            +
                  expect(status).to eq(1)
         
     | 
| 
      
 22 
     | 
    
         
            +
                end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                it "returns 1 when an IOError occurred" do
         
     | 
| 
      
 25 
     | 
    
         
            +
                  expect(IO).to receive(:select).and_raise(IOError)
         
     | 
| 
      
 26 
     | 
    
         
            +
                  (status, output) = HuginnAgent::Helper.open3("pwd", false)
         
     | 
| 
      
 27 
     | 
    
         
            +
                  expect(status).to eq(1)
         
     | 
| 
      
 28 
     | 
    
         
            +
                  expect(output).to eq('IOError IOError')
         
     | 
| 
      
 29 
     | 
    
         
            +
                end
         
     | 
| 
      
 30 
     | 
    
         
            +
              end
         
     | 
| 
      
 31 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,37 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe HuginnAgent::SpecRunner do
         
     | 
| 
      
 4 
     | 
    
         
            +
              unless defined?(Bundler)
         
     | 
| 
      
 5 
     | 
    
         
            +
                class Bundler; def self.with_clean_env; yield end end
         
     | 
| 
      
 6 
     | 
    
         
            +
              end
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
              let(:runner) {HuginnAgent::SpecRunner.new }
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
              it "detects the gem name" do
         
     | 
| 
      
 11 
     | 
    
         
            +
                expect(runner.gem_name).to eq('huginn_agent')
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
              context '#shell_out' do
         
     | 
| 
      
 15 
     | 
    
         
            +
                it 'does not output anything without a specifing message' do
         
     | 
| 
      
 16 
     | 
    
         
            +
                  expect(runner).not_to receive(:puts)
         
     | 
| 
      
 17 
     | 
    
         
            +
                  runner.shell_out('pwd')
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                it "outputs the message and status information" do
         
     | 
| 
      
 21 
     | 
    
         
            +
                  output = capture(:stdout) { runner.shell_out('pwd', 'Testing') }
         
     | 
| 
      
 22 
     | 
    
         
            +
                  expect(output).to include('Testing')
         
     | 
| 
      
 23 
     | 
    
         
            +
                  expect(output).to include('OK')
         
     | 
| 
      
 24 
     | 
    
         
            +
                  expect(output).not_to include('FAIL')
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                it "output the called command on failure" do
         
     | 
| 
      
 28 
     | 
    
         
            +
                  output = capture(:stdout) {
         
     | 
| 
      
 29 
     | 
    
         
            +
                    expect { runner.shell_out('false', 'Testing') }.to raise_error(RuntimeError)
         
     | 
| 
      
 30 
     | 
    
         
            +
                  }
         
     | 
| 
      
 31 
     | 
    
         
            +
                  expect(output).to include('Testing')
         
     | 
| 
      
 32 
     | 
    
         
            +
                  expect(output).to include('FAIL')
         
     | 
| 
      
 33 
     | 
    
         
            +
                  expect(output).not_to include('OK')
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                end
         
     | 
| 
      
 36 
     | 
    
         
            +
              end
         
     | 
| 
      
 37 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,50 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe HuginnAgent do
         
     | 
| 
      
 4 
     | 
    
         
            +
              it 'has a version number' do
         
     | 
| 
      
 5 
     | 
    
         
            +
                expect(HuginnAgent::VERSION).not_to be nil
         
     | 
| 
      
 6 
     | 
    
         
            +
              end
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
              context '#load_tasks' do
         
     | 
| 
      
 9 
     | 
    
         
            +
                class Rake; end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
      
 12 
     | 
    
         
            +
                  expect(Rake).to receive(:add_rakelib)
         
     | 
| 
      
 13 
     | 
    
         
            +
                end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                it 'sets default values for branch and remote' do
         
     | 
| 
      
 16 
     | 
    
         
            +
                  HuginnAgent.load_tasks
         
     | 
| 
      
 17 
     | 
    
         
            +
                  expect(HuginnAgent.branch).to eq('master')
         
     | 
| 
      
 18 
     | 
    
         
            +
                  expect(HuginnAgent.remote).to eq('https://github.com/cantino/huginn.git')
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                it "sets branch and remote based on the passed options" do
         
     | 
| 
      
 22 
     | 
    
         
            +
                  HuginnAgent.load_tasks(branch: 'test', remote: 'http://git.example.com')
         
     | 
| 
      
 23 
     | 
    
         
            +
                  expect(HuginnAgent.branch).to eq('test')
         
     | 
| 
      
 24 
     | 
    
         
            +
                  expect(HuginnAgent.remote).to eq('http://git.example.com')
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
              end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
              context '#require!' do
         
     | 
| 
      
 29 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
      
 30 
     | 
    
         
            +
                  HuginnAgent.instance_variable_set(:@load_paths, [])
         
     | 
| 
      
 31 
     | 
    
         
            +
                  HuginnAgent.instance_variable_set(:@agent_paths, [])
         
     | 
| 
      
 32 
     | 
    
         
            +
                end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                it 'requires files passed to #load' do
         
     | 
| 
      
 35 
     | 
    
         
            +
                  HuginnAgent.load('/tmp/test.rb')
         
     | 
| 
      
 36 
     | 
    
         
            +
                  expect(HuginnAgent).to receive(:require).with('/tmp/test.rb')
         
     | 
| 
      
 37 
     | 
    
         
            +
                  HuginnAgent.require!
         
     | 
| 
      
 38 
     | 
    
         
            +
                end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                it 'requires files passwd to #register and assign adds the class name to Agents::TYPES' do
         
     | 
| 
      
 41 
     | 
    
         
            +
                  class Agent; TYPES = []; end
         
     | 
| 
      
 42 
     | 
    
         
            +
                  string_double= double('test_agent.rb', camelize: 'TestAgent')
         
     | 
| 
      
 43 
     | 
    
         
            +
                  expect(File).to receive(:basename).and_return(string_double)
         
     | 
| 
      
 44 
     | 
    
         
            +
                  HuginnAgent.register('/tmp/test_agent.rb')
         
     | 
| 
      
 45 
     | 
    
         
            +
                  expect(HuginnAgent).to receive(:require).with('/tmp/test_agent.rb')
         
     | 
| 
      
 46 
     | 
    
         
            +
                  HuginnAgent.require!
         
     | 
| 
      
 47 
     | 
    
         
            +
                  expect(Agent::TYPES).to eq(['Agents::TestAgent'])
         
     | 
| 
      
 48 
     | 
    
         
            +
                end
         
     | 
| 
      
 49 
     | 
    
         
            +
              end
         
     | 
| 
      
 50 
     | 
    
         
            +
            end
         
     | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | 
         @@ -1,2 +1,25 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'simplecov'
         
     | 
| 
      
 2 
     | 
    
         
            +
            SimpleCov.start
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
       1 
4 
     | 
    
         
             
            $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
         
     | 
| 
       2 
5 
     | 
    
         
             
            require 'huginn_agent'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'huginn_agent/cli'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require 'huginn_agent/spec_runner'
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            def capture(stream)
         
     | 
| 
      
 10 
     | 
    
         
            +
              begin
         
     | 
| 
      
 11 
     | 
    
         
            +
                stream = stream.to_s
         
     | 
| 
      
 12 
     | 
    
         
            +
                eval "$#{stream} = StringIO.new"
         
     | 
| 
      
 13 
     | 
    
         
            +
                yield
         
     | 
| 
      
 14 
     | 
    
         
            +
                result = eval("$#{stream}").string
         
     | 
| 
      
 15 
     | 
    
         
            +
              ensure
         
     | 
| 
      
 16 
     | 
    
         
            +
                eval("$#{stream} = #{stream.upcase}")
         
     | 
| 
      
 17 
     | 
    
         
            +
              end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
              result
         
     | 
| 
      
 20 
     | 
    
         
            +
            end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            RSpec.configure do |c|
         
     | 
| 
      
 23 
     | 
    
         
            +
              c.filter_run focus: true
         
     | 
| 
      
 24 
     | 
    
         
            +
              c.run_all_when_everything_filtered = true
         
     | 
| 
      
 25 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,15 +1,29 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: huginn_agent
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version:  
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.4.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Andrew Cantino
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-06-20 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: thor
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       13 
27 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
28 
     | 
    
         
             
              name: bundler
         
     | 
| 
       15 
29 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -42,35 +56,90 @@ dependencies: 
     | 
|
| 
       42 
56 
     | 
    
         
             
              name: rspec
         
     | 
| 
       43 
57 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       44 
58 
     | 
    
         
             
                requirements:
         
     | 
| 
       45 
     | 
    
         
            -
                - - " 
     | 
| 
      
 59 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       46 
60 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       47 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 61 
     | 
    
         
            +
                    version: '3.4'
         
     | 
| 
       48 
62 
     | 
    
         
             
              type: :development
         
     | 
| 
       49 
63 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       50 
64 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       51 
65 
     | 
    
         
             
                requirements:
         
     | 
| 
       52 
     | 
    
         
            -
                - - " 
     | 
| 
      
 66 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       53 
67 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       54 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 68 
     | 
    
         
            +
                    version: '3.4'
         
     | 
| 
      
 69 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 70 
     | 
    
         
            +
              name: simplecov
         
     | 
| 
      
 71 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 72 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 73 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 74 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 75 
     | 
    
         
            +
                    version: 0.11.2
         
     | 
| 
      
 76 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 77 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 78 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 79 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 80 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 81 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 82 
     | 
    
         
            +
                    version: 0.11.2
         
     | 
| 
      
 83 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 84 
     | 
    
         
            +
              name: guard
         
     | 
| 
      
 85 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 86 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 87 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 88 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 89 
     | 
    
         
            +
                    version: 2.13.0
         
     | 
| 
      
 90 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 91 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 92 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 93 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 94 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 95 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 96 
     | 
    
         
            +
                    version: 2.13.0
         
     | 
| 
      
 97 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 98 
     | 
    
         
            +
              name: guard-rspec
         
     | 
| 
      
 99 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 100 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 101 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 102 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 103 
     | 
    
         
            +
                    version: 4.6.5
         
     | 
| 
      
 104 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 105 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 106 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 107 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 108 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 109 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 110 
     | 
    
         
            +
                    version: 4.6.5
         
     | 
| 
       55 
111 
     | 
    
         
             
            description: 
         
     | 
| 
       56 
112 
     | 
    
         
             
            email:
         
     | 
| 
       57 
113 
     | 
    
         
             
            - cantino@gmail.com
         
     | 
| 
       58 
     | 
    
         
            -
            executables: 
     | 
| 
      
 114 
     | 
    
         
            +
            executables:
         
     | 
| 
      
 115 
     | 
    
         
            +
            - huginn_agent
         
     | 
| 
       59 
116 
     | 
    
         
             
            extensions: []
         
     | 
| 
       60 
117 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       61 
118 
     | 
    
         
             
            files:
         
     | 
| 
       62 
     | 
    
         
            -
            - ".gitignore"
         
     | 
| 
       63 
     | 
    
         
            -
            - ".rspec"
         
     | 
| 
       64 
     | 
    
         
            -
            - ".travis.yml"
         
     | 
| 
       65 
     | 
    
         
            -
            - Gemfile
         
     | 
| 
       66 
     | 
    
         
            -
            - Gemfile.lock
         
     | 
| 
       67 
119 
     | 
    
         
             
            - LICENSE.txt
         
     | 
| 
       68 
     | 
    
         
            -
            -  
     | 
| 
       69 
     | 
    
         
            -
            - Rakefile
         
     | 
| 
       70 
     | 
    
         
            -
            - huginn_agent.gemspec
         
     | 
| 
      
 120 
     | 
    
         
            +
            - bin/huginn_agent
         
     | 
| 
       71 
121 
     | 
    
         
             
            - lib/huginn_agent.rb
         
     | 
| 
      
 122 
     | 
    
         
            +
            - lib/huginn_agent/cli.rb
         
     | 
| 
      
 123 
     | 
    
         
            +
            - lib/huginn_agent/cli/new.rb
         
     | 
| 
      
 124 
     | 
    
         
            +
            - lib/huginn_agent/helper.rb
         
     | 
| 
      
 125 
     | 
    
         
            +
            - lib/huginn_agent/spec_helper.rb
         
     | 
| 
      
 126 
     | 
    
         
            +
            - lib/huginn_agent/spec_runner.rb
         
     | 
| 
      
 127 
     | 
    
         
            +
            - lib/huginn_agent/templates/newagent/Gemfile.tt
         
     | 
| 
      
 128 
     | 
    
         
            +
            - lib/huginn_agent/templates/newagent/LICENSE.txt.tt
         
     | 
| 
      
 129 
     | 
    
         
            +
            - lib/huginn_agent/templates/newagent/README.md.tt
         
     | 
| 
      
 130 
     | 
    
         
            +
            - lib/huginn_agent/templates/newagent/Rakefile.tt
         
     | 
| 
      
 131 
     | 
    
         
            +
            - lib/huginn_agent/templates/newagent/gitignore.tt
         
     | 
| 
      
 132 
     | 
    
         
            +
            - lib/huginn_agent/templates/newagent/lib/new_agent.rb.tt
         
     | 
| 
      
 133 
     | 
    
         
            +
            - lib/huginn_agent/templates/newagent/lib/new_agent/new_agent.rb.tt
         
     | 
| 
      
 134 
     | 
    
         
            +
            - lib/huginn_agent/templates/newagent/newagent.gemspec.tt
         
     | 
| 
      
 135 
     | 
    
         
            +
            - lib/huginn_agent/templates/newagent/spec/new_agent_spec.rb.tt
         
     | 
| 
      
 136 
     | 
    
         
            +
            - lib/huginn_agent/templates/newagent/travis.yml.tt
         
     | 
| 
       72 
137 
     | 
    
         
             
            - lib/huginn_agent/version.rb
         
     | 
| 
       73 
     | 
    
         
            -
            - spec 
     | 
| 
      
 138 
     | 
    
         
            +
            - lib/tasks/spec.rake
         
     | 
| 
      
 139 
     | 
    
         
            +
            - spec/lib/huginn_agent/cli/new_spec.rb
         
     | 
| 
      
 140 
     | 
    
         
            +
            - spec/lib/huginn_agent/helper_spec.rb
         
     | 
| 
      
 141 
     | 
    
         
            +
            - spec/lib/huginn_agent/spec_runner_spec.rb
         
     | 
| 
      
 142 
     | 
    
         
            +
            - spec/lib/huginn_agent_spec.rb
         
     | 
| 
       74 
143 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
| 
       75 
144 
     | 
    
         
             
            homepage: https://github.com/cantino/huginn
         
     | 
| 
       76 
145 
     | 
    
         
             
            licenses:
         
     | 
| 
         @@ -92,10 +161,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       92 
161 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       93 
162 
     | 
    
         
             
            requirements: []
         
     | 
| 
       94 
163 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       95 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
      
 164 
     | 
    
         
            +
            rubygems_version: 2.5.1
         
     | 
| 
       96 
165 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       97 
166 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       98 
167 
     | 
    
         
             
            summary: Helpers for making new Huginn Agents
         
     | 
| 
       99 
168 
     | 
    
         
             
            test_files:
         
     | 
| 
       100 
     | 
    
         
            -
            - spec/ 
     | 
| 
      
 169 
     | 
    
         
            +
            - spec/lib/huginn_agent/cli/new_spec.rb
         
     | 
| 
      
 170 
     | 
    
         
            +
            - spec/lib/huginn_agent/helper_spec.rb
         
     | 
| 
      
 171 
     | 
    
         
            +
            - spec/lib/huginn_agent/spec_runner_spec.rb
         
     | 
| 
      
 172 
     | 
    
         
            +
            - spec/lib/huginn_agent_spec.rb
         
     | 
| 
       101 
173 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
    
        data/.gitignore
    DELETED
    
    | 
         @@ -1 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            pkg
         
     | 
    
        data/.rspec
    DELETED
    
    
    
        data/.travis.yml
    DELETED
    
    
    
        data/Gemfile
    DELETED
    
    
    
        data/Gemfile.lock
    DELETED
    
    | 
         @@ -1,31 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            PATH
         
     | 
| 
       2 
     | 
    
         
            -
              remote: .
         
     | 
| 
       3 
     | 
    
         
            -
              specs:
         
     | 
| 
       4 
     | 
    
         
            -
                huginn_agent (0.1)
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
            GEM
         
     | 
| 
       7 
     | 
    
         
            -
              remote: https://rubygems.org/
         
     | 
| 
       8 
     | 
    
         
            -
              specs:
         
     | 
| 
       9 
     | 
    
         
            -
                diff-lcs (1.2.5)
         
     | 
| 
       10 
     | 
    
         
            -
                rake (10.3.2)
         
     | 
| 
       11 
     | 
    
         
            -
                rspec (3.1.0)
         
     | 
| 
       12 
     | 
    
         
            -
                  rspec-core (~> 3.1.0)
         
     | 
| 
       13 
     | 
    
         
            -
                  rspec-expectations (~> 3.1.0)
         
     | 
| 
       14 
     | 
    
         
            -
                  rspec-mocks (~> 3.1.0)
         
     | 
| 
       15 
     | 
    
         
            -
                rspec-core (3.1.4)
         
     | 
| 
       16 
     | 
    
         
            -
                  rspec-support (~> 3.1.0)
         
     | 
| 
       17 
     | 
    
         
            -
                rspec-expectations (3.1.2)
         
     | 
| 
       18 
     | 
    
         
            -
                  diff-lcs (>= 1.2.0, < 2.0)
         
     | 
| 
       19 
     | 
    
         
            -
                  rspec-support (~> 3.1.0)
         
     | 
| 
       20 
     | 
    
         
            -
                rspec-mocks (3.1.2)
         
     | 
| 
       21 
     | 
    
         
            -
                  rspec-support (~> 3.1.0)
         
     | 
| 
       22 
     | 
    
         
            -
                rspec-support (3.1.1)
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
            PLATFORMS
         
     | 
| 
       25 
     | 
    
         
            -
              ruby
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
            DEPENDENCIES
         
     | 
| 
       28 
     | 
    
         
            -
              bundler (~> 1.7)
         
     | 
| 
       29 
     | 
    
         
            -
              huginn_agent!
         
     | 
| 
       30 
     | 
    
         
            -
              rake (~> 10.0)
         
     | 
| 
       31 
     | 
    
         
            -
              rspec
         
     | 
    
        data/README.md
    DELETED
    
    | 
         @@ -1,19 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # HuginnAgent
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            This is a dependency for new external Huginn Agent Gems.
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            ## Installation
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
            Add this line to your Agent's gemspec:
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
            ```ruby
         
     | 
| 
       10 
     | 
    
         
            -
            spec.add_runtime_dependency "huginn_agent"
         
     | 
| 
       11 
     | 
    
         
            -
            ```
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
            ## Contributing
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
            1. Fork it ( https://github.com/[my-github-username]/huginn_agent/fork )
         
     | 
| 
       16 
     | 
    
         
            -
            2. Create your feature branch (`git checkout -b my-new-feature`)
         
     | 
| 
       17 
     | 
    
         
            -
            3. Commit your changes (`git commit -am 'Add some feature'`)
         
     | 
| 
       18 
     | 
    
         
            -
            4. Push to the branch (`git push origin my-new-feature`)
         
     | 
| 
       19 
     | 
    
         
            -
            5. Create a new Pull Request
         
     | 
    
        data/Rakefile
    DELETED
    
    
    
        data/huginn_agent.gemspec
    DELETED
    
    | 
         @@ -1,22 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # coding: utf-8
         
     | 
| 
       2 
     | 
    
         
            -
            lib = File.expand_path('../lib', __FILE__)
         
     | 
| 
       3 
     | 
    
         
            -
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            Gem::Specification.new do |spec|
         
     | 
| 
       6 
     | 
    
         
            -
              spec.name          = "huginn_agent"
         
     | 
| 
       7 
     | 
    
         
            -
              spec.version       = '0.1'
         
     | 
| 
       8 
     | 
    
         
            -
              spec.authors       = ["Andrew Cantino"]
         
     | 
| 
       9 
     | 
    
         
            -
              spec.email         = ["cantino@gmail.com"]
         
     | 
| 
       10 
     | 
    
         
            -
              spec.summary       = %q{Helpers for making new Huginn Agents}
         
     | 
| 
       11 
     | 
    
         
            -
              spec.homepage      = "https://github.com/cantino/huginn"
         
     | 
| 
       12 
     | 
    
         
            -
              spec.license       = "MIT"
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
              spec.files         = `git ls-files -z`.split("\x0")
         
     | 
| 
       15 
     | 
    
         
            -
              spec.executables   = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
         
     | 
| 
       16 
     | 
    
         
            -
              spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
         
     | 
| 
       17 
     | 
    
         
            -
              spec.require_paths = ["lib"]
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
              spec.add_development_dependency "bundler", "~> 1.7"
         
     | 
| 
       20 
     | 
    
         
            -
              spec.add_development_dependency "rake", "~> 10.0"
         
     | 
| 
       21 
     | 
    
         
            -
              spec.add_development_dependency "rspec"
         
     | 
| 
       22 
     | 
    
         
            -
            end
         
     |