huginn_agent 0.6.0 → 0.6.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b916efe568514474c9fd9aba9c80a809cf0fb12a
4
- data.tar.gz: 56b4428e2fdd46c42387d169e78ee231288e467b
2
+ SHA256:
3
+ metadata.gz: fbf31ce876fc5932b67910ad88cddc5b671ff71f1f26f1c8309e0b4ee06865a1
4
+ data.tar.gz: 47ea4315bf9f7cc204767fef2f4de3fba555e2276500b974be210bdbb8fdaefa
5
5
  SHA512:
6
- metadata.gz: ab3871b1d75cf6b96bf00f7126f19116f95bf058152dc6205736357c9aa7f35ba363b909bd41e7d70d2febbed2eafbdb847be59e0793c93fab3da476870021b8
7
- data.tar.gz: ef5d58ea0fa7b36baa7d8afb128a64ac46cff0d03a2960c849a84772d141a07d3f863b6a92c7735f577b0a083b6a3bb5d3f9fa25ef3a017b037f3978306f0457
6
+ metadata.gz: ff4b1d1a560a395feaca0112467c31b6f58c82546569154d969f7346ac4a58bf2e189dd9bd0db26997ff7b66df3ba69ba76082bebeb165c283f39f4a2fbf5516
7
+ data.tar.gz: 4e509923c31c4a7170044041d6c77c3a80c291a1a0c57dbb71026332dd723df51df2f7c22ab4e396535de39a195d62bdd3fc698fb4f03df3cea27d4d98f519ff
data/CHANGELOG.md CHANGED
@@ -10,6 +10,31 @@ All notable changes to this project will be documented in this file.
10
10
 
11
11
  ### Fixed
12
12
 
13
+ ## [0.6.2] - 2026-04-05
14
+
15
+ ### Changed
16
+
17
+ - Use shallow clone (`--depth 1`) when cloning and fetching the Huginn source for running specs
18
+ - Replace deprecated `Bundler.with_clean_env` with `Bundler.with_unbundled_env`
19
+ - Remove Rails classic loader fallback in favor of Zeitwerk only
20
+ - Loosen development dependency version constraints
21
+
22
+ ### Fixed
23
+
24
+ - Replace deprecated `File.exists?` with `File.exist?`
25
+
26
+ ## [0.6.1] - 2017-09-22
27
+
28
+ ### Added
29
+
30
+ - Example code for the `working` method when generating a new Agent gem
31
+
32
+ ### Changed
33
+
34
+ - Use `.env.example` file from Huginn when running the specs and no custom `.env` file is found, allows to run the specs as long as all Huginn dependencies are installed
35
+
36
+ ### Fixed
37
+
13
38
  ## [0.6.0] - 2017-04-12
14
39
 
15
40
  ### Changed
@@ -71,10 +96,12 @@ All notable changes to this project will be documented in this file.
71
96
  - First official and working release
72
97
 
73
98
 
74
- [Unreleased]: https://github.com/cantino/huginn_agent/compare/v0.6.0...HEAD
75
- [0.6.0]: https://github.com/cantino/huginn_agent/compare/v0.5.0...v0.6.0
76
- [0.5.0]: https://github.com/cantino/huginn_agent/compare/v0.4.3...v0.5.0
77
- [0.4.3]: https://github.com/cantino/huginn_agent/compare/v0.4.2...v0.4.3
78
- [0.4.2]: https://github.com/cantino/huginn_agent/compare/v0.4.1...v0.4.2
79
- [0.4.1]: https://github.com/cantino/huginn_agent/compare/v0.4.0...v0.4.1
80
- [0.4.0]: https://github.com/cantino/huginn_agent/compare/f6e307e2ec1679367ecc43ab265b8f68d6fe12f2...v0.4.0
99
+ [Unreleased]: https://github.com/huginn/huginn_agent/compare/v0.6.2...HEAD
100
+ [0.6.2]: https://github.com/huginn/huginn_agent/compare/v0.6.1...v0.6.2
101
+ [0.6.1]: https://github.com/huginn/huginn_agent/compare/v0.6.0...v0.6.1
102
+ [0.6.0]: https://github.com/huginn/huginn_agent/compare/v0.5.0...v0.6.0
103
+ [0.5.0]: https://github.com/huginn/huginn_agent/compare/v0.4.3...v0.5.0
104
+ [0.4.3]: https://github.com/huginn/huginn_agent/compare/v0.4.2...v0.4.3
105
+ [0.4.2]: https://github.com/huginn/huginn_agent/compare/v0.4.1...v0.4.2
106
+ [0.4.1]: https://github.com/huginn/huginn_agent/compare/v0.4.0...v0.4.1
107
+ [0.4.0]: https://github.com/huginn/huginn_agent/compare/f6e307e2ec1679367ecc43ab265b8f68d6fe12f2...v0.4.0
@@ -10,14 +10,14 @@ class HuginnAgent
10
10
  end
