huginn_agent 0.6.2 → 0.6.4
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/CHANGELOG.md +34 -4
- data/lib/huginn_agent/cli/new.rb +1 -1
- data/lib/huginn_agent/patches/coverage.rb +8 -5
- data/lib/huginn_agent/patches/gemfile_helper.rb +3 -6
- data/lib/huginn_agent/spec_runner.rb +8 -1
- data/lib/huginn_agent/templates/newagent/github/workflows/ci.yml.tt +80 -0
- data/lib/huginn_agent/version.rb +1 -1
- data/lib/huginn_agent.rb +1 -13
- data/spec/lib/huginn_agent/patches/gemfile_helper_spec.rb +30 -0
- data/spec/lib/huginn_agent/spec_runner_spec.rb +33 -0
- data/spec/lib/huginn_agent_spec.rb +2 -2
- metadata +4 -2
- data/lib/huginn_agent/templates/newagent/travis.yml.tt +0 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a40e16107a7ac0b8d0d29861cb4cfbefda5efaba359a32b20e54315bfc298ad4
|
|
4
|
+
data.tar.gz: baed6d68490f6e42e1fafefe0422ec8788a154d47c7c2f58165141a235478f33
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e1e31053c8d1f008099f17eeac1b56fffbb48ea7d1f0fef8524bb616545a68a16a1f602a3cfa78eb3aeab1aa410e1ab47da09463515b13b2edad482ee8e2a8ce
|
|
7
|
+
data.tar.gz: 85dba6e68caf47559e1bf9353ee5e523c33911763fc20611f1edba222db02b45832bbaf38655684bcd39fae6b4eff45361767df895141f241255ad0db0a7a7d6
|
data/CHANGELOG.md
CHANGED
|
@@ -2,25 +2,53 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## [0.6.4] - 2026-04-05
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Require registered agent files directly
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- Skip duplicate gems from Huginn when loading development dependencies
|
|
14
|
+
|
|
15
|
+
## [0.6.3] - 2026-04-05
|
|
6
16
|
|
|
7
17
|
### Added
|
|
8
18
|
|
|
19
|
+
- Generate a GitHub Actions CI workflow for new Agent gems
|
|
20
|
+
|
|
9
21
|
### Changed
|
|
10
22
|
|
|
23
|
+
- Replace the generated Travis CI config with GitHub Actions
|
|
24
|
+
|
|
11
25
|
### Fixed
|
|
12
26
|
|
|
27
|
+
- Make `SpecRunner` compatible with current Bundler behavior in CI
|
|
28
|
+
- Remove stale `spec/huginn/db/schema.rb` before running database setup
|
|
29
|
+
- Skip Coveralls initialization when the gem is unavailable
|
|
30
|
+
|
|
13
31
|
## [0.6.2] - 2026-04-05
|
|
14
32
|
|
|
33
|
+
### Added
|
|
34
|
+
|
|
35
|
+
- Define `Rails::Engine` in generated Agent gems (@alessio-signorini)
|
|
36
|
+
- Make compatible with Rails 6 & 7 Zeitwerk loader (@overhacked)
|
|
37
|
+
|
|
15
38
|
### Changed
|
|
16
39
|
|
|
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
40
|
- Remove Rails classic loader fallback in favor of Zeitwerk only
|
|
41
|
+
- Replace deprecated `Bundler.with_clean_env` with `Bundler.with_unbundled_env`
|
|
20
42
|
- Loosen development dependency version constraints
|
|
43
|
+
- Use shallow clone (`--depth 1`) when cloning and fetching the Huginn source for running specs
|
|
44
|
+
- Migrate CI from Travis to GitHub Actions
|
|
45
|
+
- Add RubyGems trusted publishing workflow
|
|
21
46
|
|
|
22
47
|
### Fixed
|
|
23
48
|
|
|
49
|
+
- Fix invalid argument for `default_schedule` (@sfischer13)
|
|
50
|
+
- Update URLs (@sfischer13)
|
|
51
|
+
- Fix typo in README (@pacharanero)
|
|
24
52
|
- Replace deprecated `File.exists?` with `File.exist?`
|
|
25
53
|
|
|
26
54
|
## [0.6.1] - 2017-09-22
|
|
@@ -96,7 +124,9 @@ All notable changes to this project will be documented in this file.
|
|
|
96
124
|
- First official and working release
|
|
97
125
|
|
|
98
126
|
|
|
99
|
-
[Unreleased]: https://github.com/huginn/huginn_agent/compare/v0.6.
|
|
127
|
+
[Unreleased]: https://github.com/huginn/huginn_agent/compare/v0.6.4...HEAD
|
|
128
|
+
[0.6.4]: https://github.com/huginn/huginn_agent/compare/v0.6.3...v0.6.4
|
|
129
|
+
[0.6.3]: https://github.com/huginn/huginn_agent/compare/v0.6.2...v0.6.3
|
|
100
130
|
[0.6.2]: https://github.com/huginn/huginn_agent/compare/v0.6.1...v0.6.2
|
|
101
131
|
[0.6.1]: https://github.com/huginn/huginn_agent/compare/v0.6.0...v0.6.1
|
|
102
132
|
[0.6.0]: https://github.com/huginn/huginn_agent/compare/v0.5.0...v0.6.0
|
data/lib/huginn_agent/cli/new.rb
CHANGED
|
@@ -48,7 +48,7 @@ class HuginnAgent
|
|
|
48
48
|
"newagent.gemspec.tt" => "#{gem_name}.gemspec",
|
|
49
49
|
"Rakefile.tt" => "Rakefile",
|
|
50
50
|
"README.md.tt" => "README.md",
|
|
51
|
-
"
|
|
51
|
+
"github/workflows/ci.yml.tt" => ".github/workflows/ci.yml"
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
if thor.yes?(MIT_QUESTION)
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
require 'simplecov'
|
|
2
2
|
|
|
3
3
|
if !ENV['COVERAGE']
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
module
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
begin
|
|
5
|
+
require 'coveralls'
|
|
6
|
+
module Coveralls
|
|
7
|
+
module Configuration
|
|
8
|
+
def self.root
|
|
9
|
+
File.expand_path(File.join(Dir.pwd, '../..'))
|
|
10
|
+
end
|
|
9
11
|
end
|
|
10
12
|
end
|
|
13
|
+
rescue LoadError
|
|
11
14
|
end
|
|
12
15
|
end
|
|
13
16
|
|
|
@@ -7,12 +7,9 @@ class GemfileHelper
|
|
|
7
7
|
gemspec = Dir["#{base_path}/*.gemspec"].first
|
|
8
8
|
previous_gems = Hash[dependencies.map { |dep| [dep.name, dep] }]
|
|
9
9
|
Gem::Specification.load(gemspec).development_dependencies.each do |args|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
else
|
|
14
|
-
yield args.name, *args.requirements_list
|
|
15
|
-
end
|
|
10
|
+
next if previous_gems.key?(args.name)
|
|
11
|
+
|
|
12
|
+
yield args.name, *args.requirements_list
|
|
16
13
|
end
|
|
17
14
|
end
|
|
18
15
|
end
|
|
@@ -37,13 +37,15 @@ class HuginnAgent
|
|
|
37
37
|
if !File.exist?('.env')
|
|
38
38
|
shell_out "cp .env.example .env"
|
|
39
39
|
end
|
|
40
|
-
shell_out "bundle
|
|
40
|
+
shell_out "bundle config set --local without 'development production'"
|
|
41
|
+
shell_out 'bundle install -j 4', 'Installing ruby gems ...'
|
|
41
42
|
end
|
|
42
43
|
|
|
43
44
|
end
|
|
44
45
|
|
|
45
46
|
def database
|
|
46
47
|
Dir.chdir('spec/huginn') do
|
|
48
|
+
remove_schema
|
|
47
49
|
shell_out('bundle exec rake db:create db:migrate', 'Creating database ...')
|
|
48
50
|
end
|
|
49
51
|
end
|
|
@@ -76,5 +78,10 @@ class HuginnAgent
|
|
|
76
78
|
fail
|
|
77
79
|
end
|
|
78
80
|
end
|
|
81
|
+
|
|
82
|
+
private
|
|
83
|
+
def remove_schema
|
|
84
|
+
File.delete('db/schema.rb') if File.exist?('db/schema.rb')
|
|
85
|
+
end
|
|
79
86
|
end
|
|
80
87
|
end
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test-postgresql:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
|
|
12
|
+
services:
|
|
13
|
+
postgres:
|
|
14
|
+
image: postgres:17
|
|
15
|
+
env:
|
|
16
|
+
POSTGRES_USER: huginn
|
|
17
|
+
POSTGRES_PASSWORD: huginn
|
|
18
|
+
POSTGRES_DB: huginn_test
|
|
19
|
+
ports:
|
|
20
|
+
- 5432:5432
|
|
21
|
+
options: >-
|
|
22
|
+
--health-cmd="pg_isready"
|
|
23
|
+
--health-interval=10s
|
|
24
|
+
--health-timeout=5s
|
|
25
|
+
--health-retries=5
|
|
26
|
+
|
|
27
|
+
env:
|
|
28
|
+
DATABASE_ADAPTER: postgresql
|
|
29
|
+
DATABASE_HOST: 127.0.0.1
|
|
30
|
+
DATABASE_USERNAME: huginn
|
|
31
|
+
DATABASE_PASSWORD: huginn
|
|
32
|
+
DATABASE_NAME: huginn_test
|
|
33
|
+
APP_SECRET_TOKEN: 0b4a2a529a3bb09cc39561e117c13d6e04288e144c322b8d577b0e4589435dce8f512a0e0d7e17c54802a5575c92e1e68550cd18
|
|
34
|
+
|
|
35
|
+
steps:
|
|
36
|
+
- uses: actions/checkout@v4
|
|
37
|
+
|
|
38
|
+
- uses: ruby/setup-ruby@v1
|
|
39
|
+
with:
|
|
40
|
+
ruby-version: "3.4"
|
|
41
|
+
bundler-cache: true
|
|
42
|
+
|
|
43
|
+
- name: Run tests
|
|
44
|
+
run: bundle exec rake
|
|
45
|
+
|
|
46
|
+
test-mysql:
|
|
47
|
+
runs-on: ubuntu-latest
|
|
48
|
+
|
|
49
|
+
services:
|
|
50
|
+
mysql:
|
|
51
|
+
image: mysql:8.0
|
|
52
|
+
env:
|
|
53
|
+
MYSQL_ROOT_PASSWORD: huginn
|
|
54
|
+
MYSQL_DATABASE: huginn_test
|
|
55
|
+
ports:
|
|
56
|
+
- 3306:3306
|
|
57
|
+
options: >-
|
|
58
|
+
--health-cmd="mysqladmin ping -h 127.0.0.1"
|
|
59
|
+
--health-interval=10s
|
|
60
|
+
--health-timeout=5s
|
|
61
|
+
--health-retries=5
|
|
62
|
+
|
|
63
|
+
env:
|
|
64
|
+
DATABASE_ADAPTER: mysql2
|
|
65
|
+
DATABASE_HOST: 127.0.0.1
|
|
66
|
+
DATABASE_USERNAME: root
|
|
67
|
+
DATABASE_PASSWORD: huginn
|
|
68
|
+
DATABASE_NAME: huginn_test
|
|
69
|
+
APP_SECRET_TOKEN: 0b4a2a529a3bb09cc39561e117c13d6e04288e144c322b8d577b0e4589435dce8f512a0e0d7e17c54802a5575c92e1e68550cd18
|
|
70
|
+
|
|
71
|
+
steps:
|
|
72
|
+
- uses: actions/checkout@v4
|
|
73
|
+
|
|
74
|
+
- uses: ruby/setup-ruby@v1
|
|
75
|
+
with:
|
|
76
|
+
ruby-version: "3.4"
|
|
77
|
+
bundler-cache: true
|
|
78
|
+
|
|
79
|
+
- name: Run tests
|
|
80
|
+
run: bundle exec rake
|
data/lib/huginn_agent/version.rb
CHANGED
data/lib/huginn_agent.rb
CHANGED
|
@@ -27,7 +27,7 @@ class HuginnAgent
|
|
|
27
27
|
require path
|
|
28
28
|
end
|
|
29
29
|
agent_paths.each do |path|
|
|
30
|
-
|
|
30
|
+
require path
|
|
31
31
|
Agent::TYPES << "Agents::#{File.basename(path.to_s).camelize}"
|
|
32
32
|
end
|
|
33
33
|
end
|
|
@@ -41,17 +41,5 @@ 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
|
|
56
44
|
end
|
|
57
45
|
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'rubygems/dependency'
|
|
3
|
+
|
|
4
|
+
describe 'gemfile_helper patch' do
|
|
5
|
+
let(:patch_path) { File.expand_path('../../../../lib/huginn_agent/patches/gemfile_helper.rb', __dir__) }
|
|
6
|
+
let(:rspec_dependency) { Gem::Dependency.new('rspec', '>= 0') }
|
|
7
|
+
let(:thor_dependency) { Gem::Dependency.new('thor', '~> 1.5') }
|
|
8
|
+
let(:gemspec) { instance_double(Gem::Specification, development_dependencies: [rspec_dependency, thor_dependency]) }
|
|
9
|
+
|
|
10
|
+
let(:context) do
|
|
11
|
+
Object.new.tap do |object|
|
|
12
|
+
object.instance_variable_set(:@dependencies, [Gem::Dependency.new('rspec', '~> 3.13')])
|
|
13
|
+
object.instance_variable_set(:@added_gems, [])
|
|
14
|
+
|
|
15
|
+
object.define_singleton_method(:dependencies) { @dependencies }
|
|
16
|
+
object.define_singleton_method(:gem) { |*args| @added_gems << args }
|
|
17
|
+
object.define_singleton_method(:added_gems) { @added_gems }
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
before do
|
|
22
|
+
allow(Gem::Specification).to receive(:load).and_return(gemspec)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'does not add development dependencies already present in Huginn' do
|
|
26
|
+
context.instance_eval(File.read(patch_path), patch_path)
|
|
27
|
+
|
|
28
|
+
expect(context.added_gems).to eq([['thor']])
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -34,4 +34,37 @@ describe HuginnAgent::SpecRunner do
|
|
|
34
34
|
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
|
+
|
|
38
|
+
context '#bundle' do
|
|
39
|
+
before do
|
|
40
|
+
allow(Dir).to receive(:chdir).with('spec/huginn').and_yield
|
|
41
|
+
allow(File).to receive(:exist?).and_call_original
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it 'uses bundle config instead of --without' do
|
|
45
|
+
allow(File).to receive(:exist?).with('.env').and_return(false)
|
|
46
|
+
|
|
47
|
+
expect(runner).to receive(:shell_out).with("cp .env.example .env").ordered
|
|
48
|
+
expect(runner).to receive(:shell_out).with("bundle config set --local without 'development production'").ordered
|
|
49
|
+
expect(runner).to receive(:shell_out).with('bundle install -j 4', 'Installing ruby gems ...').ordered
|
|
50
|
+
|
|
51
|
+
runner.bundle
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
context '#database' do
|
|
56
|
+
before do
|
|
57
|
+
allow(Dir).to receive(:chdir).with('spec/huginn').and_yield
|
|
58
|
+
allow(File).to receive(:exist?).and_call_original
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
it 'removes a generated schema before migrating' do
|
|
62
|
+
allow(File).to receive(:exist?).with('db/schema.rb').and_return(true)
|
|
63
|
+
|
|
64
|
+
expect(File).to receive(:delete).with('db/schema.rb').ordered
|
|
65
|
+
expect(runner).to receive(:shell_out).with('bundle exec rake db:create db:migrate', 'Creating database ...').ordered
|
|
66
|
+
|
|
67
|
+
runner.database
|
|
68
|
+
end
|
|
69
|
+
end
|
|
37
70
|
end
|
|
@@ -37,12 +37,12 @@ describe HuginnAgent do
|
|
|
37
37
|
HuginnAgent.require!
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
-
it '
|
|
40
|
+
it 'requires registered paths and adds the class name to Agent::TYPES' do
|
|
41
41
|
class Agent; TYPES = []; end
|
|
42
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(:
|
|
45
|
+
expect(HuginnAgent).to receive(:require).with('/tmp/test_agent.rb')
|
|
46
46
|
HuginnAgent.require!
|
|
47
47
|
expect(Agent::TYPES).to eq(['Agents::TestAgent'])
|
|
48
48
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: huginn_agent
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew Cantino
|
|
@@ -115,16 +115,17 @@ files:
|
|
|
115
115
|
- lib/huginn_agent/templates/newagent/LICENSE.txt.tt
|
|
116
116
|
- lib/huginn_agent/templates/newagent/README.md.tt
|
|
117
117
|
- lib/huginn_agent/templates/newagent/Rakefile.tt
|
|
118
|
+
- lib/huginn_agent/templates/newagent/github/workflows/ci.yml.tt
|
|
118
119
|
- lib/huginn_agent/templates/newagent/gitignore.tt
|
|
119
120
|
- lib/huginn_agent/templates/newagent/lib/new_agent.rb.tt
|
|
120
121
|
- lib/huginn_agent/templates/newagent/lib/new_agent/new_agent.rb.tt
|
|
121
122
|
- lib/huginn_agent/templates/newagent/newagent.gemspec.tt
|
|
122
123
|
- lib/huginn_agent/templates/newagent/spec/new_agent_spec.rb.tt
|
|
123
|
-
- lib/huginn_agent/templates/newagent/travis.yml.tt
|
|
124
124
|
- lib/huginn_agent/version.rb
|
|
125
125
|
- lib/tasks/spec.rake
|
|
126
126
|
- spec/lib/huginn_agent/cli/new_spec.rb
|
|
127
127
|
- spec/lib/huginn_agent/helper_spec.rb
|
|
128
|
+
- spec/lib/huginn_agent/patches/gemfile_helper_spec.rb
|
|
128
129
|
- spec/lib/huginn_agent/spec_runner_spec.rb
|
|
129
130
|
- spec/lib/huginn_agent_spec.rb
|
|
130
131
|
- spec/spec_helper.rb
|
|
@@ -152,6 +153,7 @@ summary: Helpers for making new Huginn Agents
|
|
|
152
153
|
test_files:
|
|
153
154
|
- spec/lib/huginn_agent/cli/new_spec.rb
|
|
154
155
|
- spec/lib/huginn_agent/helper_spec.rb
|
|
156
|
+
- spec/lib/huginn_agent/patches/gemfile_helper_spec.rb
|
|
155
157
|
- spec/lib/huginn_agent/spec_runner_spec.rb
|
|
156
158
|
- spec/lib/huginn_agent_spec.rb
|
|
157
159
|
- spec/spec_helper.rb
|
|
@@ -1,13 +0,0 @@
|
|
|
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.2.2
|
|
11
|
-
- 2.3.0
|
|
12
|
-
cache: bundler
|
|
13
|
-
script: bundle exec rake
|