crusade-apns 0.6.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -0
- data/.travis.yml +2 -3
- data/Gemfile +1 -1
- data/crusade-apns.gemspec +2 -0
- data/lib/crusade/apns/configuration.rb +0 -18
- data/lib/crusade/apns/push_notification.rb +4 -0
- data/lib/crusade/apns/push_package_generator.rb +6 -0
- data/lib/crusade/apns/version.rb +1 -1
- data/test/test_helper.rb +7 -1
- data/test/unit/configuration_test.rb +0 -51
- metadata +31 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3f95ddb07469fa790dd4692470ec4119cfc944d
|
4
|
+
data.tar.gz: 02daf2f36ebcf502067db47495465b3faf8d975a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00225b43140c6039f924d8dba31adfddace4a1e34e0f8b5ba11755d33322d7d590c319be17afd5f023bb074853bb65063920ff70a5ebe1a5b0161e78c5e4ec05
|
7
|
+
data.tar.gz: ef540d4d464d8c3e52020228cc8b8c5470db85388a6f6c29780d1b685578683ba370d3885405b1cd9a21aa063845647a4b1d297703503376ba522fe157008ebb
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/crusade-apns.gemspec
CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
+
spec.add_dependency "crusade", Crusade::APNS::VERSION
|
21
22
|
spec.add_dependency "rubyzip", "~> 1.0.0"
|
22
23
|
|
23
24
|
spec.add_development_dependency "json_expressions", "~> 0.8.2"
|
@@ -25,4 +26,5 @@ Gem::Specification.new do |spec|
|
|
25
26
|
spec.add_development_dependency "minitest", "~> 5.0.7"
|
26
27
|
spec.add_development_dependency "minitest-great_expectations", "~> 0.0.5"
|
27
28
|
spec.add_development_dependency "rake"
|
29
|
+
spec.add_development_dependency "coveralls"
|
28
30
|
end
|
@@ -29,24 +29,6 @@ module Crusade
|
|
29
29
|
def temp_dir
|
30
30
|
@temp_dir ||= Dir.mktmpdir
|
31
31
|
end
|
32
|
-
|
33
|
-
def self.load config_file, env = 'development'
|
34
|
-
yaml = load_yaml config_file
|
35
|
-
config = symbolize_keys yaml[env.to_s]
|
36
|
-
new(config)
|
37
|
-
end
|
38
|
-
|
39
|
-
private
|
40
|
-
|
41
|
-
def self.symbolize_keys h
|
42
|
-
h.inject({}) do |memo, (k,v) |
|
43
|
-
memo.update k.to_sym => v
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def self.load_yaml config_file
|
48
|
-
YAML.load_file config_file
|
49
|
-
end
|
50
32
|
end
|
51
33
|
end
|
52
34
|
end
|
@@ -1,8 +1,11 @@
|
|
1
|
+
require 'crusade/logger'
|
1
2
|
require 'crusade/apns/socket_connection'
|
2
3
|
|
3
4
|
module Crusade
|
4
5
|
module APNS
|
5
6
|
class PushNotification
|
7
|
+
include Crusade::Logger
|
8
|
+
|
6
9
|
attr_reader :configuration
|
7
10
|
|
8
11
|
def initialize(configuration, connection = nil)
|
@@ -12,6 +15,7 @@ module Crusade
|
|
12
15
|
end
|
13
16
|
|
14
17
|
def send notification
|
18
|
+
info "sending notification #{notification.inspect}"
|
15
19
|
connection.send encoder.encode notification
|
16
20
|
end
|
17
21
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'crusade/logger'
|
1
2
|
require 'crusade/apns/push_package/directory_structure_generator'
|
2
3
|
require 'crusade/apns/push_package/website_file_generator'
|
3
4
|
require 'crusade/apns/push_package/manifest_generator'
|
@@ -7,11 +8,15 @@ require 'crusade/apns/push_package/zip_file_generator'
|
|
7
8
|
module Crusade
|
8
9
|
module APNS
|
9
10
|
class PushPackageGenerator
|
11
|
+
include Crusade::Logger
|
12
|
+
|
10
13
|
def initialize configuration
|
11
14
|
self.configuration = configuration
|
12
15
|
end
|
13
16
|
|
14
17
|
def generate user_id
|
18
|
+
info "generating push package for user #{user_id}"
|
19
|
+
|
15
20
|
FileUtils.remove_entry_secure configuration.temp_dir
|
16
21
|
FileUtils.mkdir configuration.temp_dir
|
17
22
|
|
@@ -30,6 +35,7 @@ module Crusade
|
|
30
35
|
|
31
36
|
Crusade::APNS::ZipFileGenerator.new(configuration, configuration.temp_dir, push_package).generate
|
32
37
|
|
38
|
+
debug "push package generated #{push_package} - with user token #{user_token}"
|
33
39
|
[ user_token, push_package ]
|
34
40
|
end
|
35
41
|
|
data/lib/crusade/apns/version.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
if ENV['CI']
|
2
|
+
require 'coveralls'
|
3
|
+
Coveralls.wear!
|
4
|
+
end
|
5
|
+
|
1
6
|
require 'minitest/autorun'
|
2
7
|
require 'minitest/spec'
|
3
8
|
require 'minitest/mock'
|
@@ -6,4 +11,5 @@ require 'minitest/great_expectations'
|
|
6
11
|
$:.unshift 'test/support'
|
7
12
|
|
8
13
|
require 'ostruct'
|
9
|
-
require 'fixtures'
|
14
|
+
require 'fixtures'
|
15
|
+
require 'crusade'
|
@@ -100,56 +100,5 @@ describe Crusade::APNS::Configuration do
|
|
100
100
|
end
|
101
101
|
end
|
102
102
|
end
|
103
|
-
|
104
|
-
describe 'load' do
|
105
|
-
let(:config_file) { 'test/fixtures/config.yml' }
|
106
|
-
let(:env) { 'test' }
|
107
|
-
|
108
|
-
subject { described_class.load config_file, env }
|
109
|
-
|
110
|
-
it 'loads the site_name' do
|
111
|
-
subject.site_name.must_equal 'Apns config fixture'
|
112
|
-
end
|
113
|
-
|
114
|
-
it 'loads the push_id' do
|
115
|
-
subject.push_id.must_equal 'web.com.example.push.id'
|
116
|
-
end
|
117
|
-
|
118
|
-
it 'loads the iconset_dir' do
|
119
|
-
subject.iconset_dir.must_equal 'lib/icon.iconset'
|
120
|
-
end
|
121
|
-
|
122
|
-
it 'loads the certificate' do
|
123
|
-
subject.certificate.must_equal 'config/certificate.p12'
|
124
|
-
end
|
125
|
-
|
126
|
-
it 'loads the certificate_password' do
|
127
|
-
subject.certificate_password.must_be_nil
|
128
|
-
end
|
129
|
-
|
130
|
-
it 'loads the url_format' do
|
131
|
-
subject.url_format.must_equal 'http://localhost/push/%@'
|
132
|
-
end
|
133
|
-
|
134
|
-
it 'loads the webservice_url' do
|
135
|
-
subject.webservice_url.must_equal 'https://localhost/push'
|
136
|
-
end
|
137
|
-
|
138
|
-
it 'loads the allowed_domains' do
|
139
|
-
subject.allowed_domains.must_equal ['http://localhost', 'https://localhost']
|
140
|
-
end
|
141
|
-
|
142
|
-
describe 'load development if no env is provided' do
|
143
|
-
subject { described_class.load config_file }
|
144
|
-
|
145
|
-
it 'loads the certificate_password' do
|
146
|
-
subject.certificate_password.must_equal 'test'
|
147
|
-
end
|
148
|
-
|
149
|
-
it 'loads the url_format' do
|
150
|
-
subject.url_format.must_equal 'http://www.example.com/push/%@'
|
151
|
-
end
|
152
|
-
end
|
153
|
-
end
|
154
103
|
end
|
155
104
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crusade-apns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Rouchy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: crusade
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.8.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.8.0
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: rubyzip
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +108,20 @@ dependencies:
|
|
94
108
|
- - '>='
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: coveralls
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
97
125
|
description: APNS pluging for crusade
|
98
126
|
email:
|
99
127
|
- drouchy@gmail.com
|
@@ -101,6 +129,7 @@ executables: []
|
|
101
129
|
extensions: []
|
102
130
|
extra_rdoc_files: []
|
103
131
|
files:
|
132
|
+
- .coveralls.yml
|
104
133
|
- .gitignore
|
105
134
|
- .travis.yml
|
106
135
|
- Gemfile
|