syslog 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d612e3dcc5ded7a09900b9c414f8300c36b416eee15db2e8b3f8d0c768ece92d
4
- data.tar.gz: dd94d87e07ad867e68a8e0f90c20dc2844bba256618d825409b17c81f91b89e1
3
+ metadata.gz: 4380feb49c69d3151f1180c3bb4709e81b002dbb5ed92f509a1496e2df2b8b82
4
+ data.tar.gz: b5d3d89e6b8554aaa2bc0355f675473304eb6687e8bfd34d0912d9b1429eb2ec
5
5
  SHA512:
6
- metadata.gz: bdf1d2f0ebe14aee8d3b222fe519e48d2d35b5e9b9ede1159f080fa30df3eb24078c5611a2c5bc9deddce67dae470d6dd1774d68dcfd37c289dca8889e1d60b2
7
- data.tar.gz: 4e914f4c4500ca1e65f4e8d47b65fe7818382c18c585c1b5104f7b826ed7e84262c99771c23d359238a64aec406f9e74ef8124e7c8bbb96e2cd698b3d783ef0d
6
+ metadata.gz: a6bc1cb6b33cabcbb9962e10e49053ab4939582bc59129cc291f304a781487da807fea267de2cc05b2cbf61f4ec31e0d45dbeba3f5c721a184744f6b7c31f705
7
+ data.tar.gz: eea9e7881550f036387d03fd73b3e5497d550f41ded31da7d7925c522a515ef76cd6aa0a14c920eb709d8a126442d5b741a92353ae5b2a619c5e8b624b133fba
@@ -0,0 +1 @@
1
+ * @knu
@@ -0,0 +1,46 @@
1
+ name: Publish gem to rubygems.org
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ push:
13
+ if: github.repository == 'ruby/syslog'
14
+ runs-on: ubuntu-latest
15
+
16
+ environment:
17
+ name: rubygems.org
18
+ url: https://rubygems.org/gems/syslog
19
+
20
+ permissions:
21
+ contents: write
22
+ id-token: write
23
+
24
+ steps:
25
+ - name: Harden Runner
26
+ uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
27
+ with:
28
+ egress-policy: audit
29
+
30
+ - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
31
+
32
+ - name: Set up Ruby
33
+ uses: ruby/setup-ruby@a6e6f86333f0a2523ece813039b8b4be04560854 # v1.190.0
34
+ with:
35
+ bundler-cache: true
36
+ ruby-version: ruby
37
+
38
+ - name: Publish to RubyGems
39
+ uses: rubygems/release-gem@9e85cb11501bebc2ae661c1500176316d3987059 # v1.1.0
40
+
41
+ - name: Create GitHub release
42
+ run: |
43
+ tag_name="$(git describe --tags --abbrev=0)"
44
+ gh release create "${tag_name}" --verify-tag --generate-notes
45
+ env:
46
+ GITHUB_TOKEN: ${{ secrets.MATZBOT_GITHUB_WORKFLOW_TOKEN }}
@@ -8,10 +8,14 @@ jobs:
8
8
  strategy:
9
9
  matrix:
10
10
  ruby: [ 2.7, 2.6, 2.5, head ]
11
- os: [ ubuntu-latest, macos-latest ]
11
+ os: [ ubuntu-latest, macos-latest, windows-latest ]
12
+ exclude:
13
+ - { os: macos-latest, ruby: '2.5' }
14
+ include:
15
+ - { os: macos-13, ruby: '2.5' }
12
16
  runs-on: ${{ matrix.os }}
13
17
  steps:
14
- - uses: actions/checkout@v3
18
+ - uses: actions/checkout@v4
15
19
  - name: Set up Ruby
16
20
  uses: ruby/setup-ruby@v1
17
21
  with:
data/README.md CHANGED
@@ -24,6 +24,7 @@ Or install it yourself as:
24
24
  ## Usage
25
25
 
26
26
  ```ruby
27
+ require "syslog"
27
28
  Syslog.open("webrick", Syslog::LOG_PID,
28
29
  Syslog::LOG_DAEMON | Syslog::LOG_LOCAL3)
29
30
  ```
data/Rakefile CHANGED
@@ -8,5 +8,13 @@ Rake::TestTask.new(:test) do |t|
8
8
  end
9
9
 
10
10
  require 'rake/extensiontask'
11
- Rake::ExtensionTask.new("syslog")
11
+ Rake::ExtensionTask.new("syslog_ext") do |ext|
12
+ ext.ext_dir = 'ext/syslog'
13
+
14
+ # In contrast to "gem install" a "rake compile" is expecting the C-ext file even on Windows.
15
+ # Work around by creating a dummy so file.
16
+ task "#{ext.tmp_dir}/#{ext.platform}/stage/lib" do |t|
17
+ touch "#{ext.tmp_dir}/#{ext.platform}/#{ext.name}/#{RUBY_VERSION}/#{ext.name}.so"
18
+ end
19
+ end
12
20
  task :default => :test
@@ -4,10 +4,23 @@
4
4
 
5
5
  require 'mkmf'
6
6
 
7
- have_library("log") # for Android
7
+ def generate_dummy_makefile
8
+ File.open("Makefile", "w") do |f|
9
+ f.puts dummy_makefile("syslog_ext").join
10
+ end
11
+ end
8
12
 
