c2dm_on_rails 0.1.8 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source :rubygems
2
+ gem 'jeweler'
3
+ gem 'configatron'
4
+ gem 'gdata'
data/Gemfile.lock ADDED
@@ -0,0 +1,21 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ configatron (2.7.2)
5
+ yamler (>= 0.1.0)
6
+ gdata (1.1.2)
7
+ git (1.2.5)
8
+ jeweler (1.6.4)
9
+ bundler (~> 1.0)
10
+ git (>= 1.2.5)
11
+ rake
12
+ rake (0.8.7)
13
+ yamler (0.1.0)
14
+
15
+ PLATFORMS
16
+ ruby
17
+
18
+ DEPENDENCIES
19
+ configatron
20
+ gdata
21
+ jeweler
data/README.textile CHANGED
@@ -1,16 +1,6 @@
1
- NOTICE:
1
+ h1. C2dm on Rails (Android Cloud to Device Messaging on Rails)
2
2
 
3
- This gem works only with Rails 2 and Ruby 1.8. I currently have time only for
4
- bug fixes, so if somebody would make this work with Ruby 1.9/Rails 3, please
5
- fork it and throw me a pull request, so I'll make a new branch and release a
6
- new version to rubygems.
7
-
8
- h1. C2dm on Rails (Android push notifications on Rails)
9
-
10
- C2dm on Rails is a Ruby on Rails gem that allows you to easily add Apple Push Notification (iPhone)
11
- support to your Rails application.
12
-
13
- C2dm on Rails is a Ruby on Rails gem that allows you to easily add Android push notification
3
+ C2dm on Rails is a Ruby on Rails gem that allows you to easily add Android Cloud to Device Messaging (push notification)
14
4
  (Android 2.2> devices) to your Rails application.
15
5
 
16
6
  h2. Acknowledgements:
@@ -36,32 +26,14 @@ Sign up here:
36
26
 
37
27
  h2. Installing:
38
28
 
39
- h3. Stable (RubyForge):
40
-
41
- <pre><code>
42
- $ sudo gem install c2dm_on_rails
43
- </code></pre>
44
-
45
- h3. Rails Gem Management:
46
-
47
- If you like to use the built in Rails gem management:
48
-
29
+ Add the following line to your Gemfile:
49
30
  <pre><code>
50
- config.gem 'c2dm_on_rails'
31
+ gem 'c2dm_on_rails'
51
32
  </code></pre>
52
33
 
53
34
  h2. Setup and Configuration:
54
35
 
55
- Once you have the gem installed via your favorite gem installation, you need to require it so you can
56
- start to use it:
57
-
58
- Add the following require, wherever it makes sense to you:
59
-
60
- <pre><code>
61
- require 'c2dm_on_rails'
62
- </code></pre>
63
-
64
- You also need to add the following to your Rakefile so you can use the
36
+ You need to add the following to your Rakefile so you can use the
65
37
  Rake tasks that ship with C2dm on Rails:
66
38
 
67
39
  <pre><code>
@@ -75,28 +47,17 @@ Rake tasks that ship with C2dm on Rails:
75
47
  Now, to create the tables you need for C2dm on Rails, run the following task:
76
48
 
77
49
  <pre><code>
78
- $ ruby script/generate c2dm_migrations
50
+ $ rails generate c2dm_migrations
79
51
  </code></pre>
80
52
 
81
53
  C2dm on Rails uses the Configatron gem, "http://github.com/markbates/configatron/tree/master":http://github.com/markbates/configatron/tree/master,
82
- to configure itself. C2dm on Rails has the following default configurations that you change as you
83
- see fit:
84
-
54
+ to configure itself. C2dm on Rails uses also the gdata gem for connecting a Google account. The following is an example of an initializer script to
55
+ be run to configure the gem (you could put it in config/initializers/c2dm_on_rails.rb):
85
56
  <pre><code>
86
57
  configatron.c2dm.api_url = 'https://android.apis.google.com/c2dm/send'
87
- </code></pre>
88
-
89
- C2dm on Rails uses also the gdata gem for connecting a Google account. The
90
- config file for Google Connect (config/c2dm.yml) should look like this:
91
-
92
- <pre><code>
93
- development:
94
- username: your_user_name
95
- password: password_for_the_account
96
- app_name: your_applications_name
97
-
98
- production:
99
- ... etc
58
+ configatron.c2dm.username = 'your_user_name'
59
+ configatron.c2dm.password = 'password_for_the account'
60
+ configatron.c2dm.app_name = 'your_application_name'
100
61
  </code></pre>