11
11
 
12
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 ...'
13
+ unless File.exist?('spec/huginn/.git')
14
+ shell_out "git clone --depth 1 #{HuginnAgent.remote} -b #{HuginnAgent.branch} spec/huginn", 'Cloning huginn source ...'
15
15
  end
16
16
  end
17
17
 
18
18
  def reset
19
19
  Dir.chdir('spec/huginn') do
20
- shell_out "git fetch && git reset --hard origin/#{HuginnAgent.branch}", 'Resetting Huginn source ...'
20
+ shell_out "git fetch --depth 1 && git reset --hard origin/#{HuginnAgent.branch}", 'Resetting Huginn source ...'
21
21
  end
22
22
  end
23
23
 
@@ -30,10 +30,13 @@ class HuginnAgent
30
30
  end
31
31
 
32
32
  def bundle
33
- if File.exists?('.env')
33
+ if File.exist?('.env')
34
34
  shell_out "cp .env spec/huginn"
35
35
  end
36
36
  Dir.chdir('spec/huginn') do
37
+ if !File.exist?('.env')
38
+ shell_out "cp .env.example .env"
39
+ end
37
40
  shell_out "bundle install --without development production -j 4", 'Installing ruby gems ...'
38
41
  end
39
42
 
@@ -54,7 +57,7 @@ class HuginnAgent
54
57
  def shell_out(command, message = nil, streaming_output = false)
55
58
  print message if message
56
59
 
57
- (status, output) = Bundler.with_clean_env do
60
+ (status, output) = Bundler.with_unbundled_env do
58
61
  ENV['ADDITIONAL_GEMS'] = "#{gem_name}(path: ../../)"
59
62
  ENV['RAILS_ENV'] = 'test'
60
63
  if streaming_output
@@ -6,11 +6,13 @@ TODO: Delete this and the text above, and describe your gem
6
6
 
7
7
  ## Installation
8
8
 
