socky-client-rails 0.4.2 → 0.4.3
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.md +8 -0
- data/VERSION +1 -1
- data/generators/socky/socky_generator.rb +10 -0
- data/generators/socky/templates/socky.rake +5 -0
- data/lib/tasks/socky-client-rails.rake +45 -33
- metadata +5 -5
- data/assets/socky/WebSocketMain.swf +0 -0
- data/assets/socky.js +0 -1604
data/CHANGELOG.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.3
|
@@ -1,8 +1,14 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
SOCKY_JS_VERSION = File.read(File.dirname(__FILE__) + '/../../VERSION').strip.split('.')[0,2].join('.')
|
4
|
+
SOCKY_JS_SERVER = 'https://github.com/socky/socky-js/raw'
|
5
|
+
SOCKY_JS_DEST = Rails.root.join('public', 'javascripts').to_s
|
6
|
+
SOCKY_JS_FILES = {
|
7
|
+
'socky.js' => 'socky.js',
|
8
|
+
'WebSocketMain.swf' => 'socky/WebSocketMain.swf'
|
9
|
+
}
|
10
|
+
|
11
|
+
CONFIG_PATH = File.join(File.dirname(__FILE__), '..', '..', 'assets', 'socky_hosts.yml')
|
6
12
|
|
7
13
|
namespace :socky do
|
8
14
|
desc 'Install the Socky scripts and create configuration file'
|
@@ -15,56 +21,62 @@ namespace :socky do
|
|
15
21
|
task :uninstall => [:remove_scripts]
|
16
22
|
|
17
23
|
task :create_config do
|
18
|
-
source = SOURCE_PREFIX + '/socky_hosts.yml'
|
19
24
|
dest = Rails.root.join('config', 'socky_hosts.yml').to_s
|
20
25
|
if File.exists?(dest)
|
21
|
-
puts "Removing #{dest}."
|
22
26
|
FileUtils.rm_rf dest
|
23
27
|
end
|
24
28
|
begin
|
25
|
-
puts "Copying
|
26
|
-
FileUtils.cp_r
|
27
|
-
puts "
|
29
|
+
puts "Copying config..."
|
30
|
+
FileUtils.cp_r CONFIG_PATH, dest
|
31
|
+
puts "Done"
|
28
32
|
rescue
|
29
|
-
puts "ERROR: Problem creating config. Please manually copy " +
|
33
|
+
puts "ERROR: Problem creating config. Please manually copy " + CONFIG_PATH + " => " + dest
|
30
34
|
end
|
31
35
|
end
|
32
36
|
|
33
37
|
|
34
38
|
task :create_scripts do
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
if File.exists?(dest)
|
39
|
-
puts "Removing #{dest}."
|
40
|
-
FileUtils.rm_rf dest
|
41
|
-
end
|
39
|
+
require 'open-uri'
|
40
|
+
puts 'Downloading files...'
|
41
|
+
SOCKY_JS_FILES.each do |source, dest|
|
42
42
|
begin
|
43
|
-
|
44
|
-
|
45
|
-
puts
|
43
|
+
uri = URI.parse(SOCKY_JS_SERVER + '/v' + SOCKY_JS_VERSION + '-stable/' + source)
|
44
|
+
file = File.join(SOCKY_JS_DEST, dest)
|
45
|
+
puts ' + ' + dest
|
46
|
+
FileUtils.mkdir_p(File.dirname(file))
|
47
|
+
open(uri) do |data|
|
48
|
+
open(file, "wb") do |f|
|
49
|
+
f.write(data.read)
|
50
|
+
end
|
51
|
+
end
|
46
52
|
rescue
|
47
|
-
puts "ERROR: Problem
|
53
|
+
puts "ERROR: Problem downloading script. Please manually copy " + uri.to_s + " => " + file
|
54
|
+
end
|
55
|
+
end
|
56
|
+
script_file = File.join(SOCKY_JS_DEST, 'socky.js').to_s
|
57
|
+
if File.exists?(script_file)
|
58
|
+
puts 'Updating assets info'
|
59
|
+
text = File.read(script_file)
|
60
|
+
open(script_file, 'wb') do |f|
|
61
|
+
f.write text.gsub('WEB_SOCKET_SWF_LOCATION = "WebSocketMain.swf"', 'WEB_SOCKET_SWF_LOCATION = "/javascripts/socky/WebSocketMain.swf"')
|
48
62
|
end
|
49
63
|
end
|
64
|
+
puts "Done"
|
50
65
|
end
|
51
66
|
|
52
67
|
task :remove_scripts do
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
FileUtils.rm_rf
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
end
|
63
|
-
else
|
64
|
-
puts "ERROR: #{dest} not found."
|
68
|
+
puts 'Removing files...'
|
69
|
+
SOCKY_JS_FILES.each do |source, dest|
|
70
|
+
file = SOCKY_JS_DEST + dest
|
71
|
+
if File.exists?(file)
|
72
|
+
begin
|
73
|
+
FileUtils.rm_rf file
|
74
|
+
rescue
|
75
|
+
puts "ERROR: Problem removing #{file}. Please remove manually."
|
76
|
+
end
|
65
77
|
end
|
66
78
|
end
|
67
79
|
puts "Successfully removed Socky."
|
68
80
|
end
|
69
81
|
|
70
|
-
end
|
82
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: socky-client-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 3
|
10
|
+
version: 0.4.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Bernard Potocki
|
@@ -62,9 +62,9 @@ files:
|
|
62
62
|
- README.md
|
63
63
|
- Rakefile
|
64
64
|
- VERSION
|
65
|
-
- assets/socky.js
|
66
|
-
- assets/socky/WebSocketMain.swf
|
67
65
|
- assets/socky_hosts.yml
|
66
|
+
- generators/socky/socky_generator.rb
|
67
|
+
- generators/socky/templates/socky.rake
|
68
68
|
- init.rb
|
69
69
|
- lib/socky-client-rails.rb
|
70
70
|
- lib/socky-client-rails/helper.rb
|
Binary file
|