glitter 0.0.1
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.
- data/.gitignore +5 -0
- data/Gemfile +12 -0
- data/Guardfile +8 -0
- data/README.md +58 -0
- data/Rakefile +2 -0
- data/bin/glitter +7 -0
- data/glitter.gemspec +24 -0
- data/lib/glitter.rb +150 -0
- data/lib/glitter/templates/Glitterfile +11 -0
- data/lib/glitter/templates/rss.xml +14 -0
- data/lib/glitter/version.rb +3 -0
- data/spec/lib/glitter_spec.rb +98 -0
- data/spec/spec_helper.rb +5 -0
- metadata +122 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in glitter.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
group :development, :test do
|
7
|
+
gem 'rspec'
|
8
|
+
gem 'rb-fsevent', :require => false if RUBY_PLATFORM =~ /darwin/i
|
9
|
+
gem 'guard-rspec'
|
10
|
+
gem 'growl'
|
11
|
+
gem 'ruby-debug'
|
12
|
+
end
|
data/Guardfile
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard 'rspec', :version => 2, :cli => '--colour' do
|
5
|
+
watch(%r{^spec/.+_spec\.rb})
|
6
|
+
watch(%r{^lib/(.+)\.rb}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
|
+
watch('spec/spec_helper.rb') { "spec" }
|
8
|
+
end
|
data/README.md
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# About Glitter
|
2
|
+
|
3
|
+
Glitter is an easy way to publish Mac software updates to an Amazon S3 bucket using the Sparkle framework (http://sparkle.andymatuschak.org/). It was created at Poll Everywhere to eliminate the need maintaining additional server infrastructure for rolling out Mac desktop software updates.
|
4
|
+
|
5
|
+
It should also be noted that Glitter uses HTTPS S3 URLs to eliminate the need for the maintiance of public/private keys for Sparkle, which further simplifies the publishing process.
|
6
|
+
|
7
|
+
# Getting started
|
8
|
+
|
9
|
+
1. Install the gem
|
10
|
+
|
11
|
+
gem install glitter
|
12
|
+
|
13
|
+
2. Generate a Glitterfile in your project directory
|
14
|
+
|
15
|
+
glitter init .
|
16
|
+
|
17
|
+
3. Edit the Glitterfile
|
18
|
+
|
19
|
+
# After you configure this file, deploy your app with `glitter push`
|
20
|
+
|
21
|
+
name "My App"
|
22
|
+
version "1.0.0"
|
23
|
+
archive "my_app.zip"
|
24
|
+
release_notes "http://myapp.com/release_notes/"
|
25
|
+
|
26
|
+
s3 {
|
27
|
+
bucket "my_app"
|
28
|
+
access_key "access"
|
29
|
+
secret_access_key "sekret"
|
30
|
+
}
|
31
|
+
|
32
|
+
4. Publish your app to the web
|
33
|
+
|
34
|
+
glitter push
|
35
|
+
|
36
|
+
That's it!
|
37
|
+
|
38
|
+
# License
|
39
|
+
|
40
|
+
Copyright (C) 2011 by Brad Gessler
|
41
|
+
|
42
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
43
|
+
of this software and associated documentation files (the "Software"), to deal
|
44
|
+
in the Software without restriction, including without limitation the rights
|
45
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
46
|
+
copies of the Software, and to permit persons to whom the Software is
|
47
|
+
furnished to do so, subject to the following conditions:
|
48
|
+
|
49
|
+
The above copyright notice and this permission notice shall be included in
|
50
|
+
all copies or substantial portions of the Software.
|
51
|
+
|
52
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
53
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
54
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
55
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
56
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
57
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
58
|
+
THE SOFTWARE.
|
data/Rakefile
ADDED
data/bin/glitter
ADDED
data/glitter.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "glitter/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "glitter"
|
7
|
+
s.version = Glitter::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Brad Gessler"]
|
10
|
+
s.email = ["brad@polleverywhere.com"]
|
11
|
+
s.homepage = "https://github.com/polleverywhere/glitter"
|
12
|
+
s.summary = %q{Publish Mac software updates with the Sparkle framework and Amazon S3.}
|
13
|
+
s.description = %q{Glitter makes it easy to publish software updates via the Sparkle framework by using S3 buckets.}
|
14
|
+
|
15
|
+
s.rubyforge_project = "glitter"
|
16
|
+
s.add_dependency "aws-s3"
|
17
|
+
s.add_dependency "haml"
|
18
|
+
s.add_dependency "thor"
|
19
|
+
|
20
|
+
s.files = `git ls-files`.split("\n")
|
21
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
22
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
23
|
+
s.require_paths = ["lib"]
|
24
|
+
end
|
data/lib/glitter.rb
ADDED
@@ -0,0 +1,150 @@
|
|
1
|
+
require 'aws/s3'
|
2
|
+
require 'thor'
|
3
|
+
require 'erb'
|
4
|
+
|
5
|
+
module Glitter
|
6
|
+
# This mix-in Creates a DSL for configuring a class.
|
7
|
+
module Configurable
|
8
|
+
def self.included(base)
|
9
|
+
base.send :extend, ClassMethods
|
10
|
+
base.send :include, InstanceMethods
|
11
|
+
end
|
12
|
+
|
13
|
+
module InstanceMethods
|
14
|
+
def configure(path=nil,&block)
|
15
|
+
path ? instance_eval(File.read(path), path) : instance_eval(&block)
|
16
|
+
self
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
module ClassMethods
|
21
|
+
def attr_configurable(*attrs)
|
22
|
+
attrs.each do |attr|
|
23
|
+
class_eval %(
|
24
|
+
attr_writer :#{attr}
|
25
|
+
attr_overloaded :#{attr})
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def attr_overloaded(*attrs)
|
30
|
+
attrs.each do |attr|
|
31
|
+
class_eval(%{
|
32
|
+
def #{attr}(val=nil)
|
33
|
+
val ? instance_variable_set('@#{attr}', val) : instance_variable_get('@#{attr}')
|
34
|
+
end})
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def configure(*args, &block)
|
39
|
+
new.configure(*args, &block)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# The configuration class that a release uses to deploy
|
45
|
+
class Configuration
|
46
|
+
TemplatePath = File.expand_path('../glitter/templates/Glitterfile', __FILE__).to_s.freeze
|
47
|
+
|
48
|
+
include Configurable
|
49
|
+
attr_configurable :name, :version, :archive, :release_notes, :s3
|
50
|
+
|
51
|
+
class S3
|
52
|
+
include Configurable
|
53
|
+
attr_configurable :bucket, :access_key, :secret_access_key
|
54
|
+
|
55
|
+
def credentials
|
56
|
+
{:access_key_id => access_key, :secret_access_key => secret_access_key}
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def s3(&block)
|
61
|
+
@s3 ||= S3.configure(&block)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
class Release
|
66
|
+
FeedTemplate = File.expand_path('../glitter/templates/rss.xml', __FILE__).to_s.freeze
|
67
|
+
|
68
|
+
attr_accessor :config, :released_at
|
69
|
+
|
70
|
+
def push
|
71
|
+
bucket.new_object(archive_name, file, bucket)
|
72
|
+
end
|
73
|
+
|
74
|
+
def initialize(config)
|
75
|
+
@config, @released_at = config, Time.now
|
76
|
+
AWS::S3::Base.establish_connection! config.s3.credentials
|
77
|
+
end
|
78
|
+
|
79
|
+
def name
|
80
|
+
"#{config.name} #{config.version}"
|
81
|
+
end
|
82
|
+
|
83
|
+
def object_name
|
84
|
+
"#{name.downcase.gsub(/\s/,'-')}#{File.extname(config.archive)}"
|
85
|
+
end
|
86
|
+
|
87
|
+
def pub_date
|
88
|
+
released_at.strftime("%a, %d %b %Y %H:%M:%S %z")
|
89
|
+
end
|
90
|
+
|
91
|
+
def appcast_url
|
92
|
+
url_for 'appcast.xml'
|
93
|
+
end
|
94
|
+
|
95
|
+
def url
|
96
|
+
url_for object_name
|
97
|
+
end
|
98
|
+
|
99
|
+
def to_rss
|
100
|
+
@rss ||= ERB.new(File.read(FeedTemplate)).result(binding)
|
101
|
+
end
|
102
|
+
|
103
|
+
def file
|
104
|
+
@file ||= File.open(config.archive, 'r')
|
105
|
+
end
|
106
|
+
|
107
|
+
def push
|
108
|
+
AWS::S3::S3Object.store(object_name, File.open(config.archive), config.s3.bucket)
|
109
|
+
AWS::S3::S3Object.store('appcast.xml', to_rss, config.s3.bucket)
|
110
|
+
end
|
111
|
+
|
112
|
+
def yank
|
113
|
+
AWS::S3::S3Object.store(object_name, config.s3.bucket)
|
114
|
+
end
|
115
|
+
|
116
|
+
private
|
117
|
+
def url_for(path)
|
118
|
+
"https://s3.amazonaws.com/#{config.s3.bucket}/#{path}"
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
# Command line interface for cutting glitter builds
|
123
|
+
class CLI < Thor
|
124
|
+
desc "init PATH", "Generate a Glitterfile for the path"
|
125
|
+
def init(path)
|
126
|
+
glitterfile_path = File.join(path, 'Glitterfile')
|
127
|
+
puts "Writing new Glitterfile to #{File.expand_path glitterfile_path}"
|
128
|
+
|
129
|
+
File.open glitterfile_path, 'w+' do |file|
|
130
|
+
file.write File.read(Configuration::TemplatePath)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
desc "push", "pushes a build to S3"
|
135
|
+
def push
|
136
|
+
puts "Pushing #{release.object_name} to bucket #{config.s3.bucket}..."
|
137
|
+
release.push
|
138
|
+
puts "Pushed to #{release.url}!"
|
139
|
+
end
|
140
|
+
|
141
|
+
private
|
142
|
+
def config
|
143
|
+
@config ||= Configuration.configure('./Glitterfile')
|
144
|
+
end
|
145
|
+
|
146
|
+
def release
|
147
|
+
@release ||= Release.new(config)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# After you configure this file, deploy your app with `glitter push`
|
2
|
+
name "My App"
|
3
|
+
version "1.0.0"
|
4
|
+
archive "my_app.zip"
|
5
|
+
release_notes "http://myapp.com/release_notes/"
|
6
|
+
|
7
|
+
s3 {
|
8
|
+
bucket "my_app"
|
9
|
+
access_key "access"
|
10
|
+
secret_access_key "sekret"
|
11
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<rss xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
|
2
|
+
<channel>
|
3
|
+
<title><%= config.name %></title>
|
4
|
+
<link><%= appcast_url %></link>
|
5
|
+
<description>Software updates for <%= config.name %></description>
|
6
|
+
<language>en</language>
|
7
|
+
<item>
|
8
|
+
<title><%= name %></title>
|
9
|
+
<sparkle:releaseNotesLink><%= config.release_notes %></sparkle:releaseNotesLink>
|
10
|
+
<pubDate><%= pub_date %></pubDate>
|
11
|
+
<enclosure url="<%= url %>" sparkle:version="2.0" length="<%= file.stat.size %>" type="application/octet-stream" />
|
12
|
+
</item>
|
13
|
+
</channel>
|
14
|
+
</rss>
|
@@ -0,0 +1,98 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'rexml/document'
|
3
|
+
|
4
|
+
describe Glitter::Release do
|
5
|
+
before(:all) do
|
6
|
+
@release = Glitter::Release.new Glitter::Configuration.configure {
|
7
|
+
name "My App"
|
8
|
+
version "1.0.0"
|
9
|
+
archive "lib/glitter.rb"
|
10
|
+
release_notes "http://myapp.com/release_notes/"
|
11
|
+
|
12
|
+
s3 {
|
13
|
+
bucket "my_app"
|
14
|
+
access_key "access"
|
15
|
+
secret_access_key "sekret"
|
16
|
+
}
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should have name" do
|
21
|
+
@release.name.should eql("My App 1.0.0")
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should generate rss entry" do
|
25
|
+
REXML::Document.new(@release.to_rss).root.attributes["sparkle"].should eql('http://www.andymatuschak.org/xml-namespaces/sparkle')
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should have object_name" do
|
29
|
+
@release.object_name.should eql("my-app-1.0.0.rb")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe Glitter::Configuration do
|
34
|
+
|
35
|
+
shared_examples_for "configuration" do
|
36
|
+
it "should read name" do
|
37
|
+
@config.name.should eql("My App")
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should read version" do
|
41
|
+
@config.version.should eql("1.0.0")
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should read archive" do
|
45
|
+
@config.archive.should eql("my_app.zip")
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should read release notes" do
|
49
|
+
@config.release_notes.should eql("http://myapp.com/release_notes/")
|
50
|
+
end
|
51
|
+
|
52
|
+
context "s3" do
|
53
|
+
it "should read bucket" do
|
54
|
+
@config.s3.bucket.should eql("my_app")
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should read access_key" do
|
58
|
+
@config.s3.access_key.should eql("access")
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should read secret_access_key" do
|
62
|
+
@config.s3.secret_access_key.should eql("sekret")
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should have a valid Glitterfile template path" do
|
67
|
+
File.exists?(Glitter::Configuration::TemplatePath).should be_true
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
context "block configuration" do
|
72
|
+
before(:all) do
|
73
|
+
@config = Glitter::Configuration.configure do
|
74
|
+
name "My App"
|
75
|
+
version "1.0.0"
|
76
|
+
archive "my_app.zip"
|
77
|
+
release_notes "http://myapp.com/release_notes/"
|
78
|
+
|
79
|
+
s3 {
|
80
|
+
bucket "my_app"
|
81
|
+
access_key "access"
|
82
|
+
secret_access_key "sekret"
|
83
|
+
}
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
it_should_behave_like "configuration"
|
88
|
+
end
|
89
|
+
|
90
|
+
context "file configuration" do
|
91
|
+
before(:all) do
|
92
|
+
@config = Glitter::Configuration.configure File.expand_path('../../../lib/glitter/templates/Glitterfile', __FILE__)
|
93
|
+
end
|
94
|
+
|
95
|
+
it_should_behave_like "configuration"
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: glitter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Brad Gessler
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-06-06 00:00:00 -07:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: aws-s3
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: haml
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: thor
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
61
|
+
type: :runtime
|
62
|
+
version_requirements: *id003
|
63
|
+
description: Glitter makes it easy to publish software updates via the Sparkle framework by using S3 buckets.
|
64
|
+
email:
|
65
|
+
- brad@polleverywhere.com
|
66
|
+
executables:
|
67
|
+
- glitter
|
68
|
+
extensions: []
|
69
|
+
|
70
|
+
extra_rdoc_files: []
|
71
|
+
|
72
|
+
files:
|
73
|
+
- .gitignore
|
74
|
+
- Gemfile
|
75
|
+
- Guardfile
|
76
|
+
- README.md
|
77
|
+
- Rakefile
|
78
|
+
- bin/glitter
|
79
|
+
- glitter.gemspec
|
80
|
+
- lib/glitter.rb
|
81
|
+
- lib/glitter/templates/Glitterfile
|
82
|
+
- lib/glitter/templates/rss.xml
|
83
|
+
- lib/glitter/version.rb
|
84
|
+
- spec/lib/glitter_spec.rb
|
85
|
+
- spec/spec_helper.rb
|
86
|
+
has_rdoc: true
|
87
|
+
homepage: https://github.com/polleverywhere/glitter
|
88
|
+
licenses: []
|
89
|
+
|
90
|
+
post_install_message:
|
91
|
+
rdoc_options: []
|
92
|
+
|
93
|
+
require_paths:
|
94
|
+
- lib
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
hash: 3
|
101
|
+
segments:
|
102
|
+
- 0
|
103
|
+
version: "0"
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
hash: 3
|
110
|
+
segments:
|
111
|
+
- 0
|
112
|
+
version: "0"
|
113
|
+
requirements: []
|
114
|
+
|
115
|
+
rubyforge_project: glitter
|
116
|
+
rubygems_version: 1.4.2
|
117
|
+
signing_key:
|
118
|
+
specification_version: 3
|
119
|
+
summary: Publish Mac software updates with the Sparkle framework and Amazon S3.
|
120
|
+
test_files:
|
121
|
+
- spec/lib/glitter_spec.rb
|
122
|
+
- spec/spec_helper.rb
|