platform 3.1.3 → 3.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +1 -1
- data/Gemfile.lock +100 -103
- data/app/models/platform/application.rb +109 -57
- data/app/models/platform/application_category.rb +41 -22
- data/app/models/platform/application_developer.rb +39 -22
- data/app/models/platform/application_filter.rb +41 -22
- data/app/models/platform/application_log.rb +48 -22
- data/app/models/platform/application_log_filter.rb +41 -22
- data/app/models/platform/application_metric.rb +42 -23
- data/app/models/platform/application_metric_filter.rb +41 -22
- data/app/models/platform/application_permission.rb +38 -22
- data/app/models/platform/application_permission_filter.rb +41 -22
- data/app/models/platform/application_usage_metric.rb +43 -22
- data/app/models/platform/application_usage_metric_filter.rb +41 -22
- data/app/models/platform/application_user.rb +40 -22
- data/app/models/platform/application_user_filter.rb +41 -22
- data/app/models/platform/base_filter.rb +41 -22
- data/app/models/platform/category.rb +43 -22
- data/app/models/platform/daily_application_metric.rb +41 -22
- data/app/models/platform/developer.rb +42 -22
- data/app/models/platform/developer_filter.rb +41 -22
- data/app/models/platform/forum_message.rb +40 -22
- data/app/models/platform/forum_message_filter.rb +41 -22
- data/app/models/platform/forum_topic.rb +41 -22
- data/app/models/platform/forum_topic_filter.rb +41 -22
- data/app/models/platform/logged_exception.rb +47 -22
- data/app/models/platform/logged_exception_filter.rb +41 -22
- data/app/models/platform/monthly_application_metric.rb +41 -22
- data/app/models/platform/permission.rb +38 -22
- data/app/models/platform/rating.rb +42 -22
- data/app/models/platform/rating_filter.rb +41 -22
- data/app/models/platform/rollup_log.rb +39 -22
- data/app/models/platform/rollup_log_filter.rb +41 -22
- data/app/models/platform/total_application_metric.rb +41 -22
- data/app/models/platform/weekly_application_metric.rb +41 -22
- data/app/views/platform/developer/api_explorer/index.html.erb +4 -4
- data/app/views/platform/developer/apps/index.html.erb +5 -2
- data/lib/platform/config.rb +4 -0
- data/lib/platform/version.rb +1 -1
- data/lib/tasks/dev.rake +154 -0
- data/platform.gemspec +5 -6
- data/test/dummy/config/application.rb +2 -2
- metadata +46 -60
data/.rvmrc
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
rvm 1.9.2@platform --create
|
1
|
+
rvm use 1.9.2@platform --create
|
2
2
|
#rvm gemset import | grep -v -E 'already installed|default\.gems|^$'
|
data/Gemfile.lock
CHANGED
@@ -1,159 +1,156 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
platform (3.1.
|
5
|
-
|
6
|
-
|
7
|
-
coffee-script
|
4
|
+
platform (3.1.4)
|
5
|
+
aasm
|
6
|
+
acts_as_tree_rails3
|
8
7
|
kaminari
|
9
|
-
rails (>= 3.
|
8
|
+
rails (>= 3.2.3)
|
10
9
|
sass
|
11
|
-
tr8n (>= 3.
|
12
|
-
will_filter (>= 3.1.
|
10
|
+
tr8n (>= 3.2.3)
|
11
|
+
will_filter (>= 3.1.6)
|
13
12
|
|
14
13
|
GEM
|
15
14
|
remote: http://rubygems.org/
|
16
15
|
specs:
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
16
|
+
aasm (3.0.4)
|
17
|
+
activerecord
|
18
|
+
actionmailer (3.2.3)
|
19
|
+
actionpack (= 3.2.3)
|
20
|
+
mail (~> 2.4.4)
|
21
|
+
actionpack (3.2.3)
|
22
|
+
activemodel (= 3.2.3)
|
23
|
+
activesupport (= 3.2.3)
|
23
24
|
builder (~> 3.0.0)
|
24
25
|
erubis (~> 2.7.0)
|
25
|
-
|
26
|
-
rack (~> 1.
|
27
|
-
rack-cache (~> 1.
|
28
|
-
rack-mount (~> 0.8.2)
|
26
|
+
journey (~> 1.0.1)
|
27
|
+
rack (~> 1.4.0)
|
28
|
+
rack-cache (~> 1.2)
|
29
29
|
rack-test (~> 0.6.1)
|
30
|
-
sprockets (~> 2.
|
31
|
-
activemodel (3.
|
32
|
-
activesupport (= 3.
|
33
|
-
bcrypt-ruby (~> 3.0.0)
|
30
|
+
sprockets (~> 2.1.2)
|
31
|
+
activemodel (3.2.3)
|
32
|
+
activesupport (= 3.2.3)
|
34
33
|
builder (~> 3.0.0)
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
arel (~> 2.2.1)
|
34
|
+
activerecord (3.2.3)
|
35
|
+
activemodel (= 3.2.3)
|
36
|
+
activesupport (= 3.2.3)
|
37
|
+
arel (~> 3.0.2)
|
40
38
|
tzinfo (~> 0.3.29)
|
41
|
-
activeresource (3.
|
42
|
-
activemodel (= 3.
|
43
|
-
activesupport (= 3.
|
44
|
-
activesupport (3.
|
39
|
+
activeresource (3.2.3)
|
40
|
+
activemodel (= 3.2.3)
|
41
|
+
activesupport (= 3.2.3)
|
42
|
+
activesupport (3.2.3)
|
43
|
+
i18n (~> 0.6)
|
45
44
|
multi_json (~> 1.0)
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
arel (2.2.1)
|
50
|
-
bcrypt-ruby (3.0.1)
|
45
|
+
acts_as_tree_rails3 (0.1.0)
|
46
|
+
addressable (2.2.7)
|
47
|
+
arel (3.0.2)
|
51
48
|
builder (3.0.0)
|
52
|
-
capybara (1.1.
|
49
|
+
capybara (1.1.2)
|
53
50
|
mime-types (>= 1.16)
|
54
51
|
nokogiri (>= 1.3.3)
|
55
52
|
rack (>= 1.0.0)
|
56
53
|
rack-test (>= 0.5.4)
|
57
54
|
selenium-webdriver (~> 2.0)
|
58
55
|
xpath (~> 0.1.4)
|
59
|
-
childprocess (0.
|
56
|
+
childprocess (0.3.1)
|
60
57
|
ffi (~> 1.0.6)
|
61
|
-
coderay (0.
|
58
|
+
coderay (1.0.6)
|
62
59
|
coffee-script (2.2.0)
|
63
60
|
coffee-script-source
|
64
61
|
execjs
|
65
|
-
coffee-script-source (1.1
|
66
|
-
database_cleaner (0.
|
62
|
+
coffee-script-source (1.3.1)
|
63
|
+
database_cleaner (0.7.2)
|
67
64
|
diff-lcs (1.1.3)
|
68
65
|
erubis (2.7.0)
|
69
|
-
execjs (1.
|
66
|
+
execjs (1.3.0)
|
70
67
|
multi_json (~> 1.0)
|
71
|
-
factory_girl (
|
72
|
-
activesupport
|
73
|
-
ffi (1.0.
|
68
|
+
factory_girl (3.1.0)
|
69
|
+
activesupport (>= 3.0.0)
|
70
|
+
ffi (1.0.11)
|
74
71
|
hike (1.2.1)
|
75
72
|
i18n (0.6.0)
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
73
|
+
journey (1.0.3)
|
74
|
+
json (1.6.6)
|
75
|
+
kaminari (0.13.0)
|
76
|
+
actionpack (>= 3.0.0)
|
77
|
+
activesupport (>= 3.0.0)
|
78
|
+
railties (>= 3.0.0)
|
79
|
+
libwebsocket (0.1.3)
|
80
|
+
addressable
|
81
|
+
mail (2.4.4)
|
80
82
|
i18n (>= 0.4.0)
|
81
83
|
mime-types (~> 1.16)
|
82
84
|
treetop (~> 1.4.8)
|
83
85
|
memcache-client (1.8.5)
|
84
|
-
method_source (0.
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
rack (1.3.4)
|
96
|
-
rack-cache (1.0.3)
|
86
|
+
method_source (0.7.1)
|
87
|
+
mime-types (1.18)
|
88
|
+
multi_json (1.2.0)
|
89
|
+
nokogiri (1.5.2)
|
90
|
+
polyglot (0.3.3)
|
91
|
+
pry (0.9.8.4)
|
92
|
+
coderay (~> 1.0.5)
|
93
|
+
method_source (~> 0.7.1)
|
94
|
+
slop (>= 2.4.4, < 3)
|
95
|
+
rack (1.4.1)
|
96
|
+
rack-cache (1.2)
|
97
97
|
rack (>= 0.4)
|
98
|
-
rack-mount (0.8.3)
|
99
|
-
rack (>= 1.0.0)
|
100
98
|
rack-ssl (1.3.2)
|
101
99
|
rack
|
102
100
|
rack-test (0.6.1)
|
103
101
|
rack (>= 1.0)
|
104
|
-
rails (3.
|
105
|
-
actionmailer (= 3.
|
106
|
-
actionpack (= 3.
|
107
|
-
activerecord (= 3.
|
108
|
-
activeresource (= 3.
|
109
|
-
activesupport (= 3.
|
102
|
+
rails (3.2.3)
|
103
|
+
actionmailer (= 3.2.3)
|
104
|
+
actionpack (= 3.2.3)
|
105
|
+
activerecord (= 3.2.3)
|
106
|
+
activeresource (= 3.2.3)
|
107
|
+
activesupport (= 3.2.3)
|
110
108
|
bundler (~> 1.0)
|
111
|
-
railties (= 3.
|
112
|
-
railties (3.
|
113
|
-
actionpack (= 3.
|
114
|
-
activesupport (= 3.
|
109
|
+
railties (= 3.2.3)
|
110
|
+
railties (3.2.3)
|
111
|
+
actionpack (= 3.2.3)
|
112
|
+
activesupport (= 3.2.3)
|
115
113
|
rack-ssl (~> 1.3.2)
|
116
114
|
rake (>= 0.8.7)
|
117
115
|
rdoc (~> 3.4)
|
118
116
|
thor (~> 0.14.6)
|
119
|
-
rake (0.9.2)
|
120
|
-
rdoc (3.
|
117
|
+
rake (0.9.2.2)
|
118
|
+
rdoc (3.12)
|
119
|
+
json (~> 1.4)
|
121
120
|
rr (1.0.4)
|
122
|
-
rspec (2.
|
123
|
-
rspec-core (~> 2.
|
124
|
-
rspec-expectations (~> 2.
|
125
|
-
rspec-mocks (~> 2.
|
126
|
-
rspec-core (2.
|
127
|
-
rspec-expectations (2.
|
128
|
-
diff-lcs (~> 1.1.
|
129
|
-
rspec-mocks (2.
|
130
|
-
rspec-rails (2.
|
131
|
-
actionpack (
|
132
|
-
activesupport (
|
133
|
-
railties (
|
134
|
-
rspec (~> 2.
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
json_pure
|
121
|
+
rspec (2.9.0)
|
122
|
+
rspec-core (~> 2.9.0)
|
123
|
+
rspec-expectations (~> 2.9.0)
|
124
|
+
rspec-mocks (~> 2.9.0)
|
125
|
+
rspec-core (2.9.0)
|
126
|
+
rspec-expectations (2.9.1)
|
127
|
+
diff-lcs (~> 1.1.3)
|
128
|
+
rspec-mocks (2.9.0)
|
129
|
+
rspec-rails (2.9.0)
|
130
|
+
actionpack (>= 3.0)
|
131
|
+
activesupport (>= 3.0)
|
132
|
+
railties (>= 3.0)
|
133
|
+
rspec (~> 2.9.0)
|
134
|
+
rubyzip (0.9.7)
|
135
|
+
sass (3.1.15)
|
136
|
+
selenium-webdriver (2.21.0)
|
137
|
+
childprocess (>= 0.2.5)
|
138
|
+
ffi (~> 1.0)
|
139
|
+
libwebsocket (~> 0.1.3)
|
140
|
+
multi_json (~> 1.0)
|
143
141
|
rubyzip
|
144
|
-
|
145
|
-
|
146
|
-
sprockets (2.0.2)
|
142
|
+
slop (2.4.4)
|
143
|
+
sprockets (2.1.2)
|
147
144
|
hike (~> 1.2)
|
148
145
|
rack (~> 1.0)
|
149
146
|
tilt (~> 1.1, != 1.3.0)
|
150
|
-
sqlite3 (1.3.
|
147
|
+
sqlite3 (1.3.5)
|
151
148
|
steak (2.0.0)
|
152
149
|
capybara (>= 1.0.0)
|
153
150
|
rspec-rails (>= 2.5.0)
|
154
151
|
thor (0.14.6)
|
155
152
|
tilt (1.3.3)
|
156
|
-
tr8n (3.
|
153
|
+
tr8n (3.2.3)
|
157
154
|
coffee-script
|
158
155
|
kaminari
|
159
156
|
rails (>= 3.1.0)
|
@@ -162,8 +159,8 @@ GEM
|
|
162
159
|
treetop (1.4.10)
|
163
160
|
polyglot
|
164
161
|
polyglot (>= 0.3.1)
|
165
|
-
tzinfo (0.3.
|
166
|
-
will_filter (3.1.
|
162
|
+
tzinfo (0.3.33)
|
163
|
+
will_filter (3.1.6)
|
167
164
|
coffee-script
|
168
165
|
kaminari
|
169
166
|
rails (>= 3.1.0)
|
@@ -1,31 +1,81 @@
|
|
1
|
-
#--
|
2
|
-
# Copyright (c)
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
-
# a copy of this software and associated documentation files (the
|
6
|
-
# "Software"), to deal in the Software without restriction, including
|
7
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
-
# the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be
|
13
|
-
# included in all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
-
#++
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2010-2012 Michael Berkovich
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
#++
|
23
|
+
#
|
24
|
+
#-- Platform::Application Schema Information
|
25
|
+
#
|
26
|
+
# Table name: platform_applications
|
27
|
+
#
|
28
|
+
# id INTEGER not null, primary key
|
29
|
+
# developer_id integer
|
30
|
+
# name varchar(255)
|
31
|
+
# description text
|
32
|
+
# state varchar(255) default = new
|
33
|
+
# locale varchar(255)
|
34
|
+
# url varchar(255)
|
35
|
+
# site_domain varchar(255)
|
36
|
+
# support_url varchar(255)
|
37
|
+
# callback_url varchar(255)
|
38
|
+
# contact_email varchar(255)
|
39
|
+
# privacy_policy_url varchar(255)
|
40
|
+
# terms_of_service_url varchar(255)
|
41
|
+
# permissions varchar(255)
|
42
|
+
# key varchar(255)
|
43
|
+
# secret varchar(255)
|
44
|
+
# icon_id integer
|
45
|
+
# logo_id integer
|
46
|
+
# canvas_name varchar(255)
|
47
|
+
# canvas_url varchar(255)
|
48
|
+
# auto_resize boolean
|
49
|
+
# auto_login boolean
|
50
|
+
# mobile_application_type varchar(255)
|
51
|
+
# ios_bundle_id varchar(255)
|
52
|
+
# itunes_app_store_id varchar(255)
|
53
|
+
# android_key_hash varchar(255)
|
54
|
+
# rank integer
|
55
|
+
# auto_signin boolean
|
56
|
+
# deauthorize_callback_url varchar(255)
|
57
|
+
# version varchar(255)
|
58
|
+
# api_version varchar(255)
|
59
|
+
# parent_id integer
|
60
|
+
# created_at datetime
|
61
|
+
# updated_at datetime
|
62
|
+
#
|
63
|
+
# Indexes
|
64
|
+
#
|
65
|
+
# index_platform_applications_on_parent_id (parent_id)
|
66
|
+
# index_platform_applications_on_key (key) UNIQUE
|
67
|
+
# index_platform_applications_on_developer_id (developer_id)
|
68
|
+
#
|
69
|
+
#++
|
23
70
|
|
24
71
|
class Platform::Application < ActiveRecord::Base
|
25
72
|
set_table_name :platform_applications
|
26
73
|
|
27
74
|
# useful methods - should be public
|
28
75
|
include Platform::SimpleStringPermissions
|
76
|
+
# include ActiveRecord::Acts:Tree
|
77
|
+
include AASM
|
78
|
+
|
29
79
|
acts_as_tree :order => "version"
|
30
80
|
|
31
81
|
belongs_to :developer, :class_name => "Platform::Developer"
|
@@ -51,50 +101,47 @@ class Platform::Application < ActiveRecord::Base
|
|
51
101
|
URL_REGEX = /\Ahttp(s?):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/i
|
52
102
|
validates_format_of :url, :with => URL_REGEX, :allow_blank=>true
|
53
103
|
validates_format_of :support_url, :with => URL_REGEX, :allow_blank=>true
|
54
|
-
validates_format_of :callback_url, :with => URL_REGEX, :allow_blank=>true
|
55
|
-
validates_format_of :support_url, :with => URL_REGEX, :allow_blank=>true
|
56
104
|
validates_format_of :privacy_policy_url, :with => URL_REGEX, :allow_blank=>true
|
57
105
|
validates_format_of :terms_of_service_url, :with => URL_REGEX, :allow_blank=>true
|
58
|
-
validates_format_of :canvas_url, :with => URL_REGEX, :allow_blank=>true
|
59
106
|
|
60
107
|
attr_accessor :token_callback_url
|
61
108
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
end
|
109
|
+
aasm :column => :state do
|
110
|
+
state :new, :initial => true
|
111
|
+
state :submitted
|
112
|
+
state :approved
|
113
|
+
state :rejected
|
114
|
+
state :blocked
|
115
|
+
state :deprecated
|
116
|
+
|
117
|
+
event :submit do
|
118
|
+
transitions :from => :new, :to => :submitted
|
119
|
+
transitions :from => :rejected, :to => :submitted
|
120
|
+
end
|
75
121
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
122
|
+
event :deprecate do
|
123
|
+
transitions :from => :approved, :to => :deprecated
|
124
|
+
end
|
125
|
+
|
126
|
+
event :block do
|
127
|
+
transitions :from => :new, :to => :blocked
|
128
|
+
transitions :from => :submitted, :to => :blocked
|
129
|
+
transitions :from => :approved, :to => :blocked
|
130
|
+
transitions :from => :rejected, :to => :blocked
|
131
|
+
end
|
86
132
|
|
87
|
-
|
88
|
-
|
89
|
-
|
133
|
+
event :unblock do
|
134
|
+
transitions :from => :blocked, :to => :new
|
135
|
+
end
|
90
136
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
137
|
+
event :approve do
|
138
|
+
transitions :from => :new, :to => :approved
|
139
|
+
transitions :from => :submitted, :to => :approved
|
140
|
+
end
|
95
141
|
|
96
|
-
|
97
|
-
|
142
|
+
event :reject do
|
143
|
+
transitions :from => :submitted, :to => :rejected
|
144
|
+
end
|
98
145
|
end
|
99
146
|
|
100
147
|
def self.for(client_id)
|
@@ -375,6 +422,11 @@ class Platform::Application < ActiveRecord::Base
|
|
375
422
|
end
|
376
423
|
end
|
377
424
|
|
425
|
+
def oauth_url
|
426
|
+
protocol = Platform::Config.env == "development" ? 'http' : 'https'
|
427
|
+
"#{protocol}://#{Platform::Config.site_base_url}/platform/oauth/authorize?client_id=#{key}&response_type=token&display=web&redirect_url=#{CGI.escape(callback_url || '')}"
|
428
|
+
end
|
429
|
+
|
378
430
|
protected
|
379
431
|
|
380
432
|
def generate_keys
|