distribuo 0.1.17 → 0.2.0

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
2
  SHA256:
3
- metadata.gz: 42f3fccee9e457adbeba0ff22e6db473b6a04b4e9d804385d216ba89f195c2d1
4
- data.tar.gz: e7031df03c593ea7bf35b06a39af133f0c1550390b97d18d599458ba64a57b56
3
+ metadata.gz: 89785f80fa2b414447c3c972b5ec78a42d515c40603a204f8f85c17d47f1c428
4
+ data.tar.gz: eb87c2c7e09e44aa1b01e1657ebc71e18505e1c345f77e9088ccbfc68adf3f4b
5
5
  SHA512:
6
- metadata.gz: fa3cb249d6f1cca71e2a95c55bfb5d71593d23e97b80be8233799a19a5ec984af737651a5137cb9fd7175c0b51dbb8642dffb39e3f3db38adcf3aea918c464e2
7
- data.tar.gz: c8facb151c5b1bf6b7dca6b6c88c2e920e6685318e2654a4f389eed32b87c220a86dd7295a35b35c1604afbebd6133986ef7704202ed679ecfa7d837b87c2485
6
+ metadata.gz: 97822aafbb7f456989d6ecdfd2ea1f9e5ba4326c00b43390325ed1f88c10cd8d9730be26b2baacffe676d7b37066db8e228010b712815d3e0256536e466f7423
7
+ data.tar.gz: 28e85f17184d64197d12a6632db9d8e03a35bc4b5ce9a503eebbb66aebd8d1676c0002b4edc250abdbf6cb16c42f5f71691b96b08efc11fbc7428cc820051ade
data/README.md CHANGED
@@ -36,3 +36,29 @@ Contribution directions go here.
36
36
  ## License
37
37
 
38
38
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
39
+
40
+ ## Tables (Mensa)
41
+
42
+ Distribuo's tables inherit from `Distribuo::ApplicationTable < Mensa::Base`.
43
+ They require PostgreSQL. The bundled Mensa revision and its migrations are tested
44
+ with Rails 8.1.4 (Mensa declares Rails >= 7.1). In the host application's Gemfile,
45
+ configure `git_source(:entdec) { |repo| "git@github.com:entdec/#{repo}.git" }`
46
+ and add `gem "mensa", entdec: "mensa"`, then bundle. Run `rails g mensa:install`,
47
+ `rails mensa:install:migrations`, and `rails db:migrate`; include Mensa's assets
48
+ and configure its base controller and authentication for your host application.
49
+ Keep the Mensa endpoints behind the same admin authentication as Distribuo.
50
+ The tables preserve the existing unrestricted admin scopes; they do not introduce
51
+ new policy scopes or change controller authorization.
52
+
53
+ Render apps with `table("distribuo/apps", params: {})` and releases with
54
+ `table("distribuo/releases", params: {app_id: app.id})`. The explicit app ID
55
+ survives pagination, filtering, sorting and exports. Both tables support custom
56
+ views and exports. Download counts are calculated in SQL without loading downloads.
57
+ The operating system column provides the platform filter.
58
+
59
+ From `test/dummy`, run `RAILS_ENV=test bundle exec rails db:prepare db:seed`
60
+ and `RAILS_ENV=test bundle exec rails mensa:verify_all`. Set `DATABASE_URL` for
61
+ your PostgreSQL service. The dummy task discovers the engine tables explicitly.
62
+ In a host, use `rails "mensa:verify[distribuo/apps]"` and
63
+ `rails "mensa:verify[distribuo/releases]"`. Run `bundle exec rake test` from the
64
+ repository root for regressions.
data/Rakefile CHANGED
@@ -33,4 +33,5 @@ task default: :test
33
33
 
34
34
  # Adds the Auxilium semver task
35
35
  spec = Gem::Specification.find_by_name 'auxilium'
36
- load "#{spec.gem_dir}/lib/tasks/semver.rake"
36
+ semver_tasks = "#{spec.gem_dir}/lib/tasks/semver.rake"
37
+ load semver_tasks if File.exist?(semver_tasks)
@@ -5,7 +5,7 @@ require_dependency 'concerns/distribuo/respond'
5
5
 
6
6
  module Distribuo
7
7
  class ApplicationAdminController < ApplicationController
8
- include Pundit
8
+ include Pundit::Authorization
9
9
  include Respond
