jabber_admin 1.0.2 → 1.0.3

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: 434740883cadd905c938944abc50d9a2ed761658137485ec9653e0452882faa5
4
- data.tar.gz: c554a92ce698d861870464612295c13583cce069f7a0d537444375a1a46045aa
3
+ metadata.gz: 1c3c8dc6ddbbea8d817376ab6c870b2b5590a72e69f4e954cf118cad0a54088f
4
+ data.tar.gz: 71306c24bf91350ee2597cd7608e0e77787fdc498d308bf70f1bb081625f55c7
5
5
  SHA512:
6
- metadata.gz: 490904b5047f1f8d983c06cc58837973e4d67286eb6fa2c35a9457c538595762af44fef9eff10d0205f723a93cbd10a760643bd3308daae91295c95e0ca62490
7
- data.tar.gz: aa2dc6b86777dff40e71d57fdcdfd8c3f842eb59c9c8b18bd4f1e303267e1fbf72cc32ba55c57bf0891b49fdeae98cdc26420d7e7f1e7ccdc14450b7175f5f65
6
+ metadata.gz: 8668df2cbce010b8978ac1ca4f3e4f496642b30888059b9e098d9eae984b3968e55a349ac082f666977b66b8306feb72fbc5e9696e1d2be6c14170dc22cf7c01
7
+ data.tar.gz: 82c2c8be4ca79ae695fc31a30bea1634d482b9797fb0c9e26e6521f6c53a9fe68647f9542cb077167c4c9bdae8d67883c0894af1907508b6a512bac46ab67fcf
@@ -0,0 +1,38 @@
1
+ name: Build Documentation
2
+ on:
3
+ repository_dispatch:
4
+ types: [documentation]
5
+
6
+ concurrency:
7
+ group: 'docs'
8
+
9
+ jobs:
10
+ docs:
11
+ name: Build gem documentation
12
+ runs-on: ubuntu-20.04
13
+ timeout-minutes: 5
14
+ steps:
15
+ - uses: actions/checkout@v2
16
+
17
+ - name: Install the correct Ruby version
18
+ uses: ruby/setup-ruby@v1
19
+ with:
20
+ ruby-version: 2.5
21
+ bundler-cache: true
22
+
23
+ - name: Prepare the virtual environment
24
+ uses: hausgold/actions/ci@master
25
+ with:
26
+ clone_token: '${{ secrets.CLONE_TOKEN }}'
27
+ settings: '${{ github.repository }}'
28
+ target: ci/gem-test
29
+
30
+ - name: Build gem documentation
31
+ run: make docs
32
+
33
+ - name: Upload the code coverage report
34
+ run: coverage
35
+
36
+ - name: Add this job to the commit status
37
+ run: commit-status '${{ job.status }}'
38
+ if: always()
@@ -0,0 +1,59 @@
1
+ name: Test
2
+ on:
3
+ push:
4
+ branches:
5
+ - '**'
6
+ schedule:
7
+ - cron: '0 0 * * MON'
8
+
9
+ concurrency:
10
+ group: '${{ github.ref }}'
11
+ cancel-in-progress: true
12
+
13
+ jobs:
14
+ test:
15
+ name: 'Test the gem (Ruby ${{ matrix.ruby }})'
16
+ runs-on: ubuntu-20.04
17
+ timeout-minutes: 5
18
+ strategy:
19
+ fail-fast: false
20
+ matrix:
21
+ ruby: [2.5, 2.6, 2.7]
22
+ steps:
23
+ - uses: actions/checkout@v2
24
+
25
+ - name: Install the correct Ruby version
26
+ uses: ruby/setup-ruby@v1
27
+ with:
28
+ ruby-version: ${{ matrix.ruby }}
29
+ bundler-cache: true
30
+
31
+ - name: Prepare the virtual environment
32
+ uses: hausgold/actions/ci@master
33
+ with:
34
+ clone_token: '${{ secrets.CLONE_TOKEN }}'
35
+ settings: '${{ github.repository }}'
36
+ target: ci/gem-test
37
+
38
+ - name: Run the gem tests
39
+ run: make test
40
+
41
+ - name: Upload the code coverage report
42
+ run: coverage
43
+
44
+ trigger-docs:
45
+ name: Trigger the documentation upload
46
+ runs-on: ubuntu-20.04
47
+ timeout-minutes: 2
48
+ needs: test
49
+ if: github.ref == 'refs/heads/master'
50
+ steps:
51
+ - name: Prepare the virtual environment
52
+ uses: hausgold/actions/ci@master
53
+ with:
54
+ clone_token: '${{ secrets.CLONE_TOKEN }}'
55
+ settings: '${{ github.repository }}'
56
+ target: ci/noop
57
+
58
+ - name: Trigger the documentation upload
59
+ run: workflow documentation
data/.gitignore CHANGED
@@ -3,7 +3,7 @@
3
3
  /Gemfile.lock
