agilib 0.1.0.beta5 → 0.1.1.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/Gemfile.lock +82 -4
- data/Rakefile +4 -2
- data/app/controllers/agilib/devices_controller.rb +47 -0
- data/app/controllers/agilib/tokens_controller.rb +2 -2
- data/app/models/agilib/device.rb +6 -0
- data/bin/agilib +5 -2
- data/lib/agilib/composer/command.rb +17 -0
- data/lib/agilib/composer/composer.rb +17 -0
- data/lib/agilib/composer/templater.rb +55 -0
- data/lib/agilib/composer/templates/core_ext.rb +13 -0
- data/lib/agilib/composer/templates/recipes/default.rb +6 -0
- data/lib/agilib/composer/templates/recipes/devise.rb +0 -0
- data/lib/agilib/composer/templates/recipes/gems.rb +1 -0
- data/lib/agilib/composer/templates/recipes/token.rb +13 -0
- data/lib/agilib/composer/templates/runner.rb +19 -0
- data/lib/agilib/push_notification/model.rb +54 -0
- data/lib/agilib/push_notification/platforms/android.rb +28 -0
- data/lib/agilib/push_notification/platforms/ios.rb +31 -0
- data/lib/agilib/push_notification/push_notification.rb +47 -0
- data/lib/agilib/push_notification/routing.rb +15 -0
- data/lib/agilib/token_authenticatable/routing.rb +18 -0
- data/lib/agilib/{token_authentication → token_authenticatable}/token_authentication.rb +27 -6
- data/lib/agilib/{token_authentication → token_authenticatable}/token_authentication_handler.rb +18 -13
- data/lib/agilib/version.rb +2 -2
- data/lib/agilib.rb +63 -13
- data/lib/generators/active_record/agilib_push_generator.rb +14 -0
- data/lib/generators/active_record/agilib_token_generator.rb +14 -0
- data/lib/generators/active_record/templates/push_notification.rb +12 -0
- data/lib/generators/active_record/templates/token_authenticatable.rb +14 -0
- data/lib/generators/agilib/install/install_generator.rb +19 -0
- data/lib/generators/agilib/install/templates/config/initializers/agilib.rb +99 -20
- data/lib/generators/agilib/push/push_generator.rb +38 -0
- data/lib/generators/agilib/token/token_generator.rb +44 -0
- data/spec/agilib-rails_spec.rb +7 -5
- metadata +83 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57737786b342df27be49ac4f15691588f91fd93f
|
4
|
+
data.tar.gz: 99fa573684f9cad8d861394bcfc2904aa8e8987b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d267207a82f9eba3584e1ed49b4ba9ceb3276d582e8f198e1d7a1ca91aec78397f63fec1788c45905e8dc7db460c849bf9535c57df075e64956c3e852503804
|
7
|
+
data.tar.gz: b3038934a6bfc453fb98d2b1cf7fc47e5ef2400b01f862f04234d0824b20dfebbcc0b251838c39ff6a29b62852a28ca70f0b7ee4c05c15e3853ba334b2b650b9
|
data/.DS_Store
CHANGED
Binary file
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,43 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
+
actionmailer (4.0.2)
|
5
|
+
actionpack (= 4.0.2)
|
6
|
+
mail (~> 2.5.4)
|
7
|
+
actionpack (4.0.2)
|
8
|
+
activesupport (= 4.0.2)
|
9
|
+
builder (~> 3.1.0)
|
10
|
+
erubis (~> 2.7.0)
|
11
|
+
rack (~> 1.5.2)
|
12
|
+
rack-test (~> 0.6.2)
|
13
|
+
activemodel (4.0.2)
|
14
|
+
activesupport (= 4.0.2)
|
15
|
+
builder (~> 3.1.0)
|
16
|
+
activerecord (4.0.2)
|
17
|
+
activemodel (= 4.0.2)
|
18
|
+
activerecord-deprecated_finders (~> 1.0.2)
|
19
|
+
activesupport (= 4.0.2)
|
20
|
+
arel (~> 4.0.0)
|
21
|
+
activerecord-deprecated_finders (1.0.3)
|
22
|
+
activesupport (4.0.2)
|
23
|
+
i18n (~> 0.6, >= 0.6.4)
|
24
|
+
minitest (~> 4.2)
|
25
|
+
multi_json (~> 1.3)
|
26
|
+
thread_safe (~> 0.1)
|
27
|
+
tzinfo (~> 0.3.37)
|
4
28
|
addressable (2.3.5)
|
5
|
-
|
29
|
+
apns (1.0.0)
|
30
|
+
arel (4.0.1)
|
31
|
+
atomic (1.1.14)
|
32
|
+
builder (3.1.4)
|
6
33
|
descendants_tracker (0.0.3)
|
7
34
|
diff-lcs (1.1.3)
|
8
|
-
|
35
|
+
erubis (2.7.0)
|
36
|
+
faraday (0.8.9)
|
9
37
|
multipart-post (~> 1.2.0)
|
38
|
+
gcm (0.0.5)
|
39
|
+
httparty
|
40
|
+
json
|
10
41
|
git (1.2.6)
|
11
42
|
github_api (0.11.1)
|
12
43
|
addressable (~> 2.3)
|
@@ -18,7 +49,12 @@ GEM
|
|
18
49
|
oauth2
|
19
50
|
hashie (2.0.5)
|
20
51
|
highline (1.6.20)
|
52
|
+
hike (1.2.3)
|
53
|
+
httparty (0.12.0)
|
54
|
+
json (~> 1.8)
|
55
|
+
multi_xml (>= 0.5.2)
|
21
56
|
httpauth (0.2.0)
|
57
|
+
i18n (0.6.9)
|
22
58
|
jeweler (2.0.0)
|
23
59
|
builder
|
24
60
|
bundler (>= 1.0)
|
@@ -29,10 +65,15 @@ GEM
|
|
29
65
|
rake
|
30
66
|
rdoc
|
31
67
|
json (1.8.1)
|
32
|
-
jwt (0.1.
|
68
|
+
jwt (0.1.10)
|
33
69
|
multi_json (>= 1.5)
|
70
|
+
mail (2.5.4)
|
71
|
+
mime-types (~> 1.16)
|
72
|
+
treetop (~> 1.4.8)
|
73
|
+
mime-types (1.25.1)
|
34
74
|
mini_portile (0.5.2)
|
35
|
-
|
75
|
+
minitest (4.7.5)
|
76
|
+
multi_json (1.8.4)
|
36
77
|
multi_xml (0.5.5)
|
37
78
|
multipart-post (1.2.0)
|
38
79
|
nokogiri (1.6.1)
|
@@ -44,7 +85,23 @@ GEM
|
|
44
85
|
multi_json (~> 1.0)
|
45
86
|
multi_xml (~> 0.5)
|
46
87
|
rack (~> 1.2)
|
88
|
+
polyglot (0.3.3)
|
47
89
|
rack (1.5.2)
|
90
|
+
rack-test (0.6.2)
|
91
|
+
rack (>= 1.0)
|
92
|
+
rails (4.0.2)
|
93
|
+
actionmailer (= 4.0.2)
|
94
|
+
actionpack (= 4.0.2)
|
95
|
+
activerecord (= 4.0.2)
|
96
|
+
activesupport (= 4.0.2)
|
97
|
+
bundler (>= 1.3.0, < 2.0)
|
98
|
+
railties (= 4.0.2)
|
99
|
+
sprockets-rails (~> 2.0.0)
|
100
|
+
railties (4.0.2)
|
101
|
+
actionpack (= 4.0.2)
|
102
|
+
activesupport (= 4.0.2)
|
103
|
+
rake (>= 0.8.7)
|
104
|
+
thor (>= 0.18.1, < 2.0)
|
48
105
|
rake (10.1.1)
|
49
106
|
rdoc (3.12.2)
|
50
107
|
json (~> 1.4)
|
@@ -56,14 +113,35 @@ GEM
|
|
56
113
|
rspec-expectations (2.8.0)
|
57
114
|
diff-lcs (~> 1.1.2)
|
58
115
|
rspec-mocks (2.8.0)
|
116
|
+
sprockets (2.10.1)
|
117
|
+
hike (~> 1.2)
|
118
|
+
multi_json (~> 1.0)
|
119
|
+
rack (~> 1.0)
|
120
|
+
tilt (~> 1.1, != 1.3.0)
|
121
|
+
sprockets-rails (2.0.1)
|
122
|
+
actionpack (>= 3.0)
|
123
|
+
activesupport (>= 3.0)
|
124
|
+
sprockets (~> 2.8)
|
125
|
+
thor (0.18.1)
|
126
|
+
thread_safe (0.1.3)
|
127
|
+
atomic
|
128
|
+
tilt (1.4.1)
|
129
|
+
treetop (1.4.15)
|
130
|
+
polyglot
|
131
|
+
polyglot (>= 0.3.1)
|
132
|
+
tzinfo (0.3.38)
|
59
133
|
yard (0.8.7.3)
|
60
134
|
|
61
135
|
PLATFORMS
|
62
136
|
ruby
|
63
137
|
|
64
138
|
DEPENDENCIES
|
139
|
+
apns (~> 1.0.0)
|
65
140
|
bundler (~> 1.0)
|
141
|
+
gcm
|
66
142
|
jeweler (~> 2.0.0)
|
143
|
+
rails (= 4.0.2)
|
67
144
|
rdoc (~> 3.12)
|
68
145
|
rspec (~> 2.8.0)
|
146
|
+
thor
|
69
147
|
yard (~> 0.7)
|
data/Rakefile
CHANGED
@@ -26,8 +26,10 @@ Jeweler::Tasks.new do |gem|
|
|
26
26
|
gem.files = `git ls-files`.split("\n") - %w[agilib.gemspec Gemfile]
|
27
27
|
# dependencies defined in Gemfile
|
28
28
|
|
29
|
-
gem.add_runtime_dependency 'rails'
|
30
|
-
gem.add_runtime_dependency 'devise'
|
29
|
+
# gem.add_runtime_dependency 'rails'
|
30
|
+
# gem.add_runtime_dependency 'devise'
|
31
|
+
# gem.add_runtime_dependency 'gcm'
|
32
|
+
# gem.add_runtime_dependency 'apns', "~> 1.0.0"
|
31
33
|
|
32
34
|
gem.executables = ['agilib']
|
33
35
|
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Agilib
|
2
|
+
class DevicesController < ApplicationController
|
3
|
+
before_filter :get_devices
|
4
|
+
|
5
|
+
def index
|
6
|
+
@devices = @get_devices.all
|
7
|
+
respond_with(@devices)
|
8
|
+
end
|
9
|
+
|
10
|
+
def show
|
11
|
+
@device = @get_devices.find(params[:id])
|
12
|
+
respond_with(@device)
|
13
|
+
end
|
14
|
+
|
15
|
+
def new
|
16
|
+
@device = @get_devices.build
|
17
|
+
respond_with(@device)
|
18
|
+
end
|
19
|
+
|
20
|
+
def edit
|
21
|
+
@device = @get_devices.find(params[:id])
|
22
|
+
respond_with(@device)
|
23
|
+
end
|
24
|
+
|
25
|
+
def create
|
26
|
+
@device = @get_devices.build(params[:device])
|
27
|
+
respond_with(@device)
|
28
|
+
end
|
29
|
+
|
30
|
+
def update
|
31
|
+
@device = @get_devices.find(params[:id])
|
32
|
+
respond_with(@device)
|
33
|
+
end
|
34
|
+
|
35
|
+
def destroy
|
36
|
+
@device = @get_devices.find(params[:id])
|
37
|
+
@device.destroy
|
38
|
+
respond_with(@device)
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
def get_devices
|
43
|
+
@get_devices = current_user.devices
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
@@ -4,8 +4,8 @@ module Agilib
|
|
4
4
|
respond_to :json
|
5
5
|
|
6
6
|
def create
|
7
|
-
login = params[Agilib.
|
8
|
-
password = params[Agilib.
|
7
|
+
login = params[Agilib::TokenAuthenticatable.login_params[:login]]
|
8
|
+
password = params[Agilib::TokenAuthenticatable.login_params[:password]]
|
9
9
|
|
10
10
|
if request.format != :json
|
11
11
|
render :status=>406, :json => { :message => "The request must be json" }
|
data/bin/agilib
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'agilib'
|
2
|
+
require 'thor'
|
3
|
+
|
4
|
+
module Agilib
|
5
|
+
module Composer
|
6
|
+
class Command < Thor
|
7
|
+
include Thor::Actions
|
8
|
+
|
9
|
+
desc "new APP_NAME", "create a new Rails app"
|
10
|
+
|
11
|
+
def new(name)
|
12
|
+
# Instala uma aplicação Rails
|
13
|
+
system("rails new #{name} --skip-bundle -d mysql -m #{Agilib::Composer.template_runner}")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'active_support/core_ext/string'
|
2
|
+
|
3
|
+
module Agilib
|
4
|
+
module Composer
|
5
|
+
extend self
|
6
|
+
|
7
|
+
class NotSupportedError < Exception; end
|
8
|
+
|
9
|
+
autoload :Command, File.join(File.dirname(__FILE__), 'command.rb')
|
10
|
+
autoload :Templater, File.join(File.dirname(__FILE__), 'templater.rb')
|
11
|
+
|
12
|
+
def template_runner
|
13
|
+
File.join(File.dirname(__FILE__), 'templates', 'runner.rb')
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Agilib
|
2
|
+
module Composer
|
3
|
+
class Templater
|
4
|
+
|
5
|
+
attr_reader :post_bundler_strategies
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@post_bundler_strategies = []
|
9
|
+
@template_framework_path = File.join(File.dirname(__FILE__), 'templates')
|
10
|
+
end
|
11
|
+
|
12
|
+
# def fixture_replacement
|
13
|
+
# @fixture_replacement ||= FixtureReplacement.new
|
14
|
+
# end
|
15
|
+
|
16
|
+
# def orm
|
17
|
+
# @orm ||= Orm.new
|
18
|
+
# end
|
19
|
+
|
20
|
+
# def javascript_framework
|
21
|
+
# @javascript_framework ||= JavaScriptFramework.new
|
22
|
+
# end
|
23
|
+
|
24
|
+
# def template_engine
|
25
|
+
# @template_engine ||= TemplateEngine.new
|
26
|
+
# end
|
27
|
+
|
28
|
+
def post_bundler(&block)
|
29
|
+
@post_bundler_strategies << block
|
30
|
+
end
|
31
|
+
|
32
|
+
def recipe(name)
|
33
|
+
File.expand_path("recipes/#{name}.rb", @template_framework_path)
|
34
|
+
end
|
35
|
+
|
36
|
+
# ['snippet', 'template'].each do |type|
|
37
|
+
|
38
|
+
# define_method "#{type}_path" do |group|
|
39
|
+
# File.expand_path("#{type}s/#{group}", @template_framework_path)
|
40
|
+
# end
|
41
|
+
|
42
|
+
# define_method "load_#{type}" do |name, group|
|
43
|
+
# group_path = send("#{type}_path".to_sym, group)
|
44
|
+
# File.read File.expand_path(name, group_path)
|
45
|
+
# end
|
46
|
+
|
47
|
+
# end
|
48
|
+
|
49
|
+
# def testing_framework
|
50
|
+
# @testing_framework ||= TestingFramework.new
|
51
|
+
# end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Rails
|
2
|
+
module Generators
|
3
|
+
module Actions
|
4
|
+
def templater
|
5
|
+
@templater ||= Agilib::Composer::Templater.new
|
6
|
+
end
|
7
|
+
|
8
|
+
def execute_post_bundler_strategies
|
9
|
+
templater.post_bundler_strategies.each {|strategy| strategy.call }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
gem 'agilib'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.expand_path('./../../', __FILE__))
|
2
|
+
# puts File.expand_path('./../../', __FILE__)
|
3
|
+
require 'composer'
|
4
|
+
require File.join(File.dirname(__FILE__), 'core_ext.rb')
|
5
|
+
|
6
|
+
%w(default gems token).each do |recipe|
|
7
|
+
apply templater.recipe(recipe)
|
8
|
+
end
|
9
|
+
|
10
|
+
say("\nInitial generation complete\n", Thor::Shell::Color::YELLOW)
|
11
|
+
|
12
|
+
say("\nBeginning bundle install\n", Thor::Shell::Color::YELLOW)
|
13
|
+
run 'bundle install'
|
14
|
+
say("\nbundle install complete\n", Thor::Shell::Color::YELLOW)
|
15
|
+
|
16
|
+
execute_post_bundler_strategies
|
17
|
+
|
18
|
+
# git :add => "."
|
19
|
+
# git :commit => "-m 'Initial commit'"
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'active_support/dependencies'
|
2
|
+
|
3
|
+
module Agilib
|
4
|
+
module PushNotification
|
5
|
+
module Model
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
def send_push_notification(message, data = {}, platforms = :all)
|
9
|
+
@platforms = Hash.new
|
10
|
+
@devices = self.devices.all
|
11
|
+
@responses = Hash.new
|
12
|
+
|
13
|
+
message = message[0,50]
|
14
|
+
|
15
|
+
unless platforms.is_a? Array
|
16
|
+
if platforms.to_sym == :all
|
17
|
+
@platforms = Agilib::PushNotification.avaiable_platforms
|
18
|
+
else
|
19
|
+
@platforms[platforms] = Agilib::PushNotification.avaiable_platforms[platforms]
|
20
|
+
end
|
21
|
+
else
|
22
|
+
platforms.each do |platform|
|
23
|
+
@platforms[platform] = Agilib::PushNotification.avaiable_platforms[platform] if Agilib::PushNotification.avaiable_platforms.has_key?(platform)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
@devices.each do |device|
|
28
|
+
if @platforms.has_key? device.platform.to_sym
|
29
|
+
platform = @platforms[device.platform.to_sym]
|
30
|
+
@responses[device.platform.to_sym] = platform.send_notification(message, data, device)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
return @responses
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
module ClassMethods
|
40
|
+
def agilib_push_notification(options = {})
|
41
|
+
if Agilib.use_modules[:push_notification].present?
|
42
|
+
include Agilib::PushNotification::Model
|
43
|
+
has_many :devices, :class_name => "Agilib::Device"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
if defined? ActiveRecord
|
53
|
+
ActiveRecord::Base.send :include, Agilib::PushNotification::Model
|
54
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'active_support/dependencies'
|
2
|
+
|
3
|
+
module Agilib
|
4
|
+
module PushNotification
|
5
|
+
module Platform
|
6
|
+
module Android
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
mattr_accessor :api_key
|
10
|
+
@@api_key = nil
|
11
|
+
|
12
|
+
def self.send_notification(message, data = {}, device = nil)
|
13
|
+
gcm = GCM.new(@@api_key)
|
14
|
+
|
15
|
+
registers = [device.register]
|
16
|
+
|
17
|
+
data[:description] = message unless data.has_key?(:description)
|
18
|
+
|
19
|
+
options = {data: data}
|
20
|
+
|
21
|
+
gcm.send_notification(registers, options)
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'active_support/dependencies'
|
2
|
+
|
3
|
+
module Agilib
|
4
|
+
module PushNotification
|
5
|
+
module Platform
|
6
|
+
module Ios
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
mattr_accessor :pem
|
10
|
+
@@pem = nil
|
11
|
+
|
12
|
+
mattr_accessor :port
|
13
|
+
@@port = 2195
|
14
|
+
|
15
|
+
def self.send_notification(message, data = {}, device = nil)
|
16
|
+
certificate = @@pem
|
17
|
+
APNS.pem = certificate
|
18
|
+
APNS.port = @@port
|
19
|
+
|
20
|
+
device_token = device.register
|
21
|
+
|
22
|
+
unless device_token.nil?
|
23
|
+
APNS.send_notification(device_token, :alert => message, :badge => 5, :sound => 'default', :other => data)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'active_support/dependencies'
|
2
|
+
require 'agilib/push_notification/platforms/ios'
|
3
|
+
require 'agilib/push_notification/platforms/android'
|
4
|
+
require 'agilib/push_notification/model'
|
5
|
+
require 'agilib/push_notification/routing'
|
6
|
+
|
7
|
+
module Agilib
|
8
|
+
module PushNotification
|
9
|
+
extend ActiveSupport::Concern
|
10
|
+
|
11
|
+
@@avaiable_platforms = {
|
12
|
+
:ios => Agilib::PushNotification::Platform::Ios,
|
13
|
+
:android => Agilib::PushNotification::Platform::Android
|
14
|
+
}
|
15
|
+
|
16
|
+
def self.avaiable_platforms
|
17
|
+
@@avaiable_platforms
|
18
|
+
end
|
19
|
+
|
20
|
+
mattr_accessor :device_route
|
21
|
+
@@device_route = "/devices"
|
22
|
+
|
23
|
+
mattr_accessor :use_platforms
|
24
|
+
@@use_platforms = Hash.new
|
25
|
+
|
26
|
+
def self.platform(name, options={}, &block)
|
27
|
+
@@use_platforms[name] = true
|
28
|
+
|
29
|
+
mod = @@avaiable_platforms[name]
|
30
|
+
|
31
|
+
options.each_with_index do |value, index|
|
32
|
+
mod.send("#{value[0]}=", [value[1]])
|
33
|
+
end
|
34
|
+
|
35
|
+
if block_given?
|
36
|
+
yield(mod)
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
if defined? ActiveRecord
|
46
|
+
ActiveRecord::Base.send :include, Agilib::PushNotification
|
47
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Agilib
|
2
|
+
module Routing
|
3
|
+
module MapperExtensions
|
4
|
+
def agilib_push_notification
|
5
|
+
if Agilib.use_modules[:push_notification].present?
|
6
|
+
path = Agilib::PushNotification.device_route
|
7
|
+
resources :devices, :path => path, :controller => "agilib/devices"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
if defined? ActionDispatch
|
14
|
+
ActionDispatch::Routing::Mapper.send :include, Agilib::Routing::MapperExtensions
|
15
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Agilib
|
2
|
+
module Routing
|
3
|
+
module MapperExtensions
|
4
|
+
def agilib_token_authenticatable
|
5
|
+
if Agilib.use_modules[:token_authenticatable].present?
|
6
|
+
route = Agilib::TokenAuthenticatable.route
|
7
|
+
devise_scope :user do
|
8
|
+
post "#{route}" => "agilib/tokens#create"
|
9
|
+
delete "#{route}/:token" => "agilib/tokens#destroy"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
if defined? ActionDispatch
|
17
|
+
ActionDispatch::Routing::Mapper.send :include, Agilib::Routing::MapperExtensions
|
18
|
+
end
|
@@ -1,9 +1,29 @@
|
|
1
|
+
require 'active_support/dependencies'
|
2
|
+
require 'agilib/token_authenticatable/routing'
|
3
|
+
require 'agilib/token_authenticatable/token_authentication_handler'
|
4
|
+
|
5
|
+
|
1
6
|
module Agilib
|
2
7
|
module TokenAuthenticatable
|
3
8
|
extend ActiveSupport::Concern
|
4
9
|
|
5
|
-
|
6
|
-
|
10
|
+
mattr_accessor :secure_token
|
11
|
+
@@secure_token = true
|
12
|
+
|
13
|
+
mattr_accessor :auth_params
|
14
|
+
@@auth_params = {
|
15
|
+
:user_token => :user_token,
|
16
|
+
:user_email => :user_email
|
17
|
+
}
|
18
|
+
|
19
|
+
mattr_accessor :login_params
|
20
|
+
@@login_params = {
|
21
|
+
:login => :email,
|
22
|
+
:password => :password
|
23
|
+
}
|
24
|
+
|
25
|
+
mattr_accessor :route
|
26
|
+
@@route = "/tokens"
|
7
27
|
|
8
28
|
included do
|
9
29
|
private :generate_authentication_token
|
@@ -24,9 +44,7 @@ module Agilib
|
|
24
44
|
|
25
45
|
module ClassMethods
|
26
46
|
def agilib_token_authenticatable(options = {})
|
27
|
-
|
28
|
-
puts "Para usar a autenticacao por token, precisa ativar na configuracao: use_token_authentication = true"
|
29
|
-
else
|
47
|
+
if Agilib.use_modules[:token_authenticatable].present?
|
30
48
|
include Agilib::TokenAuthenticatable
|
31
49
|
before_save :ensure_authentication_token
|
32
50
|
end
|
@@ -34,4 +52,7 @@ module Agilib
|
|
34
52
|
end
|
35
53
|
end
|
36
54
|
end
|
37
|
-
|
55
|
+
|
56
|
+
if defined? ActiveRecord
|
57
|
+
ActiveRecord::Base.send :include, Agilib::TokenAuthenticatable
|
58
|
+
end
|
data/lib/agilib/{token_authentication → token_authenticatable}/token_authentication_handler.rb
RENAMED
@@ -17,16 +17,19 @@ module Agilib
|
|
17
17
|
# via parameters. However, anyone could use Rails's token
|
18
18
|
# authentication features to get the token from a header.
|
19
19
|
def authenticate_user_from_token!
|
20
|
+
param_user_token = params[Agilib::TokenAuthenticatable.auth_params[:user_token]]
|
21
|
+
param_email_token = params[Agilib::TokenAuthenticatable.auth_params[:user_email]]
|
22
|
+
|
20
23
|
# Set the authentication token params if not already present,
|
21
24
|
# see http://stackoverflow.com/questions/11017348/rails-api-authentication-by-headers-token
|
22
|
-
if user_token =
|
23
|
-
|
25
|
+
if user_token = param_user_token.blank? && request.headers["X-User-Token"]
|
26
|
+
param_user_token = user_token
|
24
27
|
end
|
25
|
-
if user_email = params[Agilib.
|
26
|
-
|
28
|
+
if user_email = params[Agilib::TokenAuthenticatable.auth_params[:user_email]].blank? && request.headers["X-User-Email"]
|
29
|
+
param_email_token = user_email
|
27
30
|
end
|
28
31
|
|
29
|
-
user_email =
|
32
|
+
user_email = param_email_token.presence
|
30
33
|
# See https://github.com/ryanb/cancan/blob/1.6.10/lib/cancan/controller_resource.rb#L108-L111
|
31
34
|
if User.respond_to? "find_by"
|
32
35
|
user = user_email && User.find_by(email: user_email)
|
@@ -37,7 +40,7 @@ module Agilib
|
|
37
40
|
# Notice how we use Devise.secure_compare to compare the token
|
38
41
|
# in the database with the token given in the params, mitigating
|
39
42
|
# timing attacks.
|
40
|
-
if user && Devise.secure_compare(user.authentication_token,
|
43
|
+
if user && Devise.secure_compare(user.authentication_token, param_user_token)
|
41
44
|
# Notice we are passing store false, so the user is not
|
42
45
|
# actually stored in the session and a token is needed
|
43
46
|
# for every request. If you want the token to work as a
|
@@ -51,22 +54,24 @@ module Agilib
|
|
51
54
|
extend ActiveSupport::Concern
|
52
55
|
|
53
56
|
# I have insulated the methods into an additional module to avoid before_filters
|
54
|
-
# to be applied by the `included` block before
|
55
|
-
# See https://github.com/gonzalo-bulnes/
|
57
|
+
# to be applied by the `included` block before acts_as_token_authenticatable_handler was called.
|
58
|
+
# See https://github.com/gonzalo-bulnes/simple_token_authenticatable/issues/8#issuecomment-31707201
|
56
59
|
|
57
60
|
included do
|
58
61
|
# nop
|
59
62
|
end
|
60
63
|
|
61
64
|
module ClassMethods
|
62
|
-
def
|
63
|
-
include Agilib::TokenAuthenticationHandlerMethods if Agilib.
|
65
|
+
def agilib_token_authenticatable(options = {})
|
66
|
+
include Agilib::TokenAuthenticationHandlerMethods if Agilib.use_modules[:token_authenticatable].present?
|
64
67
|
|
65
|
-
unless Agilib.
|
66
|
-
puts "Para usar a autenticacao por token, precisa ativar na configuracao:
|
68
|
+
unless Agilib.use_modules[:token_authenticatable].present?
|
69
|
+
# puts "Para usar a autenticacao por token, precisa ativar na configuracao: use_token_authenticatable = true"
|
67
70
|
end
|
68
71
|
end
|
69
72
|
end
|
70
73
|
end
|
71
74
|
end
|
72
|
-
ActionController::Base
|
75
|
+
if defined? ActionController::Base
|
76
|
+
ActionController::Base.send :include, Agilib::TokenAuthenticationHandler
|
77
|
+
end
|
data/lib/agilib/version.rb
CHANGED
data/lib/agilib.rb
CHANGED
@@ -5,24 +5,72 @@ require 'securerandom'
|
|
5
5
|
|
6
6
|
module Agilib
|
7
7
|
|
8
|
+
autoload :Composer, 'agilib/composer/composer'
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
# Acessor onde é guardado os módulos que estão habilitados.
|
11
|
+
#
|
12
|
+
# @return [Hash] Hash com os módulos habilitados
|
13
|
+
mattr_accessor :use_modules
|
14
|
+
@@use_modules = Hash.new
|
15
|
+
|
16
|
+
|
17
|
+
# Define os módulos que serão utilizados pela gem.
|
18
|
+
# Através deste método é possível habilitar o módulo e também definir suas configurações
|
19
|
+
# Para habilitar um módulo, é necessário apenas passar um symbol de sua representação.
|
20
|
+
# @example Configuração simples
|
21
|
+
# Agilib.setup do |config|
|
22
|
+
# config.use :token_authenticatable
|
23
|
+
# config.use :push_notification
|
24
|
+
# end
|
25
|
+
#
|
26
|
+
# Existem duas formas de setar as configurações de cada módulo através do método use.
|
27
|
+
#
|
28
|
+
# @example Configuração por parâmetro
|
29
|
+
# config.use :token_authenticatable, :route => "/tokens"
|
30
|
+
#
|
31
|
+
# @example Configuração por Bloco
|
32
|
+
# config.use :token_authenticatable do |options|
|
33
|
+
# options.route = "/tokens"
|
34
|
+
# end
|
35
|
+
#
|
36
|
+
# @param name [Symbol] Identificação do Módulo (Token Authenticatable => :token_authenticatable)
|
37
|
+
# @param options [Hash] Optional - Configurações do Módulo
|
38
|
+
# @param block [Proc,Lambda] Optional - Bloco com configurações do Módulo
|
39
|
+
#
|
40
|
+
# @return nil
|
41
|
+
def self.use(name, options={}, &block)
|
42
|
+
mod = "Agilib::#{name.to_s.classify}".constantize
|
43
|
+
|
44
|
+
@@use_modules[name] = true
|
15
45
|
|
16
|
-
|
17
|
-
|
46
|
+
options.each_with_index do |value, index|
|
47
|
+
mod.send("#{value[0]}=", [value[1]])
|
48
|
+
end
|
18
49
|
|
19
|
-
|
20
|
-
|
50
|
+
if block_given?
|
51
|
+
yield(mod)
|
52
|
+
end
|
21
53
|
|
54
|
+
end
|
55
|
+
|
56
|
+
# Método para identificar se a versão do rails utilizado no projeto é a versão 4
|
57
|
+
#
|
58
|
+
# @return [Boolean] True ou False se a versão do Rails for 4
|
22
59
|
def self.rails4?
|
23
|
-
::Rails::VERSION::
|
60
|
+
::Rails::VERSION::MAJOR == 4
|
24
61
|
end
|
25
62
|
|
63
|
+
# Método de configuração da Agilib
|
64
|
+
# Passando um bloco, você recebe uma instância do módulo para realizar configurações ou personalizações,
|
65
|
+
# desde habilitar ou desabilitar um módulo e também configura-lo.
|
66
|
+
#
|
67
|
+
# @example Configuração da Agilib
|
68
|
+
# Agilib.setup do |config|
|
69
|
+
# config.use :token_authentication
|
70
|
+
# end
|
71
|
+
#
|
72
|
+
# @param block [Proc, Lambda] - Bloco que receberá a instância para ser configurada.
|
73
|
+
# @return [Agilib]
|
26
74
|
def self.setup
|
27
75
|
yield self
|
28
76
|
end
|
@@ -31,5 +79,7 @@ end
|
|
31
79
|
|
32
80
|
require 'agilib/version'
|
33
81
|
require 'agilib/engine'
|
34
|
-
|
35
|
-
require 'agilib/token_authentication
|
82
|
+
|
83
|
+
require 'agilib/token_authenticatable/token_authentication'
|
84
|
+
require 'agilib/push_notification/push_notification'
|
85
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rails/generators/active_record'
|
2
|
+
|
3
|
+
module ActiveRecord
|
4
|
+
module Generators
|
5
|
+
class AgilibPushGenerator < ActiveRecord::Generators::Base
|
6
|
+
source_root File.expand_path("../templates", __FILE__)
|
7
|
+
def copy_agilib_migration
|
8
|
+
if (behavior == :invoke)
|
9
|
+
migration_template "push_notification.rb", "db/migrate/create_agilib_push_notification"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rails/generators/active_record'
|
2
|
+
|
3
|
+
module ActiveRecord
|
4
|
+
module Generators
|
5
|
+
class AgilibTokenGenerator < ActiveRecord::Generators::Base
|
6
|
+
source_root File.expand_path("../templates", __FILE__)
|
7
|
+
def copy_agilib_migration
|
8
|
+
if (behavior == :invoke)
|
9
|
+
migration_template "token_authenticatable.rb", "db/migrate/add_agilib_token_authenticatable_to_users"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class AddAgilibTokenAuthenticatableToUsers < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
|
4
|
+
change_table(:users) do |t|
|
5
|
+
t.string :authentication_token
|
6
|
+
end
|
7
|
+
|
8
|
+
add_index :users, :authentication_token, :unique => true
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.down
|
12
|
+
raise ActiveRecord::IrreversibleMigration
|
13
|
+
end
|
14
|
+
end
|
@@ -3,10 +3,29 @@ module Agilib
|
|
3
3
|
module Generators
|
4
4
|
class InstallGenerator < ::Rails::Generators::Base
|
5
5
|
desc "Instalação da Agilib"
|
6
|
+
|
7
|
+
class_option :token, type: :boolean, desc: 'Prepara o projeto para Autenticação por Token'
|
8
|
+
class_option :push, type: :boolean, desc: 'Prepara o projeto para Notificação por Push'
|
9
|
+
class_option :"skip-migration", type: :boolean, desc: 'Caso não queira que seja criado o arquivo de migração para o token'
|
10
|
+
|
6
11
|
source_root File.expand_path('../templates', __FILE__)
|
12
|
+
|
13
|
+
def config_token
|
14
|
+
if options[:token]
|
15
|
+
invoke "agilib:token", ["Token"], options
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def config_push
|
20
|
+
if options[:push]
|
21
|
+
invoke "agilib:push", ["Push"], options
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
7
25
|
def copy_config
|
8
26
|
template "config/initializers/agilib.rb"
|
9
27
|
end
|
28
|
+
|
10
29
|
end
|
11
30
|
end
|
12
31
|
end
|
@@ -2,35 +2,114 @@ Agilib.setup do |config|
|
|
2
2
|
|
3
3
|
|
4
4
|
# Define se a aplicação vai usar autenticação por token
|
5
|
-
# Caso esteja habilitado, será preciso
|
6
|
-
#
|
5
|
+
# Caso esteja habilitado, será preciso adicionar o helper da agilib para que sejam criadas
|
6
|
+
# as rotas para o Agilib::TokensController
|
7
7
|
#
|
8
8
|
# Exemplo:
|
9
9
|
#
|
10
10
|
# config/routes.rb
|
11
11
|
#
|
12
|
-
#
|
13
|
-
# post "tokens" => "agilib/tokens#create"
|
14
|
-
# delete "tokens/:token" => "agilib/tokens#destroy"
|
15
|
-
# end
|
12
|
+
# agilib_token_authenticatable
|
16
13
|
#
|
17
14
|
# Este procedimento é necessário para que a rota /tokens.json esteja disponível
|
18
|
-
config.
|
15
|
+
config.use :token_authenticatable do |options|
|
19
16
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
17
|
+
# ===============================================================================
|
18
|
+
# Define se deja utilizar a forma mais segura de trabalhar com Tokens
|
19
|
+
# Habilitando eo secure_token, torna-se obrigatório enviar junto ao token o email
|
20
|
+
# do Usuário e com isso será feita uma dupla checagem
|
21
|
+
#
|
22
|
+
# Default: true
|
23
|
+
options.secure_token = true
|
24
|
+
|
25
|
+
# ===============================================================================
|
26
|
+
# Define qual será a rota para solicitação/remoção do token
|
27
|
+
#
|
28
|
+
# Exemplo: /tokens.json
|
29
|
+
# Se alterar para: options.route = "token_login"
|
30
|
+
# A rota será: /token_login.json
|
31
|
+
#
|
32
|
+
#
|
33
|
+
# Default: "/tokens"
|
34
|
+
options.route = "/tokens"
|
35
|
+
|
36
|
+
# ===============================================================================
|
37
|
+
# Define em quais parâmetros serão passados o token e o email do usuário
|
38
|
+
#
|
39
|
+
# Exemplo:
|
40
|
+
#
|
41
|
+
# /posts.json?user_token=AhAuHEAUheAU&user_email=agivis@agivis.com.br
|
42
|
+
#
|
43
|
+
# Default: {:user_token => :user_token, :user_email => :user_email}
|
44
|
+
#
|
45
|
+
options.auth_params = {:user_token => :user_token, :user_email => :user_email}
|
46
|
+
|
47
|
+
# ===============================================================================
|
48
|
+
# Define quais parâmetros serão passados para solicitar o token
|
49
|
+
#
|
50
|
+
# Exemplo:
|
51
|
+
#
|
52
|
+
# /tokens.json?email=agivis@agivis.com.br&password=12345
|
53
|
+
#
|
54
|
+
# Default: {:login => :email, :password => :password}
|
55
|
+
#
|
56
|
+
options.login_params = {:login => :email, :password => :password}
|
27
57
|
|
28
|
-
|
29
|
-
|
58
|
+
end
|
59
|
+
|
60
|
+
# Define se a aplicação vai usar notificação por push
|
61
|
+
# Caso esteja habilitado, será preciso adicionar o helper da agilib para que sejam criadas
|
62
|
+
# as rotas para o Agilib::DevicesController
|
63
|
+
#
|
30
64
|
# Exemplo:
|
31
|
-
#
|
32
|
-
#
|
33
|
-
#
|
34
|
-
|
65
|
+
#
|
66
|
+
# config/routes.rb
|
67
|
+
#
|
68
|
+
# agilib_push_notification
|
69
|
+
#
|
70
|
+
# Este procedimento é necessário para que a rota /devices.json esteja disponível
|
71
|
+
config.use :push_notification do |options|
|
72
|
+
|
73
|
+
# ===============================================================================
|
74
|
+
# Define qual será a rota para cadastrar/alterar/apagar os Devices
|
75
|
+
#
|
76
|
+
# Exemplo: /devices.json
|
77
|
+
# Se alterar para: options.device_route = "/celulares"
|
78
|
+
# A rota será: /celulares.json
|
79
|
+
#
|
80
|
+
#
|
81
|
+
# Default: "/devices"
|
82
|
+
options.device_route = "/devices"
|
83
|
+
|
84
|
+
# ===============================================================================
|
85
|
+
# Habilita o envio de notificação por push para dispositivos IOS
|
86
|
+
#
|
87
|
+
options.platform :ios do |ios|
|
88
|
+
|
89
|
+
# =========================================
|
90
|
+
# Caminho do arquivo de certificado .pem
|
91
|
+
#
|
92
|
+
ios.pem = ""
|
93
|
+
|
94
|
+
# =========================================
|
95
|
+
# Porta de conexão com o servidor da Apple
|
96
|
+
#
|
97
|
+
ios.port = 2195
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
# ===============================================================================
|
102
|
+
# Habilita o envio de notificação por push para dispositivos ANDROID
|
103
|
+
#
|
104
|
+
options.platform :android do |android|
|
105
|
+
|
106
|
+
# =========================================
|
107
|
+
# Chave API do Google
|
108
|
+
#
|
109
|
+
android.api_key = "Insert here you api key"
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
35
114
|
|
36
115
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module Agilib
|
3
|
+
module Generators
|
4
|
+
class PushGenerator < ::Rails::Generators::Base
|
5
|
+
desc "Instalação do módulo Token Authenticatable da Agilib"
|
6
|
+
class_option :"skip-migration", type: :boolean, desc: 'Caso não queira que seja criado o arquivo de migração'
|
7
|
+
|
8
|
+
source_root File.expand_path('../templates', __FILE__)
|
9
|
+
|
10
|
+
# Se o arquivo de configuração não foi criado
|
11
|
+
# Então chama o generator de instalação da gem
|
12
|
+
def verify_configuratino_file
|
13
|
+
unless File.exists?(File.join("config/initializers/agilib.rb"))
|
14
|
+
invoke "agilib:install", ["Agilib"]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def add_route
|
19
|
+
route("agilib_push_notification")
|
20
|
+
end
|
21
|
+
|
22
|
+
def update_model
|
23
|
+
inject_into_class "app/models/user.rb", "User", <<-RUBY
|
24
|
+
agilib_push_notification
|
25
|
+
|
26
|
+
RUBY
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
def copy_push_migration
|
31
|
+
if !options[:"skip-migration"]
|
32
|
+
invoke "active_record:agilib_push", ["Agilib"]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module Agilib
|
3
|
+
module Generators
|
4
|
+
class TokenGenerator < ::Rails::Generators::Base
|
5
|
+
desc "Instalação do módulo Token Authenticatable da Agilib"
|
6
|
+
class_option :"skip-migration", type: :boolean, desc: 'Caso não queira que seja criado o arquivo de migração'
|
7
|
+
|
8
|
+
source_root File.expand_path('../templates', __FILE__)
|
9
|
+
|
10
|
+
# Se o arquivo de configuração não foi criado
|
11
|
+
# Então chama o generator de instalação da gem
|
12
|
+
def verify_configuratino_file
|
13
|
+
unless File.exists?(File.join("config/initializers/agilib.rb"))
|
14
|
+
invoke "agilib:install", ["Agilib"]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def add_route
|
19
|
+
route("agilib_token_authenticatable")
|
20
|
+
end
|
21
|
+
|
22
|
+
def update_application_controller_and_model
|
23
|
+
inject_into_class "app/controllers/application_controller.rb", "ApplicationController", <<-RUBY
|
24
|
+
agilib_token_authenticatable
|
25
|
+
|
26
|
+
RUBY
|
27
|
+
|
28
|
+
if File.exists?(File.join("app/models/user.rb"))
|
29
|
+
inject_into_class "app/models/user.rb", "User", <<-RUBY
|
30
|
+
agilib_token_authenticatable
|
31
|
+
|
32
|
+
RUBY
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def copy_token_migration
|
37
|
+
if !options[:"skip-migration"]
|
38
|
+
invoke "active_record:agilib_token", ["Agilib"]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/spec/agilib-rails_spec.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
2
|
|
3
3
|
describe "AgilibRails" do
|
4
|
-
# it "fails" do
|
5
|
-
# fail "hey buddy, you should probably rename this file and start specing for real"
|
6
|
-
# end
|
7
|
-
|
8
4
|
it "test agilib" do
|
9
|
-
|
5
|
+
|
6
|
+
puts Agilib::Composer.template_runner
|
7
|
+
|
10
8
|
end
|
9
|
+
|
10
|
+
it "is rails 4" do
|
11
|
+
puts Agilib.rails4?
|
12
|
+
end
|
11
13
|
end
|
metadata
CHANGED
@@ -1,15 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: agilib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcos Junior
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.0.2
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.0.2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: thor
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: gcm
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: apns
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.0.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.0.0
|
13
69
|
- !ruby/object:Gem::Dependency
|
14
70
|
name: rspec
|
15
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,34 +136,6 @@ dependencies:
|
|
80
136
|
- - "~>"
|
81
137
|
- !ruby/object:Gem::Version
|
82
138
|
version: 2.0.0
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rails
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: devise
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :runtime
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
139
|
description: agilib description
|
112
140
|
email: marcos.junior@agivis.com.br
|
113
141
|
executables:
|
@@ -129,21 +157,44 @@ files:
|
|
129
157
|
- Rakefile
|
130
158
|
- app/.DS_Store
|
131
159
|
- app/controllers/.DS_Store
|
160
|
+
- app/controllers/agilib/devices_controller.rb
|
132
161
|
- app/controllers/agilib/tokens_controller.rb
|
162
|
+
- app/models/agilib/device.rb
|
133
163
|
- bin/agilib
|
134
164
|
- lib/.DS_Store
|
135
165
|
- lib/agilib.rb
|
136
166
|
- lib/agilib/cli.rb
|
167
|
+
- lib/agilib/composer/command.rb
|
168
|
+
- lib/agilib/composer/composer.rb
|
169
|
+
- lib/agilib/composer/templater.rb
|
170
|
+
- lib/agilib/composer/templates/core_ext.rb
|
171
|
+
- lib/agilib/composer/templates/recipes/default.rb
|
172
|
+
- lib/agilib/composer/templates/recipes/devise.rb
|
173
|
+
- lib/agilib/composer/templates/recipes/gems.rb
|
174
|
+
- lib/agilib/composer/templates/recipes/token.rb
|
175
|
+
- lib/agilib/composer/templates/runner.rb
|
137
176
|
- lib/agilib/engine.rb
|
138
|
-
- lib/agilib/
|
139
|
-
- lib/agilib/
|
177
|
+
- lib/agilib/push_notification/model.rb
|
178
|
+
- lib/agilib/push_notification/platforms/android.rb
|
179
|
+
- lib/agilib/push_notification/platforms/ios.rb
|
180
|
+
- lib/agilib/push_notification/push_notification.rb
|
181
|
+
- lib/agilib/push_notification/routing.rb
|
182
|
+
- lib/agilib/token_authenticatable/routing.rb
|
183
|
+
- lib/agilib/token_authenticatable/token_authentication.rb
|
184
|
+
- lib/agilib/token_authenticatable/token_authentication_handler.rb
|
140
185
|
- lib/agilib/version.rb
|
141
186
|
- lib/generators/.DS_Store
|
187
|
+
- lib/generators/active_record/agilib_push_generator.rb
|
188
|
+
- lib/generators/active_record/agilib_token_generator.rb
|
189
|
+
- lib/generators/active_record/templates/push_notification.rb
|
190
|
+
- lib/generators/active_record/templates/token_authenticatable.rb
|
142
191
|
- lib/generators/agilib/.DS_Store
|
143
192
|
- lib/generators/agilib/install/.DS_Store
|
144
193
|
- lib/generators/agilib/install/install_generator.rb
|
145
194
|
- lib/generators/agilib/install/templates/.DS_Store
|
146
195
|
- lib/generators/agilib/install/templates/config/initializers/agilib.rb
|
196
|
+
- lib/generators/agilib/push/push_generator.rb
|
197
|
+
- lib/generators/agilib/token/token_generator.rb
|
147
198
|
- spec/agilib-rails_spec.rb
|
148
199
|
- spec/spec_helper.rb
|
149
200
|
homepage: http://github.com/marcosgugs/agilib
|