10
10
  include Distribuo.config.admin_authentication_module.constantize if Distribuo.config.admin_authentication_module
11
11
  end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Distribuo
4
+ class ApplicationTable < Mensa::Base
5
+ end
6
+ end
@@ -4,25 +4,34 @@ module Distribuo
4
4
  class AppsTable < ApplicationTable
5
5
  model Distribuo::App
6
6
 
7
- column(:icon) do |app|
8
- app.icon.attached? ? image_tag(main_app.url_for(app.icon.variant(resize_to_limit: [20, 20]))) : ''
7
+ supports_custom_views true
8
+ show_header true
9
+ exportable true
10
+
11
+ internal :id
12
+
13
+ column(:icon) do
14
+ render do
15
+ html do |app|
16
+ app.icon.attached? ? image_tag(main_app.url_for(app.icon.variant(resize_to_limit: [20, 20]))) : ''
17
+ end
18
+ csv { |_app| '' }
19
+ end
9
20
  end
10
21
  column(:name)
11
22
  column(:release_type)
12
- column(:operating_system)
23
+ column(:operating_system) do
24
+ filter do
25
+ collection -> { Distribuo::App::OPERATING_SYSTEMS }
26
+ end
27
+ end
13
28
  column(:created_at)
14
29
 
15
- filter(:platform)
16
-
17
- initial_order :created_at, :desc
18
-
19
- row_link { |app| distribuo.admin_app_path(app) }
20
-
21
- private
30
+ order created_at: :desc, id: :desc
31
+ link { |app| distribuo.admin_app_path(app.id) }
22
32
 
23
- def scope
24
- @scope = App.all
25
- @scope
33
+ scope do
34
+ Distribuo::App.all.with_attached_icon
26
35
  end
27
36
  end
28
37
  end
@@ -2,28 +2,41 @@
2
2
 
3
3
  module Distribuo
4
4
  class ReleasesTable < ApplicationTable
5
- model Release
5
+ model Distribuo::Release
6
6
 
7
- column(:release, &:position)
8
- column(:bundle_id)
9
- column(:version)
10
- column(:build_number, &:build_number)
11
- column(:unique_downloads) { |row| row.downloads.distinct.count(:ip) }
12
- column(:total_downloads) { |row| row.downloads.count }
13
- column(:created_at)
14
-
15
- filter(:version)
7
+ supports_custom_views true
8
+ show_header true
9
+ exportable true
16
10
 
17
- initial_order :created_at, :desc
11
+ internal :id
12
+ internal :app_id
18
13
 
19
- row_link { |release| distribuo.edit_admin_app_release_path(release.app, release) }
14
+ column(:release) do
15
+ attribute 'distribuo_releases.position'
16
+ type :integer
17
+ end
18
+ column(:bundle_id)
19
+ column(:version) do
20
+ filter
21
+ end
22
+ column(:build_number)
23
+ column(:unique_downloads) do
24
+ attribute '(SELECT COUNT(DISTINCT distribuo_downloads.ip) FROM distribuo_downloads WHERE distribuo_downloads.distribuo_release_id = distribuo_releases.id)'
25
+ type :integer
26
+ end
27
+ column(:total_downloads) do
28
+ attribute '(SELECT COUNT(*) FROM distribuo_downloads WHERE distribuo_downloads.distribuo_release_id = distribuo_releases.id)'
29
+ type :integer
30
+ end
31
+ column(:created_at)
20
32
 
21
- private
33
+ order created_at: :desc, id: :desc
34
+ link { |release| distribuo.edit_admin_app_release_path(release.app_id, release.id) }
22
35
 
23
- def scope
24
- @scope = Release.all
25
- @scope = @scope.where(app_id: params[:app_id]) if params[:app_id]
26
- @scope
36
+ scope do
37
+ records = Distribuo::Release.all
38
+ records = records.where(app_id: params[:app_id]) if params[:app_id]
39
+ records
27
40
  end
28
41
  end
29
42
  end
@@ -1,2 +1,2 @@
1
1
  = sts.card :distribuo_admin_apps, title: t('.apps'), icon: 'fad fa-laptop-mobile', content_padding: false, menu: distribuo_apps_menu do |card|
2
- = card.with_table:distribuo_apps, custom_views: true
2
+ = table("distribuo/apps", params: {})
@@ -1,2 +1,2 @@
1
1
  = sts.card :distribuo_admin_apps_releases, title: t('.releases'), icon: 'fad fa-ship', content_padding: false, menu: distribuo_app_releases_menu do |card|