4
4
  /_yardoc/
5
5
  /coverage/
6
- /doc/
6
+ /doc/api/
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
data/.yardopts CHANGED
@@ -1,4 +1,6 @@
1
- --output-dir=doc/app
1
+ --output-dir=doc/api
2
+ --plugin activesupport-concern
3
+ --markup=rdoc
2
4
  -
3
5
  README.md
4
6
  lib/**/*.rb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ### 1.0.3
2
+
3
+ * Migrated to Github Actions
4
+ * Migrated to our own coverage reporting
5
+ * Added the code statistics to the test process
6
+
1
7
  ### 1.0.2
2
8
 
3
9
  * Corrected the GNU Make release target
data/Makefile CHANGED
@@ -28,17 +28,23 @@ SORT ?= sort
28
28
  BUNDLE ?= bundle
29
29
  RAKE ?= rake
30
30
  RUBOCOP ?= rubocop
31
+ YARD ?= yard
31
32
 
32
33
  all:
33
34
  # jabber_admin
34
35
  #
35
- # install Install the dependencies
36
- # test Run the whole test suite
37
- # test-style Check the coding styles
38
- # clean Clean the dependencies
36
+ # install Install the dependencies
37
+ # test Run the whole test suite
38
+ # test-style Check the coding styles
39
+ # clean Clean the dependencies
39
40
  #
40
- # shell Run an interactive shell on the container
41
- # shell-irb Run an interactive IRB shell on the container
41
+ # docs Generate the Ruby documentation of the library
42
+ # stats Print the code statistics (library and test suite)
43
+ # notes Print all the notes from the code
44
+ # release Release a new Gem version (maintainers only)
45
+ #
46
+ # shell Run an interactive shell on the container
47
+ # shell-irb Run an interactive IRB shell on the container
42
48
  #
43
49
  # supported-commands-list Generate the supported commands list
44
50
 
@@ -62,9 +68,13 @@ install:
62
68
  @$(MKDIR) -p $(VENDOR_DIR)
63
69
  @$(call run-shell,$(BUNDLE) check || $(BUNDLE) install --path $(VENDOR_DIR))
64
70
 
65
- test: install
71
+ test: \
72
+ test-specs \
73
+ test-style
74
+
75
+ test-specs:
66
76
  # Run the whole test suite
67
- @$(call run-shell,$(BUNDLE) exec $(RAKE))
77
+ @$(call run-shell,$(BUNDLE) exec $(RAKE) stats spec)
68
78
 
69
79
  test-style: test-style-ruby
70
80
 
@@ -84,14 +94,27 @@ endif
84
94
 
85
95
  distclean: clean clean-containers
86
96
 
87
- shell: install
97
+ shell:
88
98
  # Run an interactive shell on the container
89
99
  @$(call run-shell,$(BASH) -i)
90
100
 
91
- shell-irb: install
101
+ shell-irb:
92
102
  # Run an interactive IRB shell on the container
93
103
  @$(call run-shell,bin/console)
94
104
 
105
+ docs:
106
+ # Build the API documentation
107
+ @$(call run-shell,$(BUNDLE) exec $(YARD) -q && \
108
+ $(BUNDLE) exec $(YARD) stats --list-undoc --compact)
109
+
110
+ notes:
111
+ # Print the code statistics (library and test suite)
112
+ @$(call run-shell,$(BUNDLE) exec $(RAKE) notes)
113
+
114
+ stats:
115
+ # Print all the notes from the code
116
+ @$(call run-shell,$(BUNDLE) exec $(RAKE) stats)
117
+
95
118
  release:
96
119
  # Release a new gem version
97
120
  @$(BUNDLE) exec $(RAKE) release
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  ![jabber_admin](doc/assets/project.svg)
2
2
 
3
- [![Build Status](https://travis-ci.com/hausgold/jabber_admin.svg?branch=master)](https://travis-ci.com/hausgold/jabber_admin)
3
+ [![Continuous Integration](https://github.com/hausgold/jabber_admin/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/hausgold/jabber_admin/actions/workflows/test.yml)
4
4
  [![Gem Version](https://badge.fury.io/rb/jabber_admin.svg)](https://badge.fury.io/rb/jabber_admin)
5
- [![Maintainability](https://api.codeclimate.com/v1/badges/dd51c4668e97771baaba/maintainability)](https://codeclimate.com/repos/5cac8bcb6969c376ed007c70/maintainability)
6
- [![Test Coverage](https://api.codeclimate.com/v1/badges/dd51c4668e97771baaba/test_coverage)](https://codeclimate.com/repos/5cac8bcb6969c376ed007c70/test_coverage)
7
- [![API docs](https://img.shields.io/badge/docs-API-blue.svg)](https://www.rubydoc.info/gems/jabber_admin)
5
+ [![Test Coverage](https://automate-api.hausgold.de/v1/coverage_reports/jabber_admin/coverage.svg)](https://knowledge.hausgold.de/coverage)
6
+ [![Test Ratio](https://automate-api.hausgold.de/v1/coverage_reports/jabber_admin/ratio.svg)](https://knowledge.hausgold.de/coverage)
7
+ [![API docs](https://automate-api.hausgold.de/v1/coverage_reports/jabber_admin/documentation.svg)](https://www.rubydoc.info/gems/jabber_admin)
8
8
 
9
9
  jabber_admin is a small library to easily communicate with the [ejabberd
10
10
  admin API](https://docs.ejabberd.im/developer/ejabberd-api/admin-api).
data/Rakefile CHANGED
@@ -2,7 +2,75 @@
2
2
 
3
3
  require 'bundler/gem_tasks'
4
4
  require 'rspec/core/rake_task'
5
+ require 'rails/code_statistics'
6
+ require 'pp'
5
7
 
6
8
  RSpec::Core::RakeTask.new(:spec)
7
9
 
8
10
  task default: :spec
11
+
12
+ # Load some railties tasks
13
+ load 'rails/tasks/statistics.rake'
14
+ load 'rails/tasks/annotations.rake'
15
+
16
+ # Clear the default statistics directory constant
17
+ #
18
+ # rubocop:disable Style/MutableConstant because we define it
19
+ Object.send(:remove_const, :STATS_DIRECTORIES)
20
+ ::STATS_DIRECTORIES = []
21
+ # rubocop:enable Style/MutableConstant
22
+
23
+ # Monkey patch the Rails +CodeStatistics+ class to support configurable
24
+ # patterns per path. This is reuqired to support top-level only file matches.
25
+ class CodeStatistics
26
+ DEFAULT_PATTERN = /^(?!\.).*?\.(rb|js|coffee|rake)$/.freeze
27
+
28
+ # Pass the possible +pattern+ argument down to the
29
+ # +calculate_directory_statistics+ method call.
30
+ def calculate_statistics
31
+ Hash[@pairs.map do |pair|
32
+ [pair.first, calculate_directory_statistics(*pair[1..-1])]
33
+ end]
34
+ end
35
+
36
+ # Match the pattern against the individual file name and the relative file
37
+ # path. This allows top-level only matches.
38
+ def calculate_directory_statistics(directory, pattern = DEFAULT_PATTERN)
39
+ stats = CodeStatisticsCalculator.new
40
+
41
+ Dir.foreach(directory) do |file_name|
42
+ path = "#{directory}/#{file_name}"
43
+
44
+ if File.directory?(path) && (/^\./ !~ file_name)
45
+ stats.add(calculate_directory_statistics(path, pattern))
46
+ elsif file_name =~ pattern || path =~ pattern
47
+ stats.add_by_file_path(path)
48
+ end
49
+ end
50
+
51
+ stats
52
+ end
53
+ end
54
+
55
+ # Configure all code statistics directories
56
+ vendors = [
57
+ [:unshift, 'Top-levels', 'lib', %r{lib(/jabber_admin)?/[^/]+\.rb$}],
58
+ [:unshift, 'Top-levels specs', 'spec',
59
+ %r{spec/jabber_admin(_spec\.rb|/[^/]+\.rb$)}],
60
+
61
+ [:unshift, 'Commands', 'lib/jabber_admin/commands'],
62
+ [:unshift, 'Commands specs', 'spec/jabber_admin/commands']
63
+ ].reverse
64
+
65
+ vendors.each do |method, type, dir, pattern|
66
+ ::STATS_DIRECTORIES.send(method, [type, dir, pattern].compact)
67
+ ::CodeStatistics::TEST_TYPES << type if type.include? 'specs'
68
+ end
69
+
70
+ # Setup annotations
71
+ ENV['SOURCE_ANNOTATION_DIRECTORIES'] = 'spec,doc'
72
+
73
+ desc 'Enumerate all annotations'
74
+ task :notes do
75
+ SourceAnnotationExtractor.enumerate '@?OPTIMIZE|@?FIXME|@?TODO', tag: true
76
+ end
data/jabber_admin.gemspec CHANGED
@@ -39,6 +39,7 @@ Gem::Specification.new do |spec|
39
39
 
40
40
  spec.add_development_dependency 'bundler', '>= 1.16', '< 3'
41
41
  spec.add_development_dependency 'irb', '~> 1.2'
42
+ spec.add_development_dependency 'railties', '>= 4.2.0', '< 6.1'
42
43
  spec.add_development_dependency 'rake', '~> 13.0'
43
44
  spec.add_development_dependency 'rspec', '~> 3.9'
44
45
  spec.add_development_dependency 'rubocop', '~> 0.93'
@@ -46,4 +47,6 @@ Gem::Specification.new do |spec|
46
47
  spec.add_development_dependency 'simplecov', '< 0.18'
47
48
  spec.add_development_dependency 'vcr', '~> 6.0'
48
49
  spec.add_development_dependency 'webmock', '~> 3.0'
50
+ spec.add_development_dependency 'yard', '~> 0.9.18'
51
+ spec.add_development_dependency 'yard-activesupport-concern', '~> 0.0.1'
49
52
  end
@@ -4,7 +4,7 @@
4
4
  module JabberAdmin
5
5
  # The version constant of the gem. Increase this value
6
6
  # in case of a gem release.
7
- VERSION = '1.0.2'
7
+ VERSION = '1.0.3'
8
8
 
9
9
  class << self
10
10
  # Returns the version of gem as a string.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jabber_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Vogt
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2021-05-12 00:00:00.000000000 Z
12
+ date: 2021-10-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -79,6 +79,26 @@ dependencies:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
81
  version: '1.2'
82
+ - !ruby/object:Gem::Dependency
83
+ name: railties
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: 4.2.0
89
+ - - "<"
90
+ - !ruby/object:Gem::Version
91
+ version: '6.1'
92
+ type: :development
93
+ prerelease: false
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: 4.2.0
99
+ - - "<"
100
+ - !ruby/object:Gem::Version
101
+ version: '6.1'
82
102
  - !ruby/object:Gem::Dependency
83
103
  name: rake
84
104
  requirement: !ruby/object:Gem::Requirement
@@ -177,6 +197,34 @@ dependencies:
177
197
  - - "~>"
178
198
  - !ruby/object:Gem::Version
179
199
  version: '3.0'
200
+ - !ruby/object:Gem::Dependency
201
+ name: yard
202
+ requirement: !ruby/object:Gem::Requirement
203
+ requirements:
204
+ - - "~>"
205
+ - !ruby/object:Gem::Version
206
+ version: 0.9.18
207
+ type: :development
208
+ prerelease: false
209
+ version_requirements: !ruby/object:Gem::Requirement
210
+ requirements:
211
+ - - "~>"
212
+ - !ruby/object:Gem::Version
213
+ version: 0.9.18
214
+ - !ruby/object:Gem::Dependency
215
+ name: yard-activesupport-concern
216
+ requirement: !ruby/object:Gem::Requirement
217
+ requirements:
218
+ - - "~>"
219
+ - !ruby/object:Gem::Version
220
+ version: 0.0.1
221
+ type: :development
222
+ prerelease: false
223
+ version_requirements: !ruby/object:Gem::Requirement
224
+ requirements:
225
+ - - "~>"
226
+ - !ruby/object:Gem::Version
227
+ version: 0.0.1
180
228
  description: Library for the ejabberd RESTful admin API
181
229
  email:
182
230
  - henning.vogt@hausgold.de
@@ -186,11 +234,12 @@ extensions: []
186
234
  extra_rdoc_files: []
187
235
  files:
188
236
  - ".editorconfig"
237
+ - ".github/workflows/documentation.yml"
238
+ - ".github/workflows/test.yml"
189
239
  - ".gitignore"
190
240
  - ".rspec"
191
241
  - ".rubocop.yml"
192
242
  - ".simplecov"
193
- - ".travis.yml"
194
243
  - ".yardopts"
195
244
  - CHANGELOG.md
196
245
  - Gemfile
data/.travis.yml DELETED
@@ -1,18 +0,0 @@
1
- sudo: false
2
- env:
3
- global:
4
- - CC_TEST_REPORTER_ID=05f9944a34899135739ab519c57a179a3f4677999fd832fa87da25d3643702b7
5
- language: ruby
6
- rvm:
7
- - 2.6
8
- - 2.6
9
- - 2.5
10
- before_install: gem install bundler
11
- before_script:
12
- - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
13
- - chmod +x ./cc-test-reporter
14
- - ./cc-test-reporter before-build
15
- script:
16
- - bundle exec rspec
17
- after_script:
18
- - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT