Browse Source

initial effort on pulling Agents into gems

Andrew Cantino 10 years ago
parent
commit
ec0e10c50f

+ 3 - 1
Gemfile

@@ -1,5 +1,7 @@
 source 'https://rubygems.org'
 
+gem 'rss_agent', path: 'agents/rss_agent'
+
 # Optional libraries.  To conserve RAM, comment out any that you don't need,
 # then run `bundle` and commit the updated Gemfile and Gemfile.lock.
 gem 'twilio-ruby', '~> 3.11.5'    # TwilioAgent
@@ -44,7 +46,6 @@ gem 'devise', '~> 3.2.4'
 gem 'em-http-request', '~> 1.1.2'
 gem 'faraday', '~> 0.9.0'
 gem 'faraday_middleware'
-gem 'feed-normalizer'
 gem 'font-awesome-sass'
 gem 'foreman', '~> 0.63.0'
 # geokit-rails doesn't work with geokit 1.8.X but it specifies ~> 1.5
@@ -52,6 +53,7 @@ gem 'foreman', '~> 0.63.0'
 gem 'geokit', '~> 1.8.4'
 gem 'geokit-rails', '~> 2.0.1'
 gem 'httparty', '~> 0.13'
+gem 'huginn_agent'
 gem 'jquery-rails', '~> 3.1.0'
 gem 'json', '~> 1.8.1'
 gem 'jsonpath', '~> 0.5.6'

+ 10 - 1
Gemfile.lock

@@ -8,6 +8,13 @@ GIT
       http_parser.rb (~> 0.6.0)
       simple_oauth (~> 0.2.0)
 
+PATH
+  remote: agents/rss_agent
+  specs:
+    rss_agent (0.1)
+      feed-normalizer (~> 1.5.2)
+      huginn_agent
+
 GEM
   remote: https://rubygems.org/
   specs:
@@ -156,6 +163,7 @@ GEM
     httparty (0.13.1)
       json (~> 1.8)
       multi_xml (>= 0.5.2)
+    huginn_agent (0.1)
     i18n (0.6.11)
     jquery-rails (3.1.1)
       railties (>= 3.0, < 5.0)
@@ -408,7 +416,6 @@ DEPENDENCIES
   em-http-request (~> 1.1.2)
   faraday (~> 0.9.0)
   faraday_middleware
-  feed-normalizer
   ffi (>= 1.9.4)
   font-awesome-sass
   forecast_io (~> 2.0.0)
@@ -418,6 +425,7 @@ DEPENDENCIES
   google-api-client
   hipchat (~> 1.2.0)
   httparty (~> 0.13)
+  huginn_agent
   jquery-rails (~> 3.1.0)
   json (~> 1.8.1)
   jsonpath (~> 0.5.6)
@@ -443,6 +451,7 @@ DEPENDENCIES
   rspec (~> 2.99)
   rspec-collection_matchers
   rspec-rails (~> 2.99)
+  rss_agent!
   rturk (~> 2.12.1)
   ruby-growl (~> 4.1.0)
   rufus-scheduler (~> 3.0.8)

+ 7 - 0
Rakefile

@@ -5,3 +5,10 @@
 require File.expand_path('../config/application', __FILE__)
 
 Huginn::Application.load_tasks
+
+task("spec").clear
+RSpec::Core::RakeTask.new(:spec) do |t|
+  t.pattern = ['spec/**/*_spec.rb', 'agents/**/spec/**/*_spec.rb']
+end
+
+task :default => :spec

+ 22 - 0
agents/rss_agent/LICENSE.txt

@@ -0,0 +1,22 @@
+Copyright (c) 2014 Andrew Cantino
+
+MIT License
+
+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:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+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
app/models/agents/rss_agent.rb → agents/rss_agent/lib/huginn_agent/rss_agent.rb


+ 3 - 0
agents/rss_agent/lib/rss_agent.rb

@@ -0,0 +1,3 @@
+require 'huginn_agent'
+
+HuginnAgent.register 'huginn_agent/rss_agent'

+ 25 - 0
agents/rss_agent/rss_agent.gemspec

@@ -0,0 +1,25 @@
+# coding: utf-8
+lib = File.expand_path('../lib', __FILE__)
+$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
+
+Gem::Specification.new do |spec|
+  spec.name          = "rss_agent"
+  spec.version       = '0.1'
+  spec.authors       = ["Andrew Cantino"]
+  spec.email         = ["https://github.com/cantino/huginn"]
+  spec.summary       = %q{The default Huginn RSSAgent for consuming RSS and Atom feeds.}
+  spec.homepage      = "https://github.com/cantino/huginn"
+  spec.license       = "MIT"
+
+  spec.files         = `git ls-files -z`.split("\x0")
+  spec.executables   = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
+  spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
+  spec.require_paths = ["lib"]
+
+  spec.add_development_dependency "bundler", "~> 1.7"
+  spec.add_development_dependency "rake", "~> 10.0"
+  spec.add_development_dependency "rspec"
+  
+  spec.add_runtime_dependency "huginn_agent"
+  spec.add_runtime_dependency "feed-normalizer", "~> 1.5.2"
+end

+ 0 - 0
spec/models/agents/rss_agent_spec.rb → agents/rss_agent/spec/rss_agent_spec.rb


+ 2 - 1
config/initializers/requires.rb

@@ -1 +1,2 @@
-require 'pp'
+require 'pp'
+HuginnAgent.require!