101
62
 
102
63
  That's it, now you're ready to start creating notifications.
@@ -106,7 +67,7 @@ h3. Upgrade Notes:
106
67
  If you are upgrading to a new version of C2dm on Rails you should always run:
107
68
 
108
69
  <pre><code>
109
- $ ruby script/generate c2dm_migrations
70
+ $ rails generate c2dm_migrations
110
71
  </code></pre>
111
72
 
112
73
  That way you ensure you have the latest version of the database tables needed.
data/Rakefile CHANGED
@@ -1,12 +1,26 @@
1
1
  require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+
2
11
  require 'rake'
3
- require 'echoe'
4
12
 
5
- Echoe.new('c2dm_on_rails', '0.1.8') do |p|
6
- p.description = "Android push notifications on Rails."
7
- p.url = "http://github.com/pimeys/c2dm_on_rails"
8
- p.author = "Julius de Bruijn"
9
- p.email = "julius.debruijn@digia.com"
10
- p.ignore_pattern = ["tmp/*", "script/*"]
11
- p.development_dependencies = ["gdata >=1.1.1", "configatron >=2.6.3"]
13
+ require 'jeweler'
14
+ Jeweler::Tasks.new do |gem|
15
+ gem.name = "c2dm_on_rails"
16
+ gem.summary = "Android Cloud to Device Messaging (push notifications) on Rails"
17
+
18
+ gem.description = %q{C2DM on Rails is a Ruby on Rails gem that allows you to
19
+ easily add Android Cloud to Device Messaging support to your Rails application.
20
+ }
21
+
22
+ gem.email = "julius.debruijn@digia.com"
23
+ gem.homepage = "http://github.com/pimeys/c2dm_on_rails"
24
+ gem.authors = ["Julius de Bruijn"]
12
25
  end
26
+ task :default => :spec
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.2.0
@@ -1,35 +1,66 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
1
4
  # -*- encoding: utf-8 -*-
2
5
 
3
6
  Gem::Specification.new do |s|
4
7
  s.name = %q{c2dm_on_rails}
5
- s.version = "0.1.8"
8
+ s.version = "0.2.0"
6
9
 