9
+ This gem is run as part of the [Huginn](https://github.com/huginn/huginn) project. If you haven't already, follow the [Getting Started](https://github.com/huginn/huginn#getting-started) instructions there.
10
+
9
11
  Add this string to your Huginn's .env `ADDITIONAL_GEMS` configuration:
10
12
 
11
13
  ```ruby
12
14
  <%=config[:gem_name]%>
13
- # when only using this agent gem it should look like hits:
15
+ # when only using this agent gem it should look like this:
14
16
  ADDITIONAL_GEMS=<%=config[:gem_name]%>
15
17
  ```
16
18
 
@@ -2,4 +2,4 @@
2
2
 
3
3
  require 'huginn_agent'
4
4
 
5
- HuginnAgent.load_tasks(branch: 'master', remote: 'https://github.com/cantino/huginn.git')
5
+ HuginnAgent.load_tasks(branch: 'master', remote: 'https://github.com/huginn/huginn.git')
@@ -1,6 +1,6 @@
1
1
  module Agents
2
2
  class <%=config[:constant_name] %> < Agent
3
- default_schedule '12h'
3
+ default_schedule 'every_12h'
4
4
 
5
5
  description <<-MD
6
6
  Add a Agent description here
@@ -14,6 +14,12 @@ module Agents
14
14
  def validate_options
15
15
  end
16
16
 
17
+ def working?
18
+ # Implement me! Maybe one of these next two lines would be a good fit?
19
+ # checked_without_error?
20
+ # received_event_without_error?
21
+ end
22
+
17
23
  # def check
18
24
  # end
19
25
 
@@ -1,4 +1,7 @@
1
1
  require 'huginn_agent'
2
2
 
3
+ # Allow to add views, controller, routes, etc...
4
+ class Engine < ::Rails::Engine; end
5
+
3
6
  #HuginnAgent.load '<%= config[:gem_name] %>/concerns/my_agent_concern'
4
7
  HuginnAgent.register '<%= config[:gem_name] %>/<%= config[:agent_file_name] %>'
@@ -1,3 +1,3 @@
1
1
  class HuginnAgent
2
- VERSION = '0.6.0'
2
+ VERSION = '0.6.2'
3
3
  end
data/lib/huginn_agent.rb CHANGED
@@ -6,7 +6,7 @@ class HuginnAgent
6
6
 
7
7
  def load_tasks(options = {})
8
8
  @branch = options[:branch] || 'master'
9
- @remote = options[:remote] || 'https://github.com/cantino/huginn.git'
9
+ @remote = options[:remote] || 'https://github.com/huginn/huginn.git'
10
10
  Rake.add_rakelib File.join(File.expand_path('../', __FILE__), 'tasks')
11
11
  end
12
12
 
@@ -27,7 +27,7 @@ class HuginnAgent
27
27
  require path
28
28
  end
29
29
  agent_paths.each do |path|
30
- require path
30
+ setup_zeitwerk_loader path
31
31
  Agent::TYPES << "Agents::#{File.basename(path.to_s).camelize}"
32
32
  end
33
33
  end
@@ -41,5 +41,17 @@ class HuginnAgent
41
41
  def agent_paths
42
42
  @agent_paths ||= []
43
43
  end
44
+
45
+ def setup_zeitwerk_loader(gem_path)
46
+ gem, _, mod_path = gem_path.partition('/')
47
+ gemspec = Gem::Specification.find_by_name(gem)
48
+ gem_dir = Pathname.new(gemspec.gem_dir)
49
+ module_dir = gem_dir + gemspec.require_paths[0] + gem
50
+
51
+ loader = Zeitwerk::Loader.new
52
+ loader.tag = gem
53
+ loader.push_dir(module_dir, namespace: Agents)
54
+ loader.setup
55
+ end
44
56
  end
45
57
  end
@@ -18,8 +18,8 @@ describe HuginnAgent::CLI::New do
18
18
  expect(cli).to receive(:yes?).with(HuginnAgent::CLI::New::PREFIX_QUESTION) { true }
19
19
  expect(cli).to receive(:yes?).with(HuginnAgent::CLI::New::MIT_QUESTION) { true }
20
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
21
+ expect(File.exist?(File.join(sandbox, 'huginn_test'))).to be_truthy
22
+ expect(File.exist?(File.join(sandbox, 'huginn_test', 'LICENSE.txt'))).to be_truthy
23
23
  end
24
24
 
25
25
  it "does not prefix the gem name and does notcopies the MIT license when told" do
@@ -27,9 +27,9 @@ describe HuginnAgent::CLI::New do
27
27
  expect(cli).to receive(:yes?).with(HuginnAgent::CLI::New::MIT_QUESTION) { false }
28
28
 
29
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
30
+ expect(File.exist?(File.join(sandbox, 'huginn_test'))).to be_falsy
31
+ expect(File.exist?(File.join(sandbox, 'test'))).to be_truthy
32
+ expect(File.exist?(File.join(sandbox, 'test', 'LICENSE.txt'))).to be_falsy
33
33
  end
34
34
 
35
35
  it "asks to use a .env file" do
@@ -39,8 +39,8 @@ describe HuginnAgent::CLI::New do
39
39
  FileUtils.touch('.env')
40
40
  capture(:stdout) { cli.new('test') }
41
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
42
+ expect(File.exist?(File.join(sandbox, 'huginn_test'))).to be_falsy
43
+ expect(File.exist?(File.join(sandbox, 'test'))).to be_truthy
44
+ expect(File.exist?(File.join(sandbox, 'test', '.env'))).to be_truthy
45
45
  end
46
46
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe HuginnAgent::SpecRunner do
4
4
  unless defined?(Bundler)
5
- class Bundler; def self.with_clean_env; yield end end
5
+ class Bundler; def self.with_unbundled_env; yield end end
6
6
  end
7
7
 
8
8
  let(:runner) {HuginnAgent::SpecRunner.new }
@@ -15,7 +15,7 @@ describe HuginnAgent do
15
15
  it 'sets default values for branch and remote' do
16
16
  HuginnAgent.load_tasks
17
17
  expect(HuginnAgent.branch).to eq('master')
18
- expect(HuginnAgent.remote).to eq('https://github.com/cantino/huginn.git')
18
+ expect(HuginnAgent.remote).to eq('https://github.com/huginn/huginn.git')
19
19
  end
20
20
 
21
21
  it "sets branch and remote based on the passed options" do
@@ -37,12 +37,12 @@ describe HuginnAgent do
37
37
  HuginnAgent.require!
38
38
  end
39
39
 
40
- it 'requires files passwd to #register and assign adds the class name to Agents::TYPES' do
40
+ it 'sets up Zeitwerk loader for registered paths and adds the class name to Agent::TYPES' do
41
41
  class Agent; TYPES = []; end
42
- string_double= double('test_agent.rb', camelize: 'TestAgent')
42
+ string_double = double('test_agent.rb', camelize: 'TestAgent')
43
43
  expect(File).to receive(:basename).and_return(string_double)
44
44
  HuginnAgent.register('/tmp/test_agent.rb')
45
- expect(HuginnAgent).to receive(:require).with('/tmp/test_agent.rb')
45
+ expect(HuginnAgent).to receive(:setup_zeitwerk_loader).with('/tmp/test_agent.rb')
46
46
  HuginnAgent.require!
47
47
  expect(Agent::TYPES).to eq(['Agents::TestAgent'])
48
48
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: huginn_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Cantino
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2017-04-12 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: thor
@@ -24,34 +23,20 @@ dependencies:
24
23
  - - ">="
25
24
  - !ruby/object:Gem::Version
26
25
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: bundler
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '1.7'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '1.7'
41
26
  - !ruby/object:Gem::Dependency
42
27
  name: rake
43
28
  requirement: !ruby/object:Gem::Requirement
44
29
  requirements:
45
- - - "~>"
30
+ - - ">="
46
31
  - !ruby/object:Gem::Version
47
- version: '10.0'
32
+ version: '0'
48
33
  type: :development
49
34
  prerelease: false
50
35
  version_requirements: !ruby/object:Gem::Requirement
51
36
  requirements:
52
- - - "~>"
37
+ - - ">="
53
38
  - !ruby/object:Gem::Version
54
- version: '10.0'
39
+ version: '0'
55
40
  - !ruby/object:Gem::Dependency
56
41
  name: rspec
57
42
  requirement: !ruby/object:Gem::Requirement
@@ -70,45 +55,44 @@ dependencies:
70
55
  name: simplecov
71
56
  requirement: !ruby/object:Gem::Requirement
72
57
  requirements:
73
- - - "~>"
58
+ - - ">="
74
59
  - !ruby/object:Gem::Version
75
- version: 0.11.2
60
+ version: '0'
76
61
  type: :development
77
62
  prerelease: false
78
63
  version_requirements: !ruby/object:Gem::Requirement
79
64
  requirements:
80
- - - "~>"
65
+ - - ">="
81
66
  - !ruby/object:Gem::Version
82
- version: 0.11.2
67
+ version: '0'
83
68
  - !ruby/object:Gem::Dependency
84
69
  name: guard
85
70
  requirement: !ruby/object:Gem::Requirement
86
71
  requirements:
87
- - - "~>"
72
+ - - ">="
88
73
  - !ruby/object:Gem::Version
89
- version: 2.13.0
74
+ version: '0'
90
75
  type: :development
91
76
  prerelease: false
92
77
  version_requirements: !ruby/object:Gem::Requirement
93
78
  requirements:
94
- - - "~>"
79
+ - - ">="
95
80
  - !ruby/object:Gem::Version
96
- version: 2.13.0
81
+ version: '0'
97
82
  - !ruby/object:Gem::Dependency
98
83
  name: guard-rspec
99
84
  requirement: !ruby/object:Gem::Requirement
100
85
  requirements:
101
- - - "~>"
86
+ - - ">="
102
87
  - !ruby/object:Gem::Version
103
- version: 4.6.5
88
+ version: '0'
104
89
  type: :development
105
90
  prerelease: false
106
91
  version_requirements: !ruby/object:Gem::Requirement
107
92
  requirements:
108
- - - "~>"
93
+ - - ">="
109
94
  - !ruby/object:Gem::Version
110
- version: 4.6.5
111
- description:
95
+ version: '0'
112
96
  email:
113
97
  - cantino@gmail.com
114
98
  executables:
@@ -144,11 +128,10 @@ files:
144
128
  - spec/lib/huginn_agent/spec_runner_spec.rb
145
129
  - spec/lib/huginn_agent_spec.rb
146
130
  - spec/spec_helper.rb
147
- homepage: https://github.com/cantino/huginn
131
+ homepage: https://github.com/huginn/huginn
148
132
  licenses:
149
133
  - MIT
150
134
  metadata: {}
151
- post_install_message:
152
135
  rdoc_options: []
153
136
  require_paths:
154
137
  - lib
@@ -163,9 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
163
146
  - !ruby/object:Gem::Version
164
147
  version: '0'
165
148
  requirements: []
166
- rubyforge_project:
167
- rubygems_version: 2.5.1
168
- signing_key:
149
+ rubygems_version: 4.0.6
169
150
  specification_version: 4
170
151
  summary: Helpers for making new Huginn Agents
171
152
  test_files: