sparklecast 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +22 -0
- data/README.md +42 -0
- data/lib/sparklecast.rb +5 -0
- data/lib/sparklecast/appcast.rb +71 -0
- data/lib/sparklecast/version.rb +3 -0
- metadata +77 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 97aa9217d4e218300e844341fc533ee445dd6ce9
|
4
|
+
data.tar.gz: adffafac9550eba13866139f03e3b0b974b37aec
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 53a72efe5d71dc5db0ce286681513d414e093175d661f1ffd97176b46a6d15d6844fff3c1688f4d70e71e39635c97f1bbb546cad534bdf7963804b890c7ee078
|
7
|
+
data.tar.gz: c33c8b6b8cac1e74e0837fff6060d86883292ad3c13fcc4bd10ea006786c42888e34f58e5279593d3bd09038ff4819bd59fa5180105c71b65a24acb1b8acf78d
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Anatoliy Plastinin
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# Sparklecast
|
2
|
+
|
3
|
+
[![Code Climate](http://img.shields.io/codeclimate/github/antlypls/sparklecast.svg?style=flat)](https://codeclimate.com/github/antlypls/sparklecast)
|
4
|
+
[![Build Status](http://img.shields.io/travis/antlypls/sparklecast.svg?style=flat)](https://travis-ci.org/antlypls/sparklecast)
|
5
|
+
|
6
|
+
Sparklecast helps you to create and modify
|
7
|
+
[Sparkle's](https://github.com/sparkle-project/Sparkle) appcast files.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
gem 'sparklecast'
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install sparklecast
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
```{ruby}
|
26
|
+
appcast = Sparklecast::Appcast.new(
|
27
|
+
'Sparkle Test App Changelog',
|
28
|
+
'http://sparkle-project.org/files/sparkletestcast.xml',
|
29
|
+
'Most recent changes with links to updates.',
|
30
|
+
'en'
|
31
|
+
)
|
32
|
+
|
33
|
+
appcast.generate # returns an appcast rss feed
|
34
|
+
```
|
35
|
+
|
36
|
+
## Contributing
|
37
|
+
|
38
|
+
1. Fork it ( https://github.com/antlypls/sparklecast/fork )
|
39
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
40
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
41
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
42
|
+
5. Create a new Pull Request
|
data/lib/sparklecast.rb
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
|
3
|
+
module Sparklecast
|
4
|
+
class Appcast
|
5
|
+
class Item < Struct.new(:title, :description, :sparkle_version, :pub_date,
|
6
|
+
:url, :length, :type, :dsa_signature)
|
7
|
+
def to_node(xml)
|
8
|
+
xml.item do
|
9
|
+
xml.title title
|
10
|
+
xml.description do
|
11
|
+
xml.cdata description
|
12
|
+
end
|
13
|
+
xml.pubDate pub_date.rfc2822
|
14
|
+
xml.enclosure enclosure
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def enclosure
|
21
|
+
{
|
22
|
+
'url' => url,
|
23
|
+
'sparkle:version' => sparkle_version,
|
24
|
+
'length' => length,
|
25
|
+
'type' => type,
|
26
|
+
'sparkle:dsaSignature' => dsa_signature
|
27
|
+
}.reject { |_, v| v.nil? }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
attr_accessor :title
|
32
|
+
attr_accessor :link
|
33
|
+
attr_accessor :description
|
34
|
+
attr_accessor :language
|
35
|
+
|
36
|
+
RSS_ATTRIBUTES = {
|
37
|
+
'version' => '2.0',
|
38
|
+
'xmlns:sparkle' => 'http://www.andymatuschak.org/xml-namespaces/sparkle',
|
39
|
+
'xmlns:dc' => 'http://purl.org/dc/elements/1.1/'
|
40
|
+
}
|
41
|
+
|
42
|
+
def initialize(title, link, description, language)
|
43
|
+
@title = title
|
44
|
+
@link = link
|
45
|
+
@description = description
|
46
|
+
@language = language
|
47
|
+
end
|
48
|
+
|
49
|
+
def generate
|
50
|
+
Nokogiri::XML::Builder.new(encoding: 'utf-8') do |xml|
|
51
|
+
xml.rss(RSS_ATTRIBUTES) do
|
52
|
+
xml.channel do
|
53
|
+
xml.title title
|
54
|
+
xml.link link
|
55
|
+
xml.description description
|
56
|
+
xml.language language
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end.to_xml
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.add_item(xml_text, item)
|
63
|
+
doc = Nokogiri::XML(xml_text) { |cfg| cfg.noblanks }
|
64
|
+
Nokogiri::XML::Builder.with(doc.at('channel')) do |xml|
|
65
|
+
item.to_node(xml)
|
66
|
+
end
|
67
|
+
|
68
|
+
doc.to_xml
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
metadata
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sparklecast
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Anatoliy Plastinin
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-10-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: nokogiri
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
41
|
+
description: Sparklecast helps you to create and modify Sparkle's appcast files.
|
42
|
+
email:
|
43
|
+
- hello@antlypls.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- LICENSE
|
49
|
+
- README.md
|
50
|
+
- lib/sparklecast.rb
|
51
|
+
- lib/sparklecast/appcast.rb
|
52
|
+
- lib/sparklecast/version.rb
|
53
|
+
homepage: ''
|
54
|
+
licenses:
|
55
|
+
- MIT
|
56
|
+
metadata: {}
|
57
|
+
post_install_message:
|
58
|
+
rdoc_options: []
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
requirements: []
|
72
|
+
rubyforge_project:
|
73
|
+
rubygems_version: 2.4.2
|
74
|
+
signing_key:
|
75
|
+
specification_version: 4
|
76
|
+
summary: Sparklecast helps you to create and modify Sparkle's appcast files.
|
77
|
+
test_files: []
|