Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixing migrations and batching finds

  • Loading branch information...
commit a81cc3cd82b513745f09289fa88b6e4de45e9a64 1 parent 3e83e04
@PRXci PRXci authored
View
3  .gitignore
@@ -13,4 +13,5 @@ build/*
.svn
profile
spec/active_record/test.db
-.bundle
+.bundle
+**/.svn
View
32 apn_on_rails.gemspec
@@ -5,11 +5,11 @@
Gem::Specification.new do |s|
s.name = %q{apn_on_rails}
- s.version = "0.3.1"
+ s.version = "0.4.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["markbates", "Rebecca Nesson"]
- s.date = %q{2010-10-06}
+ s.date = %q{2010-11-04}
s.description = %q{APN on Rails is a Ruby on Rails gem that allows you to
easily add Apple Push Notification (iPhone) support to your Rails application.
}
@@ -22,6 +22,7 @@ easily add Apple Push Notification (iPhone) support to your Rails application.
s.files = [
".gitignore",
".rspec",
+ ".specification",
"Gemfile",
"Gemfile.lock",
"LICENSE",
@@ -34,24 +35,43 @@ easily add Apple Push Notification (iPhone) support to your Rails application.
"generators/templates/apn_migrations/001_create_apn_devices.rb",
"generators/templates/apn_migrations/002_create_apn_notifications.rb",
"generators/templates/apn_migrations/003_alter_apn_devices.rb",
+ "generators/templates/apn_migrations/004_create_apn_apps.rb",
+ "generators/templates/apn_migrations/005_create_groups.rb",
+ "generators/templates/apn_migrations/006_alter_apn_groups.rb",
+ "generators/templates/apn_migrations/007_create_device_groups.rb",
+ "generators/templates/apn_migrations/008_create_apn_group_notifications.rb",
+ "generators/templates/apn_migrations/009_create_pull_notifications.rb",
"lib/apn_on_rails.rb",
"lib/apn_on_rails/apn_on_rails.rb",
+ "lib/apn_on_rails/app/models/apn/app.rb",
"lib/apn_on_rails/app/models/apn/base.rb",
"lib/apn_on_rails/app/models/apn/device.rb",
+ "lib/apn_on_rails/app/models/apn/device_grouping.rb",
+ "lib/apn_on_rails/app/models/apn/group.rb",
+ "lib/apn_on_rails/app/models/apn/group_notification.rb",
"lib/apn_on_rails/app/models/apn/notification.rb",
+ "lib/apn_on_rails/app/models/apn/pull_notification.rb",
"lib/apn_on_rails/libs/connection.rb",
"lib/apn_on_rails/libs/feedback.rb",
"lib/apn_on_rails/tasks/apn.rake",
"lib/apn_on_rails/tasks/db.rake",
"lib/apn_on_rails_tasks.rb",
"spec/active_record/setup_ar.rb",
+ "spec/apn_on_rails/app/models/apn/app_spec.rb",
"spec/apn_on_rails/app/models/apn/device_spec.rb",
+ "spec/apn_on_rails/app/models/apn/group_notification_spec.rb",
"spec/apn_on_rails/app/models/apn/notification_spec.rb",
+ "spec/apn_on_rails/app/models/apn/pull_notification_spec.rb",
"spec/apn_on_rails/libs/connection_spec.rb",
"spec/apn_on_rails/libs/feedback_spec.rb",
"spec/extensions/string.rb",
+ "spec/factories/app_factory.rb",
"spec/factories/device_factory.rb",
+ "spec/factories/device_grouping_factory.rb",
+ "spec/factories/group_factory.rb",
+ "spec/factories/group_notification_factory.rb",
"spec/factories/notification_factory.rb",
+ "spec/factories/pull_notification_factory.rb",
"spec/fixtures/hexa.bin",
"spec/fixtures/message_for_sending.bin",
"spec/rails_root/config/apple_push_notification_development.pem",
@@ -63,13 +83,21 @@ easily add Apple Push Notification (iPhone) support to your Rails application.
s.summary = %q{Apple Push Notifications on Rails}
s.test_files = [
"spec/active_record/setup_ar.rb",
+ "spec/apn_on_rails/app/models/apn/app_spec.rb",
"spec/apn_on_rails/app/models/apn/device_spec.rb",
+ "spec/apn_on_rails/app/models/apn/group_notification_spec.rb",
"spec/apn_on_rails/app/models/apn/notification_spec.rb",
+ "spec/apn_on_rails/app/models/apn/pull_notification_spec.rb",
"spec/apn_on_rails/libs/connection_spec.rb",
"spec/apn_on_rails/libs/feedback_spec.rb",
"spec/extensions/string.rb",
+ "spec/factories/app_factory.rb",
"spec/factories/device_factory.rb",
+ "spec/factories/device_grouping_factory.rb",
+ "spec/factories/group_factory.rb",
+ "spec/factories/group_notification_factory.rb",
"spec/factories/notification_factory.rb",
+ "spec/factories/pull_notification_factory.rb",
"spec/spec_helper.rb"
]
View
1  generators/templates/apn_migrations/002_create_apn_notifications.rb
@@ -9,7 +9,6 @@ def self.up
t.string :sound
t.string :alert, :size => 150
t.integer :badge
- t.text :custom_properties
t.datetime :sent_at
t.timestamps
end
View
15 generators/templates/apn_migrations/010_alter_apn_notifications.rb
@@ -0,0 +1,15 @@
+class AlterApnNotifications < ActiveRecord::Migration # :nodoc:
+
+ def self.up
+ unless APN::Notification.column_names.include?("custom_properties")
+ add_column :apn_notifications, :custom_properties, :text
+ end
+ end
+
+ def self.down
+ if APN::Notification.column_names.include?("custom_properties")
+ remove_column :apn_notifications, :custom_properties
+ end
+ end
+
+end
View
6 lib/apn_on_rails/app/models/apn/app.rb
@@ -25,7 +25,7 @@ def send_notifications
end
unless self.unsent_notifications.nil? || self.unsent_notifications.empty?
APN::Connection.open_for_delivery({:cert => self.cert}) do |conn, sock|
- unsent_notifications.each do |noty|
+ unsent_notifications.find_each do |noty|
conn.write(noty.message_for_sending)
noty.sent_at = Time.now
noty.save
@@ -50,7 +50,7 @@ def send_group_notifications
APN::Connection.open_for_delivery({:cert => self.cert}) do |conn, sock|
unsent_group_notifications.each do |gnoty|
puts "number of devices is #{gnoty.devices.size}"
- gnoty.devices.each do |device|
+ gnoty.devices.find_each do |device|
conn.write(gnoty.message_for_sending(device))
end
gnoty.sent_at = Time.now
@@ -67,7 +67,7 @@ def send_group_notification(gnoty)
end
unless gnoty.nil?
APN::Connection.open_for_delivery({:cert => self.cert}) do |conn, sock|
- gnoty.devices.each do |device|
+ gnoty.devices.find_each do |device|
conn.write(gnoty.message_for_sending(device))
end
gnoty.sent_at = Time.now
Please sign in to comment.
Something went wrong with that request. Please try again.