2
- = card.with_table'distribuo/releases', parameters: {app_id: @app.id}, custom_views: true
2
+ = table("distribuo/releases", params: {app_id: @app.id})
@@ -0,0 +1,24 @@
1
+ en:
2
+ activerecord:
3
+ models:
4
+ distribuo/app:
5
+ one: App
6
+ other: Apps
7
+ distribuo/release:
8
+ one: Release
9
+ other: Releases
10
+ attributes:
11
+ distribuo/app:
12
+ icon: Icon
13
+ name: Name
14
+ release_type: Release type
15
+ operating_system: Operating system
16
+ created_at: Created at
17
+ distribuo/release:
18
+ release: Release
19
+ bundle_id: Bundle ID
20
+ version: Version
21
+ build_number: Build number
22
+ unique_downloads: Unique downloads
23
+ total_downloads: Total downloads
24
+ created_at: Created at
@@ -0,0 +1,30 @@
1
+ nl:
2
+ time:
3
+ formats:
4
+ long: "%d-%m-%Y %H:%M"
5
+ date:
6
+ formats:
7
+ long: "%d-%m-%Y"
8
+ activerecord:
9
+ models:
10
+ distribuo/app:
11
+ one: App
12
+ other: Apps
13
+ distribuo/release:
14
+ one: Uitgave
15
+ other: Uitgaven
16
+ attributes:
17
+ distribuo/app:
18
+ icon: Pictogram
19
+ name: Naam
20
+ release_type: Type uitgave
21
+ operating_system: Besturingssysteem
22
+ created_at: Aangemaakt op
23
+ distribuo/release:
24
+ release: Uitgave
25
+ bundle_id: Bundel-ID
26
+ version: Versie
27
+ build_number: Buildnummer
28
+ unique_downloads: Unieke downloads
29
+ total_downloads: Totaal aantal downloads
30
+ created_at: Aangemaakt op
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Distribuo
4
- VERSION = "0.1.17"
4
+ VERSION = "0.2.0"
5
5
  end
data/lib/distribuo.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'acts_as_list'
2
2
  require 'app_parser'
3
3
  require 'pundit'
4
+ require 'mensa'
4
5
 
5
6
  require 'distribuo/engine'
6
7
  require 'distribuo/configuration'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: distribuo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.17
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom de Grunt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-07-22 00:00:00.000000000 Z
11
+ date: 2026-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: acts_as_list
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubyzip
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.3'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.3'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: image_processing
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +66,20 @@ dependencies:
52
66
  - - ">="
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: mensa
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: pg
57
85
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +114,14 @@ dependencies:
86
114
  requirements:
87
115
  - - ">="
88
116
  - !ruby/object:Gem::Version
89
- version: '6'
117
+ version: '7.1'
90
118
  type: :runtime
91
119
  prerelease: false
92
120
  version_requirements: !ruby/object:Gem::Requirement
93
121
  requirements:
94
122
  - - ">="
95
123
  - !ruby/object:Gem::Version
96
- version: '6'
124
+ version: '7.1'
97
125
  - !ruby/object:Gem::Dependency
98
126
  name: auxilium
99
127
  requirement: !ruby/object:Gem::Requirement
@@ -135,6 +163,7 @@ files:
135
163
  - app/policies/distribuo/app_policy.rb
136
164
  - app/policies/distribuo/application_policy.rb
137
165
  - app/policies/distribuo/release_policy.rb
166
+ - app/tables/distribuo/application_table.rb
138
167
  - app/tables/distribuo/apps_table.rb
139
168
  - app/tables/distribuo/releases_table.rb
140
169
  - app/views/distribuo/admin/apps/edit.html.slim
@@ -143,6 +172,8 @@ files:
143
172
  - app/views/distribuo/admin/apps/releases/index.html.slim
144
173
  - app/views/distribuo/apps/index.html.slim
145
174
  - app/views/distribuo/apps/releases/manifest.plist.erb
175
+ - config/locales/en.yml
176
+ - config/locales/nl.yml
146
177
  - config/routes.rb
147
178
  - db/migrate/20201118080121_create_distribuo_apps.rb
148
179
  - db/migrate/20201118080220_create_distribuo_releases.rb