9
- have_header("syslog.h") &&
10
- have_func("openlog") &&
11
- have_func("setlogmask") &&
12
- create_makefile("syslog")
13
+ def windows?
14
+ RbConfig::CONFIG["host_os"] =~ /mswin|mingw|cygwin/
15
+ end
13
16
 
17
+ if windows?
18
+ generate_dummy_makefile
19
+ else
20
+ have_library("log") # for Android
21
+
22
+ have_header("syslog.h") &&
23
+ have_func("openlog") &&
24
+ have_func("setlogmask") &&
25
+ create_makefile("syslog_ext")
26
+ end
data/ext/syslog/syslog.c CHANGED
@@ -12,6 +12,8 @@
12
12
  #include "ruby/util.h"
13
13
  #include <syslog.h>
14
14
 
15
+ #define SYSLOG_VERSION "0.2.0"
16
+
15
17
  /* Syslog class */
16
18
  static VALUE mSyslog;
17
19
  /*
@@ -413,7 +415,7 @@ static VALUE mSyslogMacros_included(VALUE mod, VALUE target)
413
415
  *
414
416
  * The syslog protocol is standardized in RFC 5424.
415
417
  */
416
- void Init_syslog(void)
418
+ void Init_syslog_ext(void)
417
419
  {
418
420
  #undef rb_intern
419
421
  mSyslog = rb_define_module("Syslog");
@@ -574,6 +576,8 @@ void Init_syslog(void)
574
576
 
575
577
  /* Syslog macros */
576
578
 
579
+ rb_define_const(mSyslog, "VERSION", rb_str_new_cstr(SYSLOG_VERSION));
580
+
577
581
  rb_define_method(mSyslogMacros, "LOG_MASK", mSyslogMacros_LOG_MASK, 1);
578
582
  rb_define_method(mSyslogMacros, "LOG_UPTO", mSyslogMacros_LOG_UPTO, 1);
579
583
  rb_define_singleton_method(mSyslogMacros, "included", mSyslogMacros_included, 1);
data/lib/syslog.rb ADDED
@@ -0,0 +1,10 @@
1
+ begin
2
+ require 'syslog_ext'
3
+ rescue LoadError
4
+ raise LoadError.new(<<-EOS)
5
+ Can't load Syslog!
6
+
7
+ Syslog is not supported on your system. For Windows
8
+ we recommend using the win32-eventlog gem.
9
+ EOS
10
+ end
data/syslog.gemspec CHANGED
@@ -1,13 +1,18 @@
1
+ source_version = %w[. ext/syslog].find do |dir|
2
+ break $1 if File.foreach(File.join(__dir__, dir, "syslog.c")).any?(/^#define\s+SYSLOG_VERSION\s+"(.+)"/)
3
+ rescue Errno::ENOENT
4
+ end
5
+
1
6
  Gem::Specification.new do |spec|
2
7
  spec.name = "syslog"
3
- spec.version = "0.1.1"
8
+ spec.version = source_version
4
9
  spec.authors = ["Akinori MUSHA"]
5
10
  spec.email = ["knu@idaemons.org"]
6
11
 
7
12
  spec.summary = %q{Ruby interface for the POSIX system logging facility.}
8
13
  spec.description = %q{Ruby interface for the POSIX system logging facility.}
9
14
  spec.homepage = "https://github.com/ruby/syslog"
10
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
15
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
11
16
  spec.licenses = ["Ruby", "BSD-2-Clause"]
12
17
 
13
18
  spec.metadata["homepage_uri"] = spec.homepage
@@ -17,7 +22,5 @@ Gem::Specification.new do |spec|
17
22
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
23
  end
19
24
  spec.extensions = ["ext/syslog/extconf.rb"]
20
- spec.bindir = "exe"
21
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
25
  spec.require_paths = ["lib"]
23
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syslog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akinori MUSHA
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-14 00:00:00.000000000 Z
11
+ date: 2024-12-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ruby interface for the POSIX system logging facility.
14
14
  email:
@@ -19,7 +19,9 @@ extensions:
19
19
  extra_rdoc_files: []
20
20
  files:
21
21
  - ".git-blame-ignore-revs"
22
+ - ".github/CODEOWNERS"
22
23
  - ".github/dependabot.yml"
24
+ - ".github/workflows/push_gem.yml"
23
25
  - ".github/workflows/test.yml"
24
26
  - ".gitignore"
25
27
  - Gemfile
@@ -31,6 +33,7 @@ files:
31
33
  - ext/syslog/extconf.rb
32
34
  - ext/syslog/syslog.c
33
35
  - ext/syslog/syslog.txt
36
+ - lib/syslog.rb
34
37
  - lib/syslog/logger.rb
35
38
  - syslog.gemspec
36
39
  homepage: https://github.com/ruby/syslog
@@ -48,14 +51,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
48
51
  requirements:
49
52
  - - ">="
50
53
  - !ruby/object:Gem::Version
51
- version: 2.3.0
54
+ version: 2.5.0
52
55
  required_rubygems_version: !ruby/object:Gem::Requirement
53
56
  requirements:
54
57
  - - ">="
55
58
  - !ruby/object:Gem::Version
56
59
  version: '0'
57
60
  requirements: []
58
- rubygems_version: 3.4.0.dev
61
+ rubygems_version: 3.5.11
59
62
  signing_key:
60
63
  specification_version: 4
61
64
  summary: Ruby interface for the POSIX system logging facility.