rhosync 2.1.1 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +9 -0
- data/CREDITS +38 -0
- data/Rakefile +5 -5
- data/generators/rhosync.rb +2 -0
- data/generators/templates/application/config.ru +1 -1
- data/generators/templates/source/source_adapter.rb +1 -1
- data/lib/rhosync.rb +1 -0
- data/lib/rhosync/client.rb +7 -0
- data/lib/rhosync/console/app/helpers/helpers.rb +2 -2
- data/lib/rhosync/console/app/routes/auth.rb +2 -2
- data/lib/rhosync/console/app/routes/client.rb +2 -2
- data/lib/rhosync/console/app/routes/docs.rb +15 -15
- data/lib/rhosync/console/app/routes/home.rb +10 -10
- data/lib/rhosync/console/app/routes/timing.rb +9 -9
- data/lib/rhosync/console/app/routes/user.rb +10 -10
- data/lib/rhosync/console/app/views/client.erb +3 -3
- data/lib/rhosync/console/app/views/docdata.erb +1 -1
- data/lib/rhosync/console/app/views/docs.erb +1 -1
- data/lib/rhosync/console/app/views/headermenu.erb +6 -6
- data/lib/rhosync/console/app/views/home.erb +2 -2
- data/lib/rhosync/console/app/views/index.erb +6 -6
- data/lib/rhosync/console/app/views/jqplot.erb +1 -1
- data/lib/rhosync/console/app/views/layout.erb +18 -18
- data/lib/rhosync/console/app/views/login.erb +1 -1
- data/lib/rhosync/console/app/views/newuser.erb +2 -2
- data/lib/rhosync/console/app/views/ping.erb +1 -1
- data/lib/rhosync/console/app/views/select_doc.erb +1 -1
- data/lib/rhosync/console/app/views/upload_doc.erb +1 -1
- data/lib/rhosync/console/app/views/user.erb +5 -5
- data/lib/rhosync/console/app/views/users.erb +2 -2
- data/lib/rhosync/server.rb +5 -2
- data/lib/rhosync/tasks.rb +10 -0
- data/lib/rhosync/version.rb +1 -1
- data/spec/client_spec.rb +12 -0
- data/spec/generator/generator_spec.rb +1 -0
- data/spec/server/server_spec.rb +27 -2
- data/spec/store_spec.rb +6 -0
- data/tasks/redis.rake +15 -14
- metadata +56 -55
data/CHANGELOG
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## 2.1.2
|
2
|
+
* Use server-dir/redis.conf if not found at RedisRunner.prefix (via artemk)
|
3
|
+
* #8471337 - switch client user if it is not equal to current_user
|
4
|
+
* Upgrade rest-client dependency which includes cookie escape fix
|
5
|
+
* #10097347 - generate cryptographically secure secret key by default
|
6
|
+
* Fixed 'application/json; charset=UTF-8' content handling in the server before filter
|
7
|
+
* #11017509 - fixed sinatra 1.2 incompatibility with url() helper
|
8
|
+
* #4569337 - use redis 2.2.2 by default
|
9
|
+
|
1
10
|
## 2.1.1
|
2
11
|
* #7679395 - added support for gzipped bulk data files
|
3
12
|
* #8167507 - fixed typo in console login page
|
data/CREDITS
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
RhoSync uses following other projects:
|
2
|
+
|
3
|
+
Ruby language 1.8.7 (http://www.ruby-lang.org/en/downloads/)
|
4
|
+
License: GPL or Ruby own license (http://www.ruby-lang.org/en/about/license.txt)
|
5
|
+
|
6
|
+
Redis 1.2.6 or 2.2.1 (http://redis.io)
|
7
|
+
License: BSD (https://github.com/antirez/redis/blob/master/COPYING)
|
8
|
+
|
9
|
+
Resque 1.13.0 (https://github.com/defunkt/resque)
|
10
|
+
License: MIT-like (https://github.com/defunkt/resque/blob/master/LICENSE)
|
11
|
+
|
12
|
+
Sinatra 1.1.3 (http://www.sinatrarb.com/)
|
13
|
+
License: MIT-like (https://github.com/sinatra/sinatra/blob/master/LICENSE)
|
14
|
+
|
15
|
+
sqlite3-ruby 1.2.5 (http://github.com/luislavena/sqlite3-ruby)
|
16
|
+
License: MIT-like (https://github.com/luislavena/sqlite3-ruby/blob/master/LICENSE)
|
17
|
+
|
18
|
+
log4r 1.1.7 (http://log4r.rubyforge.org/)
|
19
|
+
License: GNU LGPLv3 (http://log4r.rubyforge.org/license.html)
|
20
|
+
|
21
|
+
uuidtools 2.1.1 (https://github.com/sporkmonger/uuidtools/)
|
22
|
+
License: MIT-like (https://github.com/sporkmonger/uuidtools/blob/master/LICENSE)
|
23
|
+
|
24
|
+
rest-client 1.6.1 (https://github.com/archiloque/rest-client)
|
25
|
+
License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
26
|
+
|
27
|
+
json 1.4.6 (http://flori.github.com/json/)
|
28
|
+
License: GPL2 or Ruby (http://www.ruby-lang.org/en/LICENSE.txt)
|
29
|
+
|
30
|
+
templater 1.0.0 (https://github.com/jnicklas/templater)
|
31
|
+
License: MIT (https://github.com/jnicklas/templater)
|
32
|
+
|
33
|
+
Apache 2.2 (http://httpd.apache.org)
|
34
|
+
License: Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
|
35
|
+
|
36
|
+
thin 1.2.8 (https://github.com/macournoyer/thin)
|
37
|
+
License: MIT (https://github.com/macournoyer/thin/blob/master/COPYING)
|
38
|
+
|
data/Rakefile
CHANGED
@@ -65,16 +65,16 @@ begin
|
|
65
65
|
|
66
66
|
# TODO: Due to https://www.pivotaltracker.com/story/show/3417862, we can't use JSON 1.4.3
|
67
67
|
gemspec.add_dependency "json", "~>1.4.2"
|
68
|
-
gemspec.add_dependency "log4r", "~>1.1.7"
|
69
68
|
gemspec.add_dependency "sqlite3-ruby", "~>1.2.5"
|
70
69
|
gemspec.add_dependency "rubyzip", "~>0.9.4"
|
71
70
|
gemspec.add_dependency "uuidtools", ">=2.1.1"
|
72
|
-
gemspec.add_dependency "redis", "~>2.
|
73
|
-
gemspec.add_dependency "resque", "
|
74
|
-
gemspec.add_dependency "rest-client", "
|
75
|
-
gemspec.add_dependency "sinatra", "~>1.
|
71
|
+
gemspec.add_dependency "redis", "~>2.1.1"
|
72
|
+
gemspec.add_dependency "resque", "~>1.14.0"
|
73
|
+
gemspec.add_dependency "rest-client", "~>1.6.1"
|
74
|
+
gemspec.add_dependency "sinatra", "~>1.2"
|
76
75
|
gemspec.add_dependency "templater", "~>1.0.0"
|
77
76
|
gemspec.add_dependency "rake", ">=0.8.7"
|
77
|
+
gemspec.add_development_dependency "log4r", "~>1.1.7"
|
78
78
|
gemspec.add_development_dependency "jeweler", ">=1.4.0"
|
79
79
|
gemspec.add_development_dependency "rspec", ">=1.3.0"
|
80
80
|
gemspec.add_development_dependency "rcov", ">=0.9.8"
|
data/generators/rhosync.rb
CHANGED
@@ -36,6 +36,8 @@ module Rhosync
|
|
36
36
|
first_argument :name, :required => true, :desc => "application name"
|
37
37
|
|
38
38
|
template :configru do |template|
|
39
|
+
require 'securerandom' rescue nil
|
40
|
+
@secret = SecureRandom.hex(64) rescue '<changeme>'
|
39
41
|
template.source = 'config.ru'
|
40
42
|
template.destination = "#{name}/config.ru"
|
41
43
|
end
|
@@ -19,7 +19,7 @@ Rhosync::Server.disable :run
|
|
19
19
|
Rhosync::Server.disable :clean_trace
|
20
20
|
Rhosync::Server.enable :raise_errors
|
21
21
|
Rhosync::Server.set :environment, :development
|
22
|
-
Rhosync::Server.set :secret, '
|
22
|
+
Rhosync::Server.set :secret, '<%= @secret %>'
|
23
23
|
Rhosync::Server.set :root, ROOT_PATH
|
24
24
|
Rhosync::Server.use Rack::Static, :urls => ["/data"], :root => Rhosync::Server.root
|
25
25
|
|
@@ -36,7 +36,7 @@ class <%=class_name%> < SourceAdapter
|
|
36
36
|
raise "Please provide some code to update a single record in the backend data source using the update_hash"
|
37
37
|
end
|
38
38
|
|
39
|
-
def delete(
|
39
|
+
def delete(delete_hash)
|
40
40
|
# TODO: write some code here if applicable
|
41
41
|
# be sure to have a hash key and value for "object"
|
42
42
|
# for now, we'll say that its OK to not have a delete operation
|
data/lib/rhosync.rb
CHANGED
data/lib/rhosync/client.rb
CHANGED
@@ -59,6 +59,13 @@ module Rhosync
|
|
59
59
|
super
|
60
60
|
end
|
61
61
|
|
62
|
+
def switch_user(new_user_id)
|
63
|
+
flash_data('*')
|
64
|
+
User.load(self.user_id).clients.delete(self.id)
|
65
|
+
User.load(new_user_id).clients << self.id
|
66
|
+
self.user_id = new_user_id
|
67
|
+
end
|
68
|
+
|
62
69
|
def update_clientdoc(sources)
|
63
70
|
# TODO: We need to store schema info and data info in bulk data
|
64
71
|
# source masterdoc and source schema might have changed!
|
@@ -18,12 +18,12 @@ class RhosyncConsole::Server
|
|
18
18
|
report_error("Can't login to Rhosync server.")
|
19
19
|
#puts e.message + "\n" + e.backtrace.join("\n")
|
20
20
|
end
|
21
|
-
redirect
|
21
|
+
redirect url_path('/'), 303
|
22
22
|
end
|
23
23
|
|
24
24
|
get '/logout' do
|
25
25
|
session[:token] = nil
|
26
|
-
redirect
|
26
|
+
redirect url_path('/'), 303
|
27
27
|
end
|
28
28
|
|
29
29
|
end
|
@@ -5,7 +5,7 @@ class RhosyncConsole::Server
|
|
5
5
|
handle_api_error("Can't create new device") do
|
6
6
|
RhosyncApi::create_client(session[:server],session[:token],params[:user_id])
|
7
7
|
end
|
8
|
-
redirect
|
8
|
+
redirect url_path("/user?user_id=#{CGI.escape(params[:user_id])}"), 303
|
9
9
|
end
|
10
10
|
|
11
11
|
get '/device' do
|
@@ -25,7 +25,7 @@ class RhosyncConsole::Server
|
|
25
25
|
RhosyncApi::delete_client(session[:server],session[:token],
|
26
26
|
params[:user_id],params[:device_id])
|
27
27
|
end
|
28
|
-
redirect
|
28
|
+
redirect url_path(session[:errors] ? "/device?user_id=#{CGI.escape(params[:user_id])}&device_id=#{CGI.escape(params[:device_id])}" :
|
29
29
|
"/user?user_id=#{CGI.escape(params[:user_id])}"), 303
|
30
30
|
end
|
31
31
|
end
|
@@ -6,9 +6,9 @@ class RhosyncConsole::Server
|
|
6
6
|
@locals = {
|
7
7
|
:div => "main_box",
|
8
8
|
:links => [
|
9
|
-
{ :url =>
|
10
|
-
{ :url =>
|
11
|
-
{ :url =>
|
9
|
+
{ :url => url_path('/homepage'), :title => 'Info' },
|
10
|
+
{ :url => url_path('/doc/select'), :selected => true, :title => 'Server Document' },
|
11
|
+
{ :url => url_path('/users'), :title => 'Users' }
|
12
12
|
]
|
13
13
|
}
|
14
14
|
erb :content
|
@@ -37,15 +37,15 @@ class RhosyncConsole::Server
|
|
37
37
|
handle_api_error("Can't load list of the documents") do
|
38
38
|
if params[:device_id]
|
39
39
|
@docs_name = "device #{params[:device_id]}"
|
40
|
-
@back_href =
|
40
|
+
@back_href = url_path("device?user_id=#{CGI.escape(params[:user_id])}&device_id=#{CGI.escape(params[:device_id])}")
|
41
41
|
@docs = RhosyncApi::list_client_docs(session[:server],session[:token],params[:source_id],params[:device_id])
|
42
42
|
else
|
43
43
|
if params[:user_id]=='*'
|
44
44
|
@docs_name = "app partition"
|
45
|
-
@back_href =
|
45
|
+
@back_href = url_path('/')
|
46
46
|
else
|
47
47
|
@docs_name = "user #{params[:user_id]} partition"
|
48
|
-
@back_href =
|
48
|
+
@back_href = url_path("user?user_id=#{CGI.escape(params[:user_id])}")
|
49
49
|
end
|
50
50
|
@docs = RhosyncApi::list_source_docs(session[:server],
|
51
51
|
session[:token],params[:source_id],params[:user_id])
|
@@ -53,7 +53,7 @@ class RhosyncConsole::Server
|
|
53
53
|
end
|
54
54
|
erb :docs, :layout => false
|
55
55
|
else
|
56
|
-
docs_render_page
|
56
|
+
docs_render_page url_path("/docs" + hash_to_params(params))
|
57
57
|
|
58
58
|
end
|
59
59
|
end
|
@@ -73,7 +73,7 @@ class RhosyncConsole::Server
|
|
73
73
|
end
|
74
74
|
erb :select_doc, :layout => false
|
75
75
|
else
|
76
|
-
docs_render_page
|
76
|
+
docs_render_page url_path("/doc/select" + hash_to_params(params))
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
@@ -88,10 +88,10 @@ class RhosyncConsole::Server
|
|
88
88
|
end
|
89
89
|
@back_params = "source_id=#{CGI.escape(params[:source_id])}&user_id=#{CGI.escape(params[:user_id])}"
|
90
90
|
@back_params += "&device_id=#{CGI.escape(params[:device_id])}" if params[:device_id]
|
91
|
-
@back_href =
|
91
|
+
@back_href = url_path("docs?#{doc_params}")
|
92
92
|
erb :doc, :layout => false
|
93
93
|
else
|
94
|
-
docs_render_page
|
94
|
+
docs_render_page url_path("/doc" + hash_to_params(params))
|
95
95
|
end
|
96
96
|
|
97
97
|
end
|
@@ -106,11 +106,11 @@ class RhosyncConsole::Server
|
|
106
106
|
@result_name = "Clear result"
|
107
107
|
@status = "Successfully cleared: [#{CGI.unescape(params[:dbkey])}]"
|
108
108
|
@back_href = params[:user_id] ?
|
109
|
-
|
110
|
-
|
109
|
+
url_path("doc?#{doc_params}&dbkey=#{CGI.escape(params[:dbkey])}") :
|
110
|
+
url_path("doc/select?dbkey=#{CGI.escape(params[:dbkey])}")
|
111
111
|
erb :result, :layout => false
|
112
112
|
else
|
113
|
-
docs_render_page
|
113
|
+
docs_render_page url_path("/doc/clear" + hash_to_params(params))
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
@@ -137,8 +137,8 @@ class RhosyncConsole::Server
|
|
137
137
|
@result_name = "Upload result"
|
138
138
|
@status = "Successfully uploadad data to: [#{CGI.unescape(params[:doc])}]"
|
139
139
|
@back_href = params[:user_id] ?
|
140
|
-
|
141
|
-
|
140
|
+
url_path("doc?#{doc_params}&dbkey=#{params[:doc]}") :
|
141
|
+
url_path("doc/select?dbkey=#{params[:doc]}")
|
142
142
|
erb :result
|
143
143
|
end
|
144
144
|
|
@@ -2,33 +2,33 @@ class RhosyncConsole::Server
|
|
2
2
|
get '/' do
|
3
3
|
if params[:xhr] or request.xhr?
|
4
4
|
if login_required
|
5
|
-
redirect
|
5
|
+
redirect url_path('/loginpage')
|
6
6
|
else
|
7
|
-
redirect
|
7
|
+
redirect url_path('/homepage')
|
8
8
|
end
|
9
9
|
else
|
10
10
|
@currentpage = "Console" #which page in menu
|
11
11
|
if login_required
|
12
12
|
@pagetitle = "Login" #H1 title
|
13
|
-
@initialcontent =
|
13
|
+
@initialcontent = url_path('/loginpage')
|
14
14
|
|
15
15
|
@locals = {
|
16
16
|
:div => "main_box",
|
17
17
|
:links => [
|
18
|
-
# { :url =>
|
19
|
-
# { :url =>
|
18
|
+
# { :url => url_path('/timing/bydevice'), :selected => true, :title => 'By Device' },
|
19
|
+
# { :url => url_path('/timing/bysource'), :title => 'By Source' }
|
20
20
|
]
|
21
21
|
}
|
22
22
|
else
|
23
23
|
@pagetitle = "Rhosync Console" #H1 title
|
24
|
-
@initialcontent =
|
24
|
+
@initialcontent = url_path('/homepage')
|
25
25
|
|
26
26
|
@locals = {
|
27
27
|
:div => "main_box",
|
28
28
|
:links => [
|
29
|
-
{ :url =>
|
30
|
-
{ :url =>
|
31
|
-
{ :url =>
|
29
|
+
{ :url => url_path('/homepage'), :selected => true, :title => 'Info' },
|
30
|
+
{ :url => url_path('/doc/select'), :title => 'Server Document' },
|
31
|
+
{ :url => url_path('/users'), :title => 'Users' }
|
32
32
|
]
|
33
33
|
}
|
34
34
|
end
|
@@ -56,6 +56,6 @@ class RhosyncConsole::Server
|
|
56
56
|
handle_api_error("Can't reset server") do
|
57
57
|
RhosyncApi::reset(session[:server],session[:token])
|
58
58
|
end
|
59
|
-
redirect
|
59
|
+
redirect url_path('/'), 303
|
60
60
|
end
|
61
61
|
end
|
@@ -3,21 +3,21 @@ require 'json'
|
|
3
3
|
class RhosyncConsole::Server
|
4
4
|
get '/timing' do
|
5
5
|
if login_required
|
6
|
-
redirect
|
6
|
+
redirect url_path('/')
|
7
7
|
return
|
8
8
|
end
|
9
9
|
@currentpage = "Statistics"
|
10
10
|
@pagetitle = "Statistics" #H1 title
|
11
11
|
|
12
|
-
@initialcontent =
|
12
|
+
@initialcontent = url_path('/timing/usercount')
|
13
13
|
|
14
14
|
@locals = {
|
15
15
|
:div => "main_box",
|
16
16
|
:links => [
|
17
|
-
{ :url =>
|
18
|
-
{ :url =>
|
19
|
-
{ :url =>
|
20
|
-
{ :url =>
|
17
|
+
{ :url => url_path('/timing/usercount'), :selected => true, :title => 'User Count' },
|
18
|
+
{ :url => url_path('/timing/devicecount'), :title => 'Device Count' },
|
19
|
+
{ :url => url_path('/timing/httptiming'), :title => 'HTTP Timing' },
|
20
|
+
{ :url => url_path('/timing/bysource'), :title => 'Source Timing' }
|
21
21
|
]
|
22
22
|
}
|
23
23
|
|
@@ -69,7 +69,7 @@ class RhosyncConsole::Server
|
|
69
69
|
s['data'] = [thisdata]
|
70
70
|
s['options'] = options
|
71
71
|
@sources << s
|
72
|
-
erb :jqplot, :layout =>
|
72
|
+
erb :jqplot, :layout => false
|
73
73
|
end
|
74
74
|
|
75
75
|
get '/timing/usercount' do
|
@@ -156,7 +156,7 @@ class RhosyncConsole::Server
|
|
156
156
|
end
|
157
157
|
|
158
158
|
@data = [[[1,2],[3,4],[5,6]]].to_json
|
159
|
-
erb :jqplot, :layout =>
|
159
|
+
erb :jqplot, :layout => false
|
160
160
|
end
|
161
161
|
|
162
162
|
|
@@ -237,6 +237,6 @@ class RhosyncConsole::Server
|
|
237
237
|
end
|
238
238
|
|
239
239
|
@data = [[[1,2],[3,4],[5,6]]].to_json
|
240
|
-
erb :jqplot, :layout =>
|
240
|
+
erb :jqplot, :layout => false
|
241
241
|
end
|
242
242
|
end
|
@@ -6,9 +6,9 @@ class RhosyncConsole::Server
|
|
6
6
|
@locals = {
|
7
7
|
:div => "main_box",
|
8
8
|
:links => [
|
9
|
-
{ :url =>
|
10
|
-
{ :url =>
|
11
|
-
{ :url =>
|
9
|
+
{ :url => url_path('/homepage'), :title => 'Info' },
|
10
|
+
{ :url => url_path('/doc/select'), :title => 'Server Document' },
|
11
|
+
{ :url => url_path('/users'), :selected => true, :title => 'Users' }
|
12
12
|
]
|
13
13
|
}
|
14
14
|
erb :content
|
@@ -23,7 +23,7 @@ class RhosyncConsole::Server
|
|
23
23
|
erb :users, :layout => false
|
24
24
|
|
25
25
|
else
|
26
|
-
render_page
|
26
|
+
render_page url_path("/users")
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -31,7 +31,7 @@ class RhosyncConsole::Server
|
|
31
31
|
if params[:xhr] or request.xhr?
|
32
32
|
erb :newuser, :layout => false
|
33
33
|
else
|
34
|
-
render_page
|
34
|
+
render_page url_path("/user/new")
|
35
35
|
end
|
36
36
|
|
37
37
|
end
|
@@ -45,7 +45,7 @@ class RhosyncConsole::Server
|
|
45
45
|
session[:token],params[:login],params[:password])
|
46
46
|
end
|
47
47
|
end
|
48
|
-
redirect
|
48
|
+
redirect url_path(session[:errors] ? '/user/new' : '/users'), 303
|
49
49
|
end
|
50
50
|
|
51
51
|
get '/user' do
|
@@ -63,7 +63,7 @@ class RhosyncConsole::Server
|
|
63
63
|
erb :user, :layout => false
|
64
64
|
else
|
65
65
|
params[:user_id] = CGI::escape(params[:user_id]) if params[:user_id]
|
66
|
-
render_page
|
66
|
+
render_page url_path("/user?user_id=#{params[:user_id]}")
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
@@ -71,7 +71,7 @@ class RhosyncConsole::Server
|
|
71
71
|
handle_api_error("Can't delete user #{params[:user_id]}") do
|
72
72
|
RhosyncApi::delete_user(session[:server],session[:token],params[:user_id])
|
73
73
|
end
|
74
|
-
redirect
|
74
|
+
redirect url_path(session[:errors] ? "/user?user_id=#{CGI.escape(params[:user_id])}" : '/users'), 303
|
75
75
|
end
|
76
76
|
|
77
77
|
get '/user/ping' do
|
@@ -83,7 +83,7 @@ class RhosyncConsole::Server
|
|
83
83
|
end
|
84
84
|
erb :ping, :layout => false
|
85
85
|
else
|
86
|
-
render_page
|
86
|
+
render_page url_path("/user/ping?user_id=#{CGI.escape(params[:user_id])}")
|
87
87
|
end
|
88
88
|
|
89
89
|
end
|
@@ -94,6 +94,6 @@ class RhosyncConsole::Server
|
|
94
94
|
RhosyncApi::ping(session[:server],session[:token],params[:user_id],params)
|
95
95
|
end
|
96
96
|
user = CGI.escape(params[:user_id])
|
97
|
-
redirect
|
97
|
+
redirect url_path(session[:errors] ? "/user/ping?user_id=#{user}" : "/user?user_id=#{user}"), 303
|
98
98
|
end
|
99
99
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<h1>Device: <%=params[:device_id]%></h1>
|
2
2
|
<%=show_errors%>
|
3
|
-
<a href="javascript:void(0);" onclick="loadXMLDoc('<%=
|
4
|
-
<a href='<%=
|
3
|
+
<a href="javascript:void(0);" onclick="loadXMLDoc('<%=url_path("user?user_id=#{CGI.escape(params[:user_id])}")%>','main_box');" class='nav_button'>Back</a>
|
4
|
+
<a href='<%=url_path("device/delete?user_id=#{CGI.escape(params[:user_id])}&device_id=#{CGI.escape(params[:device_id])}")%>' class='nav_button'>
|
5
5
|
Delete device
|
6
6
|
</a>
|
7
7
|
|
@@ -23,7 +23,7 @@
|
|
23
23
|
|
24
24
|
[
|
25
25
|
<%@sources.each_index do |i|%>
|
26
|
-
<a href='javascript:void(0);' onclick="loadXMLDoc('<%=
|
26
|
+
<a href='javascript:void(0);' onclick="loadXMLDoc('<%=url_path("docs?source_id=#{@sources[i]}&device_id=#{CGI.escape(params[:device_id])}&user_id=#{CGI.escape(params[:user_id])}")%>','main_box');">
|
27
27
|
<%=i==0?'':','%>"<%=@sources[i]%>"
|
28
28
|
</a>
|
29
29
|
<%end%>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<div class='panel'>
|
3
3
|
<%if @data.size > 0%>
|
4
4
|
<div class='panel'>
|
5
|
-
<a href='javascript:void(0);' onclick="loadXMLDoc('<%=
|
5
|
+
<a href='javascript:void(0);' onclick="loadXMLDoc('<%=url_path("doc/clear?#{@back_params}&dbkey=#{CGI.escape(params[:dbkey])}")%>','main_box');" class='nav_button'>Clear document</a>
|
6
6
|
</div>
|
7
7
|
<%if @is_string%>
|
8
8
|
<p>[<%=@data%>]</p>
|
@@ -22,7 +22,7 @@
|
|
22
22
|
<%@docs.each do |name,dbkey|%>
|
23
23
|
<tr>
|
24
24
|
<td>:<%=name%></td>
|
25
|
-
<td><a href='javascript:void(0);' onclick="loadXMLDoc('<%=
|
25
|
+
<td><a href='javascript:void(0);' onclick="loadXMLDoc('<%=url_path("doc?dbkey=#{CGI.escape(dbkey)}&#{@doc_params}")%>','main_box');" class='nav_button'><%=dbkey%></a></td>
|
26
26
|
</tr>
|
27
27
|
<%end%>
|
28
28
|
</table>
|
@@ -7,14 +7,14 @@
|
|
7
7
|
<% end %>
|
8
8
|
|
9
9
|
<% if currentpage == "Console" %>
|
10
|
-
<li id="current"><a href="<%=
|
10
|
+
<li id="current"><a href="<%=url_path("")%>" class="current">Console</a></li>
|
11
11
|
<% else %>
|
12
|
-
<li ><a href="<%=
|
12
|
+
<li ><a href="<%=url_path("")%>" >Console</a></li>
|
13
13
|
<% end %>
|
14
14
|
<% if currentpage == "Statistics" %>
|
15
|
-
<li id="current"><a href="<%=
|
15
|
+
<li id="current"><a href="<%=url_path("timing")%>" class="current">Statistics</a></li>
|
16
16
|
<% else %>
|
17
|
-
<li ><a href="<%=
|
17
|
+
<li ><a href="<%=url_path("timing")%>" class="">Statistics</a></li>
|
18
18
|
<% end %>
|
19
19
|
<!--
|
20
20
|
|
@@ -34,8 +34,8 @@
|
|
34
34
|
<img src="/console/images/tabs_separator.png"/>
|
35
35
|
</li>
|
36
36
|
<% if session[:token] != nil %>
|
37
|
-
<li><a href="<%=
|
37
|
+
<li><a href="<%=url_path("logout")%>" class="logout">Logout</a></li>
|
38
38
|
<% else %>
|
39
|
-
<li><a href="<%=
|
39
|
+
<li><a href="<%=url_path("")%>" class="login">Login</a></li>
|
40
40
|
<% end %>
|
41
41
|
</ul>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<%end%>
|
7
7
|
|
8
8
|
<div class='panel'>
|
9
|
-
<a href="<%=
|
9
|
+
<a href="<%=url_path('reset')%>" class='nav_button' onclick="return confirm('Are you sure? Resetting will remove all data. It will also return an error code to all existing devices when they connect!')">Reset</a>
|
10
10
|
|
11
11
|
</div>
|
12
12
|
|
@@ -15,7 +15,7 @@
|
|
15
15
|
<%unless @sources.nil? %>
|
16
16
|
[
|
17
17
|
<%@sources.each_index do |i|%>
|
18
|
-
<a href='javascript:void(0);' onclick="loadXMLDoc('<%=
|
18
|
+
<a href='javascript:void(0);' onclick="loadXMLDoc('<%=url_path("docs?source_id=#{@sources[i]}&user_id=*")%>','main_box');"><%=i==0?'':','%>"<%=@sources[i]%>"</a>
|
19
19
|
<%end%>
|
20
20
|
]
|
21
21
|
<%end%>
|
@@ -7,21 +7,21 @@
|
|
7
7
|
<%="Licensed to #{@license['licensee']} on #{@license['issued']}, available #{@license['available']} of #{@license['seats']} devices"%>
|
8
8
|
<%end%>
|
9
9
|
<div class='panel'>
|
10
|
-
<a href="<%=
|
10
|
+
<a href="<%=url_path('logout')%>" class='nav_button'>Logout</a>
|
11
11
|
</div>
|
12
12
|
<div class='panel'>
|
13
|
-
<a href="<%=
|
14
|
-
<a href="<%=
|
13
|
+
<a href="<%=url_path('reset')%>" class='nav_button' onclick="return confirm('Are you sure? Resetting will remove all data. It will also return an error code to all existing devices when they connect!')">Reset</a>
|
14
|
+
<a href="<%=url_path('doc/select')%>" class='nav_button'>Show server document</a>
|
15
15
|
</div>
|
16
16
|
<div class='panel'>
|
17
|
-
<a href="<%=
|
17
|
+
<a href="<%=url_path('users')%>" class='nav_button'>Application users</a>
|
18
18
|
</div>
|
19
19
|
<h2>App partition sources</h2>
|
20
20
|
<div class='panel'>
|
21
21
|
<%unless @sources.nil? %>
|
22
22
|
[
|
23
23
|
<%@sources.each_index do |i|%>
|
24
|
-
<a href="<%=
|
24
|
+
<a href="<%=url_path("docs?source_id=#{@sources[i]}&user_id=*")%>"><%=i==0?'':','%>"<%=@sources[i]%>"</a>
|
25
25
|
<%end%>
|
26
26
|
]
|
27
27
|
<%end%>
|
@@ -29,7 +29,7 @@
|
|
29
29
|
<% else %>
|
30
30
|
<h1>Login</h1>
|
31
31
|
<%=show_errors%>
|
32
|
-
<form action="<%=
|
32
|
+
<form action="<%=url_path('login')%>" method='POST'>
|
33
33
|
<table>
|
34
34
|
<tr>
|
35
35
|
<td>Connect to RhoSync:</td>
|
@@ -41,7 +41,7 @@ document.getElementById('chartdiv').style.display = '';plot = $.jqplot('chartdiv
|
|
41
41
|
<% end %>
|
42
42
|
|
43
43
|
<a style="margin-right:5px" href="javascript:void(0);"
|
44
|
-
onclick="loadXMLDoc('<%=
|
44
|
+
onclick="loadXMLDoc('<%= url_path(@uri + '?display='+ source['name'])%>','main_box');">
|
45
45
|
<%= source['name'] %>
|
46
46
|
</a>
|
47
47
|
<% end%>
|
@@ -4,25 +4,25 @@
|
|
4
4
|
<head>
|
5
5
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
6
|
<title>Rhosync Console</title>
|
7
|
-
<!--<link rel="stylesheet" href="<%=
|
8
|
-
<link rel="stylesheet" href="<%=
|
9
|
-
<link rel="stylesheet" href="<%=
|
10
|
-
<link rel="stylesheet" href="<%=
|
11
|
-
<link rel="stylesheet" href="<%=
|
7
|
+
<!--<link rel="stylesheet" href="<%=url_path('main.css')%>" type="text/css" media="screen" /> -->
|
8
|
+
<link rel="stylesheet" href="<%=url_path('reset.css')%>" type="text/css" media="screen" />
|
9
|
+
<link rel="stylesheet" href="<%=url_path('home.css')%>" type="text/css" media="screen" />
|
10
|
+
<link rel="stylesheet" href="<%=url_path('style.css')%>" type="text/css" media="screen" />
|
11
|
+
<link rel="stylesheet" href="<%=url_path('ThickBox.css')%>" type="text/css" media="screen" />
|
12
12
|
|
13
|
-
<!--[if IE]><script language="javascript" type="text/javascript" src="<%=
|
14
|
-
<script language="javascript" type="text/javascript" src="<%=
|
15
|
-
<script language="javascript" type="text/javascript" src="<%=
|
16
|
-
<script language="javascript" type="text/javascript" src="<%=
|
17
|
-
<script language="javascript" type="text/javascript" src="<%=
|
18
|
-
<script language="javascript" type="text/javascript" src="<%=
|
19
|
-
<script language="javascript" type="text/javascript" src="<%=
|
20
|
-
<script language="javascript" type="text/javascript" src="<%=
|
21
|
-
<script language="javascript" type="text/javascript" src="<%=
|
22
|
-
<!--<script language="javascript" type="text/javascript" src="<%=
|
23
|
-
<!--<script language="javascript" type="text/javascript" src="<%=
|
13
|
+
<!--[if IE]><script language="javascript" type="text/javascript" src="<%=url_path('jqplot/excanvas.js')%>"></script><![endif]-->
|
14
|
+
<script language="javascript" type="text/javascript" src="<%=url_path('jqplot/jquery-1.4.2.min.js')%>"></script>
|
15
|
+
<script language="javascript" type="text/javascript" src="<%=url_path('jqplot/jquery.jqplot.min.js')%>"></script>
|
16
|
+
<script language="javascript" type="text/javascript" src="<%=url_path('jqplot/jqplot.categoryAxisRenderer.min.js')%>"></script>
|
17
|
+
<script language="javascript" type="text/javascript" src="<%=url_path('jqplot/jqplot.dateAxisRenderer.js')%>"></script>
|
18
|
+
<script language="javascript" type="text/javascript" src="<%=url_path('jqplot/jqplot.canvasTextRenderer.js')%>"></script>
|
19
|
+
<script language="javascript" type="text/javascript" src="<%=url_path('jqplot/jqplot.canvasAxisLabelRenderer.js')%>"></script>
|
20
|
+
<script language="javascript" type="text/javascript" src="<%=url_path('jqplot/jqplot.canvasAxisTickRenderer.js')%>"></script>
|
21
|
+
<script language="javascript" type="text/javascript" src="<%=url_path('jqplot/jqplot.cursor.js')%>"></script>
|
22
|
+
<!--<script language="javascript" type="text/javascript" src="<%=url_path('jqplot/jqplot.barRenderer.min.js')%>"></script>-->
|
23
|
+
<!--<script language="javascript" type="text/javascript" src="<%=url_path('jqplot/jqplot.pointLabels.min.js')%>"></script>-->
|
24
24
|
|
25
|
-
<link rel="stylesheet" type="text/css" href="<%=
|
25
|
+
<link rel="stylesheet" type="text/css" href="<%=url_path('jqplot/jquery.jqplot.min.css')%>" />
|
26
26
|
|
27
27
|
<script type="text/javascript">
|
28
28
|
$.jqplot.config.enablePlugins = true;
|
@@ -128,7 +128,7 @@
|
|
128
128
|
<div class="footer_content">
|
129
129
|
<div id="foot_lefts" class="foot_left">
|
130
130
|
<img src="/console/images/foot_logo_rhosync.png"></a>
|
131
|
-
<p>©
|
131
|
+
<p>© <a href="http://www.rhomobile.com/">Rhomobile</a> All rights reserved.</p>
|
132
132
|
</div>
|
133
133
|
<div class="foot_right">
|
134
134
|
<ul class="ul_footer">
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<h1>New user</h1>
|
2
2
|
<%=show_errors%>
|
3
|
-
<form action="<%=
|
3
|
+
<form action="<%=url_path('/user/create')%>" method='POST'>
|
4
4
|
<table>
|
5
5
|
<tr>
|
6
6
|
<td>Login:</td>
|
@@ -13,5 +13,5 @@
|
|
13
13
|
</table>
|
14
14
|
<br/>
|
15
15
|
<input type='submit' value='Add'/>
|
16
|
-
<a href='javascript:void(0);' onclick="loadXMLDoc('<%=
|
16
|
+
<a href='javascript:void(0);' onclick="loadXMLDoc('<%=url_path('users')%>','main_box')">Back</a>
|
17
17
|
</form>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<h2>Upload document</h2>
|
2
2
|
<div class='panel'>
|
3
|
-
<form action='<%=
|
3
|
+
<form action='<%=url_path("doc/upload?#{@back_params}")%>' method='post' enctype="multipart/form-data">
|
4
4
|
<input type='hidden' name='doc' value='<%= "#{CGI.escape(params[:dbkey])}"%>'/>
|
5
5
|
<table>
|
6
6
|
<%if @is_string%>
|
@@ -1,27 +1,27 @@
|
|
1
1
|
<h1>User: <%=params[:user_id]%></h1>
|
2
2
|
<%=show_errors%>
|
3
3
|
<div class="panel">
|
4
|
-
<a href='<%=
|
4
|
+
<a href='<%=url_path("user/delete?user_id=#{CGI.escape(params[:user_id])}")%>' class='nav_button'>Delete user</a>
|
5
5
|
</div>
|
6
6
|
<div class="panel">
|
7
|
-
<a href='<%=
|
7
|
+
<a href='<%=url_path("user/ping?user_id=#{CGI.escape(params[:user_id])}")%>' class='nav_button'>Ping User</a>
|
8
8
|
</div>
|
9
9
|
<h2>User partition sources</h2>
|
10
10
|
|
11
11
|
[
|
12
12
|
<%@sources.each_index do |i|%>
|
13
|
-
<a href='javascript:void(0);' onclick="loadXMLDoc('<%=
|
13
|
+
<a href='javascript:void(0);' onclick="loadXMLDoc('<%=url_path("docs?source_id=#{@sources[i]}&user_id=#{CGI.escape(params[:user_id])}")%>','main_box');"><%=i==0?'':','%>"<%=@sources[i]%>"</a>
|
14
14
|
<%end%>
|
15
15
|
]
|
16
16
|
|
17
17
|
<h2>Registered Devices</h2>
|
18
18
|
|
19
|
-
<a href="javascript:void(0);" onclick="loadXMLDoc('<%=
|
19
|
+
<a href="javascript:void(0);" onclick="loadXMLDoc('<%=url_path("device/create?user_id=#{CGI.escape(params[:user_id])}")%>','');loadXMLDoc('<%=url_path("user?user_id=#{CGI.escape(params[:user_id])}")%>','main_box');" class='nav_button'>Create Device</a>
|
20
20
|
|
21
21
|
<div class="panel">
|
22
22
|
[
|
23
23
|
<%@devices.each_index do |i|%>
|
24
|
-
<a href="javascript:void(0);" onclick="loadXMLDoc('<%=
|
24
|
+
<a href="javascript:void(0);" onclick="loadXMLDoc('<%=url_path("device?user_id=#{CGI.escape(params[:user_id])}&device_id=#{CGI.escape(@devices[i])}")%>','main_box');">
|
25
25
|
<%=i==0?'':','%>"<%=@devices[i]%>"
|
26
26
|
</a>
|
27
27
|
<%end%>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<a href="javascript:void(0);" onclick="loadXMLDoc('<%=
|
1
|
+
<a href="javascript:void(0);" onclick="loadXMLDoc('<%=url_path('user/new')%>','main_box');" class='nav_button'>Create User</a>
|
2
2
|
|
3
3
|
<h2>Registered users</h2>
|
4
4
|
<%if is_errors?%>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<%else%>
|
7
7
|
[
|
8
8
|
<%@users.each_index do |i|%>
|
9
|
-
<a href="javascript:void(0);" onclick="loadXMLDoc('<%=
|
9
|
+
<a href="javascript:void(0);" onclick="loadXMLDoc('<%=url_path("user?user_id=#{CGI.escape(@users[i])}")%>','main_box');"><%=i==0?'':','%>"<%=@users[i]%>"</a>
|
10
10
|
<%end%>
|
11
11
|
]
|
12
12
|
<%end%>
|
data/lib/rhosync/server.rb
CHANGED
@@ -112,7 +112,9 @@ module Rhosync
|
|
112
112
|
def current_client
|
113
113
|
if @client.nil? and params[:client_id]
|
114
114
|
@client = Client.load(params[:client_id].to_s,
|
115
|
-
params[:source_name] ? {:source_name => current_source.name} : {:source_name => '*'})
|
115
|
+
params[:source_name] ? {:source_name => current_source.name} : {:source_name => '*'})
|
116
|
+
@client.switch_user(current_user.login) unless @client.user_id == current_user.login
|
117
|
+
@client
|
116
118
|
end
|
117
119
|
end
|
118
120
|
|
@@ -164,7 +166,8 @@ module Rhosync
|
|
164
166
|
params.delete("cud")
|
165
167
|
params.merge!(cud)
|
166
168
|
end
|
167
|
-
|
169
|
+
#application/json; charset=UTF-8
|
170
|
+
if request.env['CONTENT_TYPE'] && request.env['CONTENT_TYPE'].match(/^application\/json/)
|
168
171
|
params.merge!(JSON.parse(request.body.read))
|
169
172
|
request.body.rewind
|
170
173
|
end
|
data/lib/rhosync/tasks.rb
CHANGED
@@ -272,6 +272,16 @@ namespace :rhosync do
|
|
272
272
|
puts "Aborted..."
|
273
273
|
end
|
274
274
|
end
|
275
|
+
|
276
|
+
desc "Generate a cryptographically secure secret session key"
|
277
|
+
task :secret do
|
278
|
+
begin
|
279
|
+
require 'securerandom'
|
280
|
+
puts SecureRandom.hex(64)
|
281
|
+
rescue LoadError
|
282
|
+
puts "Missing secure random generator. Try running `rake secret` in a rails application instead."
|
283
|
+
end
|
284
|
+
end
|
275
285
|
end
|
276
286
|
|
277
287
|
task :default => ['rhosync:spec']
|
data/lib/rhosync/version.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -53,6 +53,18 @@ describe "Client" do
|
|
53
53
|
verify_result(docname => {})
|
54
54
|
end
|
55
55
|
|
56
|
+
it "should switch client user and remove existing documents" do
|
57
|
+
docname = @c.docname(:cd)
|
58
|
+
set_state(docname => @data)
|
59
|
+
verify_result(@c.docname(:cd) => @data)
|
60
|
+
User.create({:login => 'user2'})
|
61
|
+
@c.switch_user('user2')
|
62
|
+
verify_result(@c.docname(:cd) => {},docname => {})
|
63
|
+
@u.clients.members.should == []
|
64
|
+
@c.user_id.should == 'user2'
|
65
|
+
User.load('user2').clients.members.should == [@c.id]
|
66
|
+
end
|
67
|
+
|
56
68
|
it "should create cd as masterdoc clone" do
|
57
69
|
set_state(@s.docname(:md_copy) => @data,
|
58
70
|
@c.docname(:cd) => {'foo' => {'bar' => 'abc'}})
|
data/spec/server/server_spec.rb
CHANGED
@@ -39,9 +39,23 @@ describe "Server" do
|
|
39
39
|
end
|
40
40
|
|
41
41
|
it "should login without app_name" do
|
42
|
-
|
42
|
+
do_post "/login", "login" => @u_fields[:login], "password" => 'testpass'
|
43
43
|
last_response.should be_ok
|
44
44
|
end
|
45
|
+
|
46
|
+
it "should login if content-type contains extra parameters" do
|
47
|
+
User.load('new_user').should be_nil
|
48
|
+
post "/login", {"login" => 'new_user', "password" => 'testpass'}.to_json, {'CONTENT_TYPE'=>'application/json; charset=UTF-8'}
|
49
|
+
last_response.should be_ok
|
50
|
+
User.load('new_user').should_not be_nil
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should failt to login if wrong content-type" do
|
54
|
+
User.load('unknown').should be_nil
|
55
|
+
post "/login", {"login" => 'unknown', "password" => 'testpass'}.to_json, {'CONTENT_TYPE'=>'application/x-www-form-urlencoded'}
|
56
|
+
last_response.should be_ok
|
57
|
+
User.load('unknown').should be_nil
|
58
|
+
end
|
45
59
|
|
46
60
|
it "should login as rhoadmin user" do
|
47
61
|
post "/login", "login" => 'rhoadmin', "password" => ''
|
@@ -164,6 +178,17 @@ describe "Server" do
|
|
164
178
|
JSON.parse(last_response.body).should == @source_config
|
165
179
|
verify_result(@c.docname(:cd) => {})
|
166
180
|
end
|
181
|
+
|
182
|
+
it "should switch client user if client user_id doesn't match session user" do
|
183
|
+
set_test_data('test_db_storage',@data)
|
184
|
+
get "/application",:client_id => @c.id,:source_name => @s.name,:version => ClientSync::VERSION
|
185
|
+
JSON.parse(last_response.body).last['insert'].should == @data
|
186
|
+
do_post "/application/clientlogin", "login" => 'user2', "password" => 'testpass'
|
187
|
+
data = {'1'=>@product1,'2'=>@product2}
|
188
|
+
set_test_data('test_db_storage',data)
|
189
|
+
get "/application",:client_id => @c.id,:source_name => @s.name,:version => ClientSync::VERSION
|
190
|
+
JSON.parse(last_response.body).last['insert'].should == data
|
191
|
+
end
|
167
192
|
end
|
168
193
|
|
169
194
|
describe "source routes" do
|
@@ -252,7 +277,7 @@ describe "Server" do
|
|
252
277
|
last_response.status.should == 500
|
253
278
|
last_response.body.should == "ERROR: Source 'Broken' requested by client doesn't exist.\n"
|
254
279
|
end
|
255
|
-
|
280
|
+
|
256
281
|
it "should get deletes json" do
|
257
282
|
cs = ClientSync.new(@s,@c,1)
|
258
283
|
data = {'1'=>@product1,'2'=>@product2}
|
data/spec/store_spec.rb
CHANGED
@@ -45,6 +45,12 @@ describe "Store" do
|
|
45
45
|
Store.get_data('foo').should == @data
|
46
46
|
end
|
47
47
|
|
48
|
+
it "should put_data with simple data" do
|
49
|
+
data = { '1' => { 'hello' => 'world' } }
|
50
|
+
Store.put_data('mydata', data)
|
51
|
+
Store.get_data('mydata').should == data
|
52
|
+
end
|
53
|
+
|
48
54
|
it "should add simple array data to new set" do
|
49
55
|
@data = ['1','2','3']
|
50
56
|
Store.put_data(@s.docname(:md),@data).should == true
|
data/tasks/redis.rake
CHANGED
@@ -7,7 +7,7 @@ def windows?
|
|
7
7
|
end
|
8
8
|
|
9
9
|
if windows?
|
10
|
-
$redis_ver = "redis-
|
10
|
+
$redis_ver = "redis-2.2.2"
|
11
11
|
$redis_zip = "C:/#{$redis_ver}.zip"
|
12
12
|
$redis_dest = "C:/"
|
13
13
|
end
|
@@ -39,7 +39,7 @@ class RedisRunner
|
|
39
39
|
server_dir = File.dirname(`which redis-server`)
|
40
40
|
conf_file = "#{RedisRunner.prefix}etc/redis.conf"
|
41
41
|
unless File.exists? conf_file
|
42
|
-
conf_file = "#{
|
42
|
+
conf_file = "#{server_dir}/redis.conf"
|
43
43
|
end
|
44
44
|
conf_file
|
45
45
|
end
|
@@ -112,7 +112,7 @@ namespace :redis do
|
|
112
112
|
mk_bin_dir(bin_dir)
|
113
113
|
|
114
114
|
%w(redis-benchmark redis-cli redis-server).each do |bin|
|
115
|
-
sh "cp /tmp/redis/#{bin} #{bin_dir}"
|
115
|
+
sh "cp /tmp/redis/src/#{bin} #{bin_dir}"
|
116
116
|
end
|
117
117
|
|
118
118
|
puts "Installed redis-benchmark, redis-cli and redis-server to #{bin_dir}"
|
@@ -136,31 +136,32 @@ namespace :redis do
|
|
136
136
|
desc "Download package"
|
137
137
|
task :download do
|
138
138
|
if windows?
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
resp = http.get("/files/#{$redis_ver}.zip")
|
139
|
+
require 'net/http'
|
140
|
+
require 'zip/zip'
|
141
|
+
puts "Installing redis to #{redis_home}."
|
142
|
+
|
143
|
+
Net::HTTP.start("cloud.github.com") do |http|
|
144
|
+
resp = http.get("/downloads/dmajkic/redis/#{$redis_ver}-win32-win64.zip")
|
146
145
|
open($redis_zip, "wb") do |file|
|
147
146
|
file.write(resp.body)
|
148
147
|
end
|
149
148
|
end
|
150
|
-
|
149
|
+
|
151
150
|
Zip::ZipFile.open($redis_zip) do |zip_file|
|
152
151
|
zip_file.each do |f|
|
153
|
-
f_path = File.join(
|
152
|
+
f_path = File.join(redis_home, f.name)
|
154
153
|
FileUtils.mkdir_p(File.dirname(f_path))
|
155
154
|
zip_file.extract(f, f_path) { true }
|
156
155
|
end
|
157
156
|
end
|
158
|
-
|
157
|
+
|
158
|
+
FileUtils.mv Dir.glob(File.join(redis_home,'32bit','*')), redis_home
|
159
|
+
FileUtils.rm_rf File.join(redis_home, '64bit')
|
159
160
|
FileUtils.rm_f $redis_zip
|
160
161
|
else
|
161
162
|
sh 'rm -rf /tmp/redis/' if File.exists?("#{RedisRunner.redisdir}")
|
162
163
|
sh 'git clone git://github.com/antirez/redis.git /tmp/redis -n'
|
163
|
-
sh "cd #{RedisRunner.redisdir} && git reset --hard && git checkout
|
164
|
+
sh "cd #{RedisRunner.redisdir} && git reset --hard && git checkout 2.2.2"
|
164
165
|
end
|
165
166
|
end
|
166
167
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rhosync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 2.1.
|
9
|
+
- 2
|
10
|
+
version: 2.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Rhomobile
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-03-18 00:00:00 -07:00
|
19
19
|
default_executable: rhosync
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -34,26 +34,10 @@ dependencies:
|
|
34
34
|
version: 1.4.2
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: log4r
|
39
|
-
prerelease: false
|
40
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
hash: 29
|
46
|
-
segments:
|
47
|
-
- 1
|
48
|
-
- 1
|
49
|
-
- 7
|
50
|
-
version: 1.1.7
|
51
|
-
type: :runtime
|
52
|
-
version_requirements: *id002
|
53
37
|
- !ruby/object:Gem::Dependency
|
54
38
|
name: sqlite3-ruby
|
55
39
|
prerelease: false
|
56
|
-
requirement: &
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
57
41
|
none: false
|
58
42
|
requirements:
|
59
43
|
- - ~>
|
@@ -65,11 +49,11 @@ dependencies:
|
|
65
49
|
- 5
|
66
50
|
version: 1.2.5
|
67
51
|
type: :runtime
|
68
|
-
version_requirements: *
|
52
|
+
version_requirements: *id002
|
69
53
|
- !ruby/object:Gem::Dependency
|
70
54
|
name: rubyzip
|
71
55
|
prerelease: false
|
72
|
-
requirement: &
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
73
57
|
none: false
|
74
58
|
requirements:
|
75
59
|
- - ~>
|
@@ -81,11 +65,11 @@ dependencies:
|
|
81
65
|
- 4
|
82
66
|
version: 0.9.4
|
83
67
|
type: :runtime
|
84
|
-
version_requirements: *
|
68
|
+
version_requirements: *id003
|
85
69
|
- !ruby/object:Gem::Dependency
|
86
70
|
name: uuidtools
|
87
71
|
prerelease: false
|
88
|
-
requirement: &
|
72
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
89
73
|
none: false
|
90
74
|
requirements:
|
91
75
|
- - ">="
|
@@ -97,74 +81,74 @@ dependencies:
|
|
97
81
|
- 1
|
98
82
|
version: 2.1.1
|
99
83
|
type: :runtime
|
100
|
-
version_requirements: *
|
84
|
+
version_requirements: *id004
|
101
85
|
- !ruby/object:Gem::Dependency
|
102
86
|
name: redis
|
103
87
|
prerelease: false
|
104
|
-
requirement: &
|
88
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
105
89
|
none: false
|
106
90
|
requirements:
|
107
91
|
- - ~>
|
108
92
|
- !ruby/object:Gem::Version
|
109
|
-
hash:
|
93
|
+
hash: 9
|
110
94
|
segments:
|
111
95
|
- 2
|
112
|
-
-
|
113
|
-
-
|
114
|
-
version: 2.
|
96
|
+
- 1
|
97
|
+
- 1
|
98
|
+
version: 2.1.1
|
115
99
|
type: :runtime
|
116
|
-
version_requirements: *
|
100
|
+
version_requirements: *id005
|
117
101
|
- !ruby/object:Gem::Dependency
|
118
102
|
name: resque
|
119
103
|
prerelease: false
|
120
|
-
requirement: &
|
104
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
121
105
|
none: false
|
122
106
|
requirements:
|
123
|
-
- -
|
107
|
+
- - ~>
|
124
108
|
- !ruby/object:Gem::Version
|
125
|
-
hash:
|
109
|
+
hash: 47
|
126
110
|
segments:
|
127
111
|
- 1
|
128
|
-
-
|
129
|
-
-
|
130
|
-
version: 1.
|
112
|
+
- 14
|
113
|
+
- 0
|
114
|
+
version: 1.14.0
|
131
115
|
type: :runtime
|
132
|
-
version_requirements: *
|
116
|
+
version_requirements: *id006
|
133
117
|
- !ruby/object:Gem::Dependency
|
134
118
|
name: rest-client
|
135
119
|
prerelease: false
|
136
|
-
requirement: &
|
120
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
137
121
|
none: false
|
138
122
|
requirements:
|
139
|
-
- -
|
123
|
+
- - ~>
|
140
124
|
- !ruby/object:Gem::Version
|
141
|
-
hash:
|
125
|
+
hash: 13
|
142
126
|
segments:
|
143
127
|
- 1
|
144
|
-
-
|
145
|
-
-
|
146
|
-
version: 1.
|
128
|
+
- 6
|
129
|
+
- 1
|
130
|
+
version: 1.6.1
|
147
131
|
type: :runtime
|
148
|
-
version_requirements: *
|
132
|
+
version_requirements: *id007
|
149
133
|
- !ruby/object:Gem::Dependency
|
150
134
|
name: sinatra
|
151
135
|
prerelease: false
|
152
|
-
requirement: &
|
136
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
153
137
|
none: false
|
154
138
|
requirements:
|
155
139
|
- - ~>
|
156
140
|
- !ruby/object:Gem::Version
|
157
|
-
hash:
|
141
|
+
hash: 11
|
158
142
|
segments:
|
159
143
|
- 1
|
160
|
-
-
|
161
|
-
version: "1.
|
144
|
+
- 2
|
145
|
+
version: "1.2"
|
162
146
|
type: :runtime
|
163
|
-
version_requirements: *
|
147
|
+
version_requirements: *id008
|
164
148
|
- !ruby/object:Gem::Dependency
|
165
149
|
name: templater
|
166
150
|
prerelease: false
|
167
|
-
requirement: &
|
151
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
168
152
|
none: false
|
169
153
|
requirements:
|
170
154
|
- - ~>
|
@@ -176,11 +160,11 @@ dependencies:
|
|
176
160
|
- 0
|
177
161
|
version: 1.0.0
|
178
162
|
type: :runtime
|
179
|
-
version_requirements: *
|
163
|
+
version_requirements: *id009
|
180
164
|
- !ruby/object:Gem::Dependency
|
181
165
|
name: rake
|
182
166
|
prerelease: false
|
183
|
-
requirement: &
|
167
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
184
168
|
none: false
|
185
169
|
requirements:
|
186
170
|
- - ">="
|
@@ -192,6 +176,22 @@ dependencies:
|
|
192
176
|
- 7
|
193
177
|
version: 0.8.7
|
194
178
|
type: :runtime
|
179
|
+
version_requirements: *id010
|
180
|
+
- !ruby/object:Gem::Dependency
|
181
|
+
name: log4r
|
182
|
+
prerelease: false
|
183
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
184
|
+
none: false
|
185
|
+
requirements:
|
186
|
+
- - ~>
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
hash: 29
|
189
|
+
segments:
|
190
|
+
- 1
|
191
|
+
- 1
|
192
|
+
- 7
|
193
|
+
version: 1.1.7
|
194
|
+
type: :development
|
195
195
|
version_requirements: *id011
|
196
196
|
- !ruby/object:Gem::Dependency
|
197
197
|
name: jeweler
|
@@ -300,6 +300,7 @@ extra_rdoc_files:
|
|
300
300
|
- README.md
|
301
301
|
files:
|
302
302
|
- CHANGELOG
|
303
|
+
- CREDITS
|
303
304
|
- LICENSE
|
304
305
|
- README.md
|
305
306
|
- Rakefile
|
@@ -573,7 +574,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
573
574
|
requirements: []
|
574
575
|
|
575
576
|
rubyforge_project:
|
576
|
-
rubygems_version: 1.
|
577
|
+
rubygems_version: 1.5.0
|
577
578
|
signing_key:
|
578
579
|
specification_version: 3
|
579
580
|
summary: RhoSync Synchronization Framework
|