twinkle 0.1.1 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -0
- data/app/controllers/twinkle/appcast_controller.rb +1 -1
- data/app/models/twinkle/version.rb +27 -8
- data/app/views/twinkle/appcast/show.xml.erb +42 -2
- data/db/migrate/20240626232135_add_fields_to_twinkle_versions.rb +19 -0
- data/lib/twinkle/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 745ebe3beb30463d26dc3801ec74938b03ae089d267586d90ff736872a5bcbca
|
4
|
+
data.tar.gz: 678c0fadd35d1798fd7f1f69fc1ba9d170f7f12c3b3099311d96a1fd56f7bae8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a80e569a9be8977f3447583de2e030ccf45341a25bc60a845b02766be74b7dadf19f4aa5314d6dcdd2f935d44efadf2c668ea5f43c55cc0ce7c10115bd3d14d3
|
7
|
+
data.tar.gz: a11ac6363d06444ef8aa07ca5173e8c1770ce44295ab89ca32505c0140565244b2a118a2bdac1ccccf546cd04d9ac1e8dea0040c33649691846bbad606c4de1c
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Twinkle
|
2
2
|
class AppcastController < ApplicationController
|
3
3
|
def show
|
4
|
-
@app = App.
|
4
|
+
@app = App.includes(:versions).find_by!(slug: params[:slug])
|
5
5
|
Event.create(app: @app, **event_params)
|
6
6
|
render layout: false, formats: :xml
|
7
7
|
end
|
@@ -5,16 +5,22 @@ module Twinkle
|
|
5
5
|
belongs_to :app, foreign_key: 'twinkle_app_id', class_name: 'Twinkle::App'
|
6
6
|
|
7
7
|
validates :number, presence: true
|
8
|
-
validates :build,
|
8
|
+
validates :build, numericality: { only_integer: true, greater_than: 0 }
|
9
9
|
validates :description, presence: true, if: -> { published }
|
10
10
|
validates :binary_url, presence: true, if: -> { published }
|
11
11
|
validates :length, presence: true, if: -> { published }
|
12
12
|
validates :length, numericality: { only_integer: true, greater_than: 0 }, allow_blank: true
|
13
|
-
|
13
|
+
validates :phased_rollout_interval, numericality: { only_integer: true, greater_than: 0 }, allow_blank: true
|
14
14
|
|
15
15
|
# validates that the binary_url is a valid URL
|
16
16
|
validate :binary_url_is_url
|
17
17
|
|
18
|
+
# validates that the release_notes_link is a valid URL
|
19
|
+
validate :release_notes_link_is_url
|
20
|
+
|
21
|
+
# validates that the full_release_notes_link is a valid URL
|
22
|
+
validate :full_release_notes_link_is_url
|
23
|
+
|
18
24
|
# validates that one of the two signatures is present
|
19
25
|
validate :signature_present, if: -> { published }
|
20
26
|
|
@@ -22,12 +28,17 @@ module Twinkle
|
|
22
28
|
|
23
29
|
def binary_url_is_url
|
24
30
|
return true if binary_url.blank?
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
+
errors.add(:binary_url, "is not a valid URL") unless is_url?(binary_url)
|
32
|
+
end
|
33
|
+
|
34
|
+
def release_notes_link_is_url
|
35
|
+
return true if release_notes_link.blank?
|
36
|
+
errors.add(:release_notes_link, "is not a valid URL") unless is_url?(release_notes_link)
|
37
|
+
end
|
38
|
+
|
39
|
+
def full_release_notes_link_is_url
|
40
|
+
return true if full_release_notes_link.blank?
|
41
|
+
errors.add(:full_release_notes_link, "is not a valid URL") unless is_url?(full_release_notes_link)
|
31
42
|
end
|
32
43
|
|
33
44
|
def signature_present
|
@@ -35,5 +46,13 @@ module Twinkle
|
|
35
46
|
errors.add(:base, "At least one of the two signatures must be present")
|
36
47
|
end
|
37
48
|
end
|
49
|
+
|
50
|
+
private
|
51
|
+
def is_url?(url)
|
52
|
+
uri = URI.parse(url)
|
53
|
+
uri.is_a?(URI::HTTP) && uri.host.present?
|
54
|
+
rescue URI::InvalidURIError
|
55
|
+
false
|
56
|
+
end
|
38
57
|
end
|
39
58
|
end
|
@@ -5,14 +5,54 @@
|
|
5
5
|
<% @app.versions.each do |version| %>
|
6
6
|
<item>
|
7
7
|
<title><%= version.number %></title>
|
8
|
-
<pubDate><%= version.
|
8
|
+
<pubDate><%= version.published_at.strftime("%a, %d %b %Y %H:%M:%S %z") %></pubDate>
|
9
9
|
<sparkle:version><%= version.build %></sparkle:version>
|
10
10
|
<sparkle:shortVersionString><%= version.number %></sparkle:shortVersionString>
|
11
|
+
<% if version.link.present? %>
|
12
|
+
<link><%= version.link %></link>
|
13
|
+
<% end %>
|
14
|
+
<% if version.channel.present? %>
|
15
|
+
<sparkle:channel><%= version.channel %></sparkle:channel>
|
16
|
+
<% end %>
|
17
|
+
<% if version.release_notes_link.present? %>
|
18
|
+
<sparkle:releaseNotesLink><%= version.release_notes_link %></sparkle:releaseNotesLink>
|
19
|
+
<% end %>
|
20
|
+
<% if version.full_release_notes_link.present? %>
|
21
|
+
<sparkle:fullReleaseNotesLink><%= version.full_release_notes_link %></sparkle:fullReleaseNotesLink>
|
22
|
+
<% end %>
|
23
|
+
<% if version.min_system_version.present? %>
|
11
24
|
<sparkle:minimumSystemVersion><%= version.min_system_version %></sparkle:minimumSystemVersion>
|
25
|
+
<% end %>
|
26
|
+
<% if version.max_system_version.present? %>
|
27
|
+
<sparkle:maximumSystemVersion><%= version.max_system_version %></sparkle:maximumSystemVersion>
|
28
|
+
<% end %>
|
29
|
+
<% if version.minimum_auto_update_version.present? %>
|
30
|
+
<sparkle:minimumAutoupdateVersion><%= version.minimum_auto_update_version %></sparkle:minimumAutoupdateVersion>
|
31
|
+
<% end %>
|
32
|
+
<% if version.ignore_skipped_upgrades_below_version.present? %>
|
33
|
+
<sparkle:ignoreSkippedUpgradesBelowVersion><%= version.ignore_skipped_upgrades_below_version %></sparkle:ignoreSkippedUpgradesBelowVersion>
|
34
|
+
<% end %>
|
35
|
+
<% if version.informational_update_below_version.present? %>
|
36
|
+
<sparkle:informationalUpdate>
|
37
|
+
<sparkle:belowVersion><%= version.informational_update_below_version %></sparkle:belowVersion>
|
38
|
+
</sparkle:informationalUpdate>
|
39
|
+
<% end %>
|
40
|
+
<% if version.critical %>
|
41
|
+
<% if version.sparkle_two %>
|
42
|
+
<sparkle:criticalUpdate<%= version.critical_version.present? ? raw(" sparkle:version=\"#{version.critical_version}\"") : "" %>></sparkle:criticalUpdate>
|
43
|
+
<% else %>
|
44
|
+
<sparkle:tags>
|
45
|
+
<sparkle:criticalUpdate></sparkle:criticalUpdate>
|
46
|
+
</sparkle:tags>
|
47
|
+
<% end %>
|
48
|
+
<% end %>
|
49
|
+
<% if version.phased_rollout_interval.present? %>
|
50
|
+
<sparkle:phasedRolloutInterval><%= version.phased_rollout_interval %></sparkle:phasedRolloutInterval>
|
51
|
+
<% end %>
|
12
52
|
<description>
|
13
53
|
<%= version.description %>
|
14
54
|
</description>
|
15
|
-
<enclosure url="<%= version.
|
55
|
+
<enclosure url="<%= version.binary_url %>" length="<%= version.length %>" type="application/octet-stream" sparkle:dsaSignature="<%= version.dsa_signature %>" sparkle:edSignature="<%= version.ed_signature %>"/>
|
16
56
|
</item>
|
17
57
|
<% end %>
|
18
58
|
</channel>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class AddFieldsToTwinkleVersions < ActiveRecord::Migration[7.1]
|
2
|
+
def change
|
3
|
+
add_column :twinkle_versions, :sparkle_two, :boolean, default: true
|
4
|
+
add_column :twinkle_versions, :link, :string
|
5
|
+
add_column :twinkle_versions, :min_system_version, :string
|
6
|
+
add_column :twinkle_versions, :max_system_version, :string
|
7
|
+
add_column :twinkle_versions, :minimum_auto_update_version, :string
|
8
|
+
add_column :twinkle_versions, :ignore_skipped_upgrades_below_version, :string
|
9
|
+
add_column :twinkle_versions, :informational_update_below_version, :string
|
10
|
+
add_column :twinkle_versions, :critical, :boolean, default: false
|
11
|
+
add_column :twinkle_versions, :critical_version, :string
|
12
|
+
add_column :twinkle_versions, :phased_rollout_interval, :integer
|
13
|
+
add_column :twinkle_versions, :channel, :string
|
14
|
+
add_column :twinkle_versions, :release_notes_link, :string
|
15
|
+
add_column :twinkle_versions, :full_release_notes_link, :string
|
16
|
+
add_column :twinkle_versions, :published_at, :datetime
|
17
|
+
change_column :twinkle_versions, :build, :integer, using: 'build::integer'
|
18
|
+
end
|
19
|
+
end
|
data/lib/twinkle/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twinkle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Marks
|
@@ -58,6 +58,7 @@ files:
|
|
58
58
|
- db/migrate/20240517234016_create_twinkle_summaries.rb
|
59
59
|
- db/migrate/20240518000405_create_twinkle_datapoints.rb
|
60
60
|
- db/migrate/20240530023848_add_published_to_twinkle_versions.rb
|
61
|
+
- db/migrate/20240626232135_add_fields_to_twinkle_versions.rb
|
61
62
|
- lib/tasks/twinkle_tasks.rake
|
62
63
|
- lib/twinkle.rb
|
63
64
|
- lib/twinkle/concerns/models/app.rb
|
@@ -86,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
87
|
- !ruby/object:Gem::Version
|
87
88
|
version: '0'
|
88
89
|
requirements: []
|
89
|
-
rubygems_version: 3.
|
90
|
+
rubygems_version: 3.5.9
|
90
91
|
signing_key:
|
91
92
|
specification_version: 4
|
92
93
|
summary: Twinkle is a Rails engine for hosting appcast and collecting anonymous sparkle-project
|