7
- s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
- s.authors = [%q{Julius de Bruijn}]
9
- s.date = %q{2011-08-01}
10
- s.description = %q{Android push notifications on Rails.}
11
- s.email = %q{julius.debruijn@digia.com}
12
- s.extra_rdoc_files = [%q{CHANGELOG}, %q{LICENSE}, %q{README.textile}, %q{lib/c2dm_on_rails.rb}, %q{lib/c2dm_on_rails/app/models/c2dm/base.rb}, %q{lib/c2dm_on_rails/app/models/c2dm/device.rb}, %q{lib/c2dm_on_rails/app/models/c2dm/notification.rb}, %q{lib/c2dm_on_rails/c2dm_on_rails.rb}, %q{lib/c2dm_on_rails/libs/connection.rb}, %q{lib/c2dm_on_rails/tasks/c2dm.rake}, %q{lib/c2dm_on_rails_tasks.rb}]
13
- s.files = [%q{CHANGELOG}, %q{LICENSE}, %q{Manifest}, %q{README.textile}, %q{Rakefile}, %q{c2dm_on_rails.gemspec}, %q{generators/c2dm_migrations_generator.rb}, %q{generators/templates/c2dm_migrations/001_create_c2dm_devices.rb}, %q{generators/templates/c2dm_migrations/002_create_c2dm_notifications.rb}, %q{lib/c2dm_on_rails.rb}, %q{lib/c2dm_on_rails/app/models/c2dm/base.rb}, %q{lib/c2dm_on_rails/app/models/c2dm/device.rb}, %q{lib/c2dm_on_rails/app/models/c2dm/notification.rb}, %q{lib/c2dm_on_rails/c2dm_on_rails.rb}, %q{lib/c2dm_on_rails/libs/connection.rb}, %q{lib/c2dm_on_rails/tasks/c2dm.rake}, %q{lib/c2dm_on_rails_tasks.rb}]
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Julius de Bruijn"]
12
+ s.date = %q{2011-08-26}
13
+ s.description = %q{C2DM on Rails is a Ruby on Rails gem that allows you to
14
+ easily add Android Cloud to Device Messaging support to your Rails application.
15
+ }
16
+ s.email = %q{julius.bruijn@sponsorpay.com}
17
+ s.extra_rdoc_files = [
18
+ "LICENSE",
19
+ "README.textile"
20
+ ]
21
+ s.files = [
22
+ "CHANGELOG",
23
+ "Gemfile",
24
+ "Gemfile.lock",
25
+ "LICENSE",
26
+ "Manifest",
27
+ "README.textile",
28
+ "Rakefile",
29
+ "VERSION",
30
+ "c2dm_on_rails.gemspec",
31
+ "lib/c2dm_on_rails.rb",
32
+ "lib/c2dm_on_rails/app/models/c2dm/base.rb",
33
+ "lib/c2dm_on_rails/app/models/c2dm/device.rb",
34
+ "lib/c2dm_on_rails/app/models/c2dm/notification.rb",
35
+ "lib/c2dm_on_rails/c2dm_on_rails.rb",
36
+ "lib/c2dm_on_rails/libs/connection.rb",
37
+ "lib/c2dm_on_rails/tasks/c2dm.rake",
38
+ "lib/c2dm_on_rails_tasks.rb",
39
+ "lib/generators/c2dm_migrations_generator.rb",
40
+ "lib/generators/templates/c2dm_migrations/create_c2dm_devices.rb",
41
+ "lib/generators/templates/c2dm_migrations/create_c2dm_notifications.rb"
42
+ ]
14
43
  s.homepage = %q{http://github.com/pimeys/c2dm_on_rails}
15
- s.rdoc_options = [%q{--line-numbers}, %q{--inline-source}, %q{--title}, %q{C2dm_on_rails}, %q{--main}, %q{README.textile}]
16
- s.require_paths = [%q{lib}]
17
- s.rubyforge_project = %q{c2dm_on_rails}
18
- s.rubygems_version = %q{1.8.6}
19
- s.summary = %q{Android push notifications on Rails.}
44
+ s.require_paths = ["lib"]
45
+ s.rubygems_version = %q{1.5.2}
46
+ s.summary = %q{Android Cloud to Device Messaging (push notifications) on Rails}
20
47
 
21
48
  if s.respond_to? :specification_version then
22
49
  s.specification_version = 3
23
50
 
24
51
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
25
- s.add_development_dependency(%q<gdata>, [">= 1.1.1"])
26
- s.add_development_dependency(%q<configatron>, [">= 2.6.3"])
52
+ s.add_runtime_dependency(%q<jeweler>, [">= 0"])
53
+ s.add_runtime_dependency(%q<configatron>, [">= 0"])
54
+ s.add_runtime_dependency(%q<gdata>, [">= 0"])
27
55
  else
28
- s.add_dependency(%q<gdata>, [">= 1.1.1"])
29
- s.add_dependency(%q<configatron>, [">= 2.6.3"])
56
+ s.add_dependency(%q<jeweler>, [">= 0"])
57
+ s.add_dependency(%q<configatron>, [">= 0"])
58
+ s.add_dependency(%q<gdata>, [">= 0"])
30
59
  end
31
60
  else
32
- s.add_dependency(%q<gdata>, [">= 1.1.1"])
33
- s.add_dependency(%q<configatron>, [">= 2.6.3"])
61
+ s.add_dependency(%q<jeweler>, [">= 0"])
62
+ s.add_dependency(%q<configatron>, [">= 0"])
63
+ s.add_dependency(%q<gdata>, [">= 0"])
34
64
  end
35
65
  end
66
+
@@ -40,7 +40,9 @@ class C2dm::Notification < C2dm::Base
40
40
  unless notifications.nil? || notifications.empty?
41
41
  C2dm::Connection.open do |token|
42
42
  notifications.each do |noty|
43
+ puts "sending notification #{noty.id} to device #{noty.device.registration_id}"
43
44
  response = C2dm::Connection.send_notification(noty, token)
45
+ puts "response: #{response[:code]}; #{response.inspect}"
44
46
  if response[:code] == 200
45
47
  case response[:message]
46
48
  when "Error=QuotaExceeded"
@@ -2,130 +2,102 @@ require 'configatron'
2
2
  require 'gdata'
3
3
  require 'uri'
4
4
 
5
- rails_root = File.join(FileUtils.pwd, 'rails_root')
6
- if defined?(RAILS_ROOT)
7
- rails_root = RAILS_ROOT
8
- end
9
-
10
- rails_env = 'development'
11
- if defined?(RAILS_ENV)
12
- rails_env = RAILS_ENV
13
- end
14
-
15
- begin
16
- APP_CONFIG = YAML.load_file("#{RAILS_ROOT}/config/c2dm.yml")[rails_env]
17
- rescue => ex
18
- raise C2dm::Errors.ConfigFileNotFound.new(ex.message)
19
- end
20
-
21
- begin
22
- configatron.c2dm.api_url = URI.parse('https://android.apis.google.com/c2dm/send')
23
- configatron.c2dm.username = APP_CONFIG['username']
24
- configatron.c2dm.password = APP_CONFIG['password']
25
- configatron.c2dm.app_name = APP_CONFIG['app_name']
26
- rescue => ex
27
- raise C2dm::Errors.ConfigFileMissingAttributes.new(ex.message)
28
- end
29
-
30
5
  module C2dm # :nodoc:
31
-
32
6
  module Errors # :nodoc:
33
-
34
7
  # The payload of the message is too big, the limit is currently 1024
35
8
  # bytes. Reduce the size of the message.
36
9
  class MessageTooBig < StandardError
37
-
38
10
  def initialize(message) # :nodoc:
39
11
  super("The maximum size allowed for a notification payload is 1024 bytes: '#{message}'")
40
12
  end
41
-
42
13
  end
43
14
 
44
15
  # Too many messages sent by the sender. Retry after a while.
45
16
  class QuotaExceeded < StandardError
46
-
47
17
  def initialize(message) # :nodoc:
48
18
  super("Too many messages sent by the sender: '#{message}'")
49
19
  end
50
-
51
20
  end
52
21
 
53
22
  # Too many messages sent by the sender to a specific device. Retry after a
54
23
  # while.
55
24
  class DeviceQuotaExceeded < StandardError
56
-
57
25
  def initialize(message) # :nodoc:
58
26
  super("Too many messages sent by the sender to a specific device: '#{message}'")
59
27
  end
60
-
61
28
  end
62
-
29
+
63
30
  # Missing or bad registration_id. Sender should stop sending messages to
64
31
  # this device.
65
32
  class InvalidRegistration < StandardError
66
-
67
33
  def initialize(message) # :nodoc:
68
34
  super("Missing or bad registration_id: '#{message}'")
69
35
  end
70
-
71
36
  end
72
-
37
+
73
38
  # The registration_id is no longer valid, for example user has uninstalled
74
39
  # the application or turned off notifications. Sender should stop sending
75
40
  # messages to this device.
76
41
  class NotRegistered < StandardError
77
-
78
42
  def initialize(message) # :nodoc:
79
43
  super("The registration_id is no longer valid: '#{message}'")
80
44
  end
81
-
82
45
  end
83
46
 
84
47
  # Collapse key is required. Include collapse key in the request.
85
48
  class MissingCollapseKey < StandardError
86
-
87
49
  def initialize(message) # :nodoc:
88
50
  super("Collapse key is required: '#{message}'")
89
51
  end
90
-
91
52
  end
92
53
 
93
54
  # ClientLogin AUTH_TOKEN is invalid. Check the config
94
55
  class InvalidAuthToken < StandardError
95
-
96
56
  def initialize(message)
97
57
  super("Invalid auth token: '#{message}'")
98
58
  end
99
-
100
59
  end
101
60
 
102
61
  class ConfigFileNotFound < StandardError
103
-
104
62
  def initialize(message)
105
63
  super("The config file c2dm.yml not found from config/ directory or contains errors: '#{message}'")
106
64
  end
107
-
108
65
  end
109
66
 
110
67
  class ConfigFileMissingAttributes < StandardError
111
-
112
68
  def initialize(message)
113
69
  super("Config file doesn't contain username, password or app_name: '#{message}'")
114
70
  end
115
-
116
71
  end
117
72
 
118
73
  class ServiceUnavailable < StandardError
119
-
120
74
  def initialize(message)
121
75
  super("Service is currently unavailable. Try again later: '#{message}'")
122
76
  end
123
-
124
77
  end
125
78
  end # Errors
126
-
127
79
  end # APN
128
80
 
81
+ # rails_env = 'development'
82
+ # if defined?(RAILS_ENV)
83
+ # rails_env = RAILS_ENV
84
+ # end
85
+ #
86
+ # begin
87
+ # APP_CONFIG = YAML.load_file(File.join(::Rails.root.to_s, "config", "c2dm.yml"))[rails_env]
88
+ # rescue => ex
89
+ # raise C2dm::Errors::ConfigFileNotFound.new(ex.message)
90
+ # end
91
+ #
92
+ # begin
93
+ # configatron.c2dm.api_url = URI.parse('https://android.apis.google.com/c2dm/send')
94
+ # configatron.c2dm.username = APP_CONFIG['username']
95
+ # configatron.c2dm.password = APP_CONFIG['password']
96
+ # configatron.c2dm.app_name = APP_CONFIG['app_name']
97
+ # rescue => ex
98
+ # raise C2dm::Errors::ConfigFileMissingAttributes.new(ex.message)
99
+ # end
100
+
129
101
  Dir.glob(File.join(File.dirname(__FILE__), 'app', 'models', 'c2dm', '*.rb')).sort.each do |f|
130
102
  require f
131
103
  end
@@ -15,9 +15,11 @@ module C2dm
15
15
 
16
16
  data = data + "&delay_while_idle" if noty.delay_while_idle
17
17
 
18
- url = configatron.c2dm.api_url
18
+ url_string = configatron.c2dm.api_url
19
+ url=URI.parse url_string
19
20
  http = Net::HTTP.new(url.host, url.port)
20
21
  http.use_ssl = true
22
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
21
23
 
22
24
  resp, dat = http.post(url.path, data, headers)
23
25
 
@@ -0,0 +1,32 @@
1
+ require 'rails/generators/active_record'
2
+ # Generates the migrations necessary for C2dm on Rails.
3
+ # This should be run upon install and upgrade of the
4
+ # C2dm on Rails gem.
5
+ #
6
+ # $ ruby script/generate c2dm_migrations
7
+ class C2dmMigrationsGenerator < Rails::Generators::Base
8
+ include Rails::Generators::Migration
9
+ extend ActiveRecord::Generators::Migration
10
+
11
+ # Set the current directory as base for the inherited generators.
12
+ def self.base_root
13
+ File.dirname(__FILE__)
14
+ end
15
+
16
+ source_root File.expand_path('../templates/c2dm_migrations', __FILE__)
17
+
18
+ def create_migrations
19
+ templates = {
20
+ 'create_c2dm_devices.rb' => 'db/migrate/create_c2dm_devices.rb',
21
+ 'create_c2dm_notifications.rb' => 'db/migrate/create_c2dm_notifications.rb'
22
+ }
23
+
24
+ templates.each_pair do |name, path|
25
+ begin
26
+ migration_template(name, path)
27
+ rescue => err
28
+ puts "WARNING: #{err.message}"
29
+ end
30
+ end
31
+ end
32
+ end # C2dmMigrationsGenerator
metadata CHANGED
@@ -1,82 +1,70 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: c2dm_on_rails
3
- version: !ruby/object:Gem::Version
4
- hash: 11
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 8
10
- version: 0.1.8
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Julius de Bruijn
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-08-01 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: gdata
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
12
+ date: 2011-08-26 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: jeweler
16
+ requirement: &18227280 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 17
29
- segments:
30
- - 1
31
- - 1
32
- - 1
33
- version: 1.1.1
34
- type: :development
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *18227280
25
+ - !ruby/object:Gem::Dependency
37
26
  name: configatron
27
+ requirement: &18226540 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
38
34
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
35
+ version_requirements: *18226540
36
+ - !ruby/object:Gem::Dependency
37
+ name: gdata
38
+ requirement: &18274340 !ruby/object:Gem::Requirement
40
39
  none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- hash: 17
45
- segments:
46
- - 2
47
- - 6
48
- - 3
49
- version: 2.6.3
50
- type: :development
51
- version_requirements: *id002
52
- description: Android push notifications on Rails.
53
- email: julius.debruijn@digia.com
54
- executables: []
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *18274340
47
+ description: ! 'C2DM on Rails is a Ruby on Rails gem that allows you to
55
48
 
56
- extensions: []
49
+ easily add Android Cloud to Device Messaging support to your Rails application.
57
50
 
58
- extra_rdoc_files:
59
- - CHANGELOG
51
+ '
52
+ email: julius.bruijn@sponsorpay.com
53
+ executables: []
54
+ extensions: []
55
+ extra_rdoc_files:
60
56
  - LICENSE
61
57
  - README.textile
62
- - lib/c2dm_on_rails.rb
63
- - lib/c2dm_on_rails/app/models/c2dm/base.rb
64
- - lib/c2dm_on_rails/app/models/c2dm/device.rb
65
- - lib/c2dm_on_rails/app/models/c2dm/notification.rb
66
- - lib/c2dm_on_rails/c2dm_on_rails.rb
67
- - lib/c2dm_on_rails/libs/connection.rb
68
- - lib/c2dm_on_rails/tasks/c2dm.rake
69
- - lib/c2dm_on_rails_tasks.rb
70
- files:
58
+ files:
71
59
  - CHANGELOG
60
+ - Gemfile
61
+ - Gemfile.lock
72
62
  - LICENSE
73
63
  - Manifest
74
64
  - README.textile
75
65
  - Rakefile
66
+ - VERSION
76
67
  - c2dm_on_rails.gemspec
77
- - generators/c2dm_migrations_generator.rb
78
- - generators/templates/c2dm_migrations/001_create_c2dm_devices.rb
79
- - generators/templates/c2dm_migrations/002_create_c2dm_notifications.rb
80
68
  - lib/c2dm_on_rails.rb
81
69
  - lib/c2dm_on_rails/app/models/c2dm/base.rb
82
70
  - lib/c2dm_on_rails/app/models/c2dm/device.rb
@@ -85,44 +73,31 @@ files:
85
73
  - lib/c2dm_on_rails/libs/connection.rb
86
74
  - lib/c2dm_on_rails/tasks/c2dm.rake
87
75
  - lib/c2dm_on_rails_tasks.rb
76
+ - lib/generators/c2dm_migrations_generator.rb
77
+ - lib/generators/templates/c2dm_migrations/create_c2dm_devices.rb
78
+ - lib/generators/templates/c2dm_migrations/create_c2dm_notifications.rb
88
79
  homepage: http://github.com/pimeys/c2dm_on_rails
89
80
  licenses: []
90
-
91
81
  post_install_message:
92
- rdoc_options:
93
- - --line-numbers
94
- - --inline-source
95
- - --title
96
- - C2dm_on_rails
97
- - --main
98
- - README.textile
99
- require_paths:
82
+ rdoc_options: []
83
+ require_paths:
100
84
  - lib
101
- required_ruby_version: !ruby/object:Gem::Requirement
85
+ required_ruby_version: !ruby/object:Gem::Requirement
102
86
  none: false
103
- requirements:
104
- - - ">="
105
- - !ruby/object:Gem::Version
106
- hash: 3
107
- segments:
108
- - 0
109
- version: "0"
110
- required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ! '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
111
92
  none: false
112
- requirements:
113
- - - ">="
114
- - !ruby/object:Gem::Version
115
- hash: 11
116
- segments:
117
- - 1
118
- - 2
119
- version: "1.2"
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
120
97
  requirements: []
121
-
122
- rubyforge_project: c2dm_on_rails
123
- rubygems_version: 1.8.6
98
+ rubyforge_project:
99
+ rubygems_version: 1.8.11
124
100
  signing_key:
125
101
  specification_version: 3
126
- summary: Android push notifications on Rails.
102
+ summary: Android Cloud to Device Messaging (push notifications) on Rails
127
103
  test_files: []
128
-
@@ -1,31 +0,0 @@
1
- require 'rails_generator'
2
- # Generates the migrations necessary for C2dm on Rails.
3
- # This should be run upon install and upgrade of the
4
- # C2dm on Rails gem.
5
- #
6
- # $ ruby script/generate c2dm_migrations
7
- class C2dmMigrationsGenerator < Rails::Generator::Base
8
-
9
- def manifest # :nodoc:
10
- record do |m|
11
- timestamp = Time.now.utc.strftime("%Y%m%d%H%M%S")
12
- db_migrate_path = File.join('db', 'migrate')
13
-
14
- m.directory(db_migrate_path)
15
-
16
- Dir.glob(File.join(File.dirname(__FILE__), 'templates', 'c2dm_migrations', '*.rb')).sort.each_with_index do |f, i|
17
- f = File.basename(f)
18
- f.match(/\d+\_(.+)/)
19
- timestamp = timestamp.succ
20
- if Dir.glob(File.join(db_migrate_path, "*_#{$1}")).empty?
21
- m.file(File.join('c2dm_migrations', f),
22
- File.join(db_migrate_path, "#{timestamp}_#{$1}"),
23
- {:collision => :skip})
24
- end
25
- end
26
-
27
- end # record
28
-
29
- end # manifest
30
-
31
- end # C2dmMigrationsGenerator