bigbluebutton_rails 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/CHANGELOG.rdoc +12 -0
- data/Gemfile.lock +53 -14
- data/README.rdoc +31 -29
- data/Rakefile +63 -11
- data/app/controllers/bigbluebutton/rooms_controller.rb +89 -26
- data/app/controllers/bigbluebutton/servers_controller.rb +38 -5
- data/app/helpers/bigbluebutton_rails_helper.rb +12 -0
- data/app/models/bigbluebutton_room.rb +44 -1
- data/app/models/bigbluebutton_server.rb +48 -12
- data/app/views/bigbluebutton/rooms/_form.html.erb +8 -0
- data/app/views/bigbluebutton/rooms/index.html.erb +34 -43
- data/app/views/bigbluebutton/rooms/join_mobile.html.erb +9 -0
- data/app/views/bigbluebutton/rooms/show.html.erb +8 -0
- data/app/views/bigbluebutton/servers/_activity_list.html.erb +48 -0
- data/app/views/bigbluebutton/servers/_form.html.erb +4 -0
- data/app/views/bigbluebutton/servers/activity.html.erb +51 -0
- data/app/views/bigbluebutton/servers/index.html.erb +21 -25
- data/app/views/bigbluebutton/servers/show.html.erb +5 -0
- data/bigbluebutton_rails.gemspec +9 -6
- data/config/locales/en.yml +11 -2
- data/lib/bigbluebutton_rails/controller_methods.rb +47 -14
- data/lib/bigbluebutton_rails/exceptions.rb +6 -0
- data/lib/bigbluebutton_rails/rails/routes.rb +17 -12
- data/lib/bigbluebutton_rails/rails.rb +4 -0
- data/lib/bigbluebutton_rails/version.rb +1 -1
- data/lib/bigbluebutton_rails.rb +1 -0
- data/lib/generators/bigbluebutton_rails/install_generator.rb +28 -5
- data/lib/generators/bigbluebutton_rails/templates/migration.rb +3 -0
- data/lib/generators/bigbluebutton_rails/templates/migration_0_0_4.rb +38 -0
- data/lib/generators/bigbluebutton_rails/templates/migration_0_0_5.rb +23 -0
- data/{lib/generators/bigbluebutton_rails/templates/public → public}/images/loading.gif +0 -0
- data/{lib/generators/bigbluebutton_rails/templates/public → public}/javascripts/jquery.min.js +0 -0
- data/public/stylesheets/bigbluebutton_rails.css +138 -0
- data/spec/controllers/bigbluebutton/rooms_controller_spec.rb +284 -25
- data/spec/controllers/bigbluebutton/servers_controller_spec.rb +93 -1
- data/spec/factories/bigbluebutton_room.rb +1 -0
- data/spec/factories/bigbluebutton_server.rb +1 -0
- data/spec/factories/integration/bigbluebutton_server_integration.rb +8 -0
- data/spec/generators/install_generator_spec.rb +53 -10
- data/spec/generators/views_generator_spec.rb +6 -2
- data/spec/helpers/bigbluebutton_rails_helper_spec.rb +19 -0
- data/spec/integration_conf.yml.example +5 -0
- data/spec/models/bigbluebutton_room_spec.rb +99 -72
- data/spec/models/bigbluebutton_server_spec.rb +81 -20
- data/spec/rails_app/.gitignore +2 -1
- data/spec/rails_app/app/views/layouts/application.html.erb +1 -1
- data/spec/rails_app/config/cucumber.yml +8 -0
- data/spec/rails_app/config/database.yml +4 -1
- data/spec/rails_app/db/seeds.rb +6 -5
- data/spec/rails_app/features/manage_bigbluebutton_rooms.feature +9 -0
- data/spec/rails_app/features/manage_bigbluebutton_servers.feature +9 -0
- data/spec/rails_app/features/step_definitions/bigbluebutton_room_steps.rb +38 -0
- data/spec/rails_app/features/step_definitions/bigbluebutton_server_steps.rb +23 -0
- data/spec/rails_app/features/step_definitions/common_steps.rb +3 -0
- data/spec/rails_app/features/step_definitions/web_steps.rb +211 -0
- data/spec/rails_app/features/support/content.rb +11 -0
- data/spec/rails_app/features/support/env.rb +50 -0
- data/spec/rails_app/features/support/env_gem.rb +9 -0
- data/spec/rails_app/features/support/paths.rb +38 -0
- data/spec/rails_app/features/support/selectors.rb +39 -0
- data/spec/rails_app/lib/tasks/cucumber.rake +65 -0
- data/spec/rails_app/public/images/loading.gif +0 -0
- data/spec/rails_app/public/javascripts/jquery.min.js +16 -0
- data/spec/rails_app/public/stylesheets/bigbluebutton_rails.css +138 -0
- data/spec/rails_app/script/cucumber +10 -0
- data/spec/routing/bigbluebutton/rooms_routing_spec.rb +12 -0
- data/spec/spec_helper.rb +0 -1
- data/spec/support/integration/integration_conf.rb +16 -0
- data/spec/support/matchers/shoulda/respond_with_json_matcher.rb +67 -0
- data/spec/support/mocked_server.rb +1 -0
- metadata +91 -29
- data/lib/generators/bigbluebutton_rails/public_generator.rb +0 -16
- data/spec/generators/public_generator_spec.rb +0 -31
data/.gitignore
CHANGED
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
== 0.0.5
|
2
|
+
|
3
|
+
* URLs for both servers and rooms are now defined with a string attribute (called "param") instead of the model ID.
|
4
|
+
* New return values for bigbluebutton_role: :password and nil.
|
5
|
+
* Private rooms now require a password to be valid.
|
6
|
+
* New action "join_mobile" for rooms that renders a QR code to join the conference using the protocol "bigbluebutton://".
|
7
|
+
* New action "activity" for servers that shows a view to monitors a BBB server.
|
8
|
+
* Added json responses for most of the actions.
|
9
|
+
* logout_url can be an incomplete url and it will be completed with the current domain/protocol when a room is created in the BBB server.
|
10
|
+
* The generator bigbluebutton_rails:public was removed. It's features are now inside bigbluebutton_rails:install.
|
11
|
+
* After fetch_meetings all rooms are automatically stored in the DB if they are not there yet.
|
12
|
+
|
1
13
|
== 0.0.4
|
2
14
|
|
3
15
|
* A random voice_bridge with 5 digits (recommended) is set when a room is created.
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
bigbluebutton_rails (0.0.
|
4
|
+
bigbluebutton_rails (0.0.5)
|
5
5
|
bigbluebutton-api-ruby (~> 0.0.10)
|
6
|
-
rails (
|
6
|
+
rails (>= 3.0.3)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: http://rubygems.org/
|
@@ -39,16 +39,42 @@ GEM
|
|
39
39
|
bigbluebutton-api-ruby (0.0.10)
|
40
40
|
nokogiri (~> 1.4.0)
|
41
41
|
builder (2.1.2)
|
42
|
+
capybara (1.0.0)
|
43
|
+
mime-types (>= 1.16)
|
44
|
+
nokogiri (>= 1.3.3)
|
45
|
+
rack (>= 1.0.0)
|
46
|
+
rack-test (>= 0.5.4)
|
47
|
+
selenium-webdriver (~> 0.2.0)
|
48
|
+
xpath (~> 0.1.4)
|
49
|
+
childprocess (0.1.9)
|
50
|
+
ffi (~> 1.0.6)
|
51
|
+
cucumber (0.10.7)
|
52
|
+
builder (>= 2.1.2)
|
53
|
+
diff-lcs (>= 1.1.2)
|
54
|
+
gherkin (~> 2.4.0)
|
55
|
+
json (>= 1.4.6)
|
56
|
+
term-ansicolor (>= 1.0.5)
|
57
|
+
cucumber-rails (0.5.2)
|
58
|
+
capybara (>= 1.0.0.rc1)
|
59
|
+
cucumber (>= 0.10.5)
|
60
|
+
nokogiri (>= 1.4.4)
|
61
|
+
rack-test (>= 0.5.7)
|
62
|
+
database_cleaner (0.6.7)
|
42
63
|
diff-lcs (1.1.2)
|
43
64
|
erubis (2.6.6)
|
44
65
|
abstract (>= 1.0.0)
|
45
66
|
factory_girl (1.3.3)
|
67
|
+
ffi (1.0.9)
|
46
68
|
forgery (0.3.7)
|
47
69
|
nokogiri (~> 1.4)
|
48
70
|
generator_spec (0.8.2)
|
49
71
|
rails (~> 3.0)
|
50
72
|
rspec-rails
|
73
|
+
gherkin (2.4.0)
|
74
|
+
json (>= 1.4.6)
|
51
75
|
i18n (0.5.0)
|
76
|
+
json (1.5.2)
|
77
|
+
json_pure (1.5.2)
|
52
78
|
mail (2.2.15)
|
53
79
|
activesupport (>= 2.3.6)
|
54
80
|
i18n (>= 0.4.0)
|
@@ -57,7 +83,7 @@ GEM
|
|
57
83
|
mime-types (1.16)
|
58
84
|
nokogiri (1.4.4)
|
59
85
|
polyglot (0.3.1)
|
60
|
-
rack (1.2.
|
86
|
+
rack (1.2.3)
|
61
87
|
rack-mount (0.6.14)
|
62
88
|
rack (>= 1.0.0)
|
63
89
|
rack-test (0.5.7)
|
@@ -76,36 +102,49 @@ GEM
|
|
76
102
|
rake (>= 0.8.7)
|
77
103
|
thor (~> 0.14.4)
|
78
104
|
rake (0.8.7)
|
79
|
-
|
80
|
-
|
81
|
-
rspec-
|
82
|
-
rspec-
|
83
|
-
|
84
|
-
rspec-
|
105
|
+
rdoc (3.6.1)
|
106
|
+
rspec (2.6.0)
|
107
|
+
rspec-core (~> 2.6.0)
|
108
|
+
rspec-expectations (~> 2.6.0)
|
109
|
+
rspec-mocks (~> 2.6.0)
|
110
|
+
rspec-core (2.6.4)
|
111
|
+
rspec-expectations (2.6.0)
|
85
112
|
diff-lcs (~> 1.1.2)
|
86
|
-
rspec-mocks (2.
|
87
|
-
rspec-rails (2.
|
113
|
+
rspec-mocks (2.6.0)
|
114
|
+
rspec-rails (2.6.1)
|
88
115
|
actionpack (~> 3.0)
|
89
116
|
activesupport (~> 3.0)
|
90
117
|
railties (~> 3.0)
|
91
|
-
rspec (~> 2.
|
118
|
+
rspec (~> 2.6.0)
|
119
|
+
rubyzip (0.9.4)
|
120
|
+
selenium-webdriver (0.2.1)
|
121
|
+
childprocess (>= 0.1.7)
|
122
|
+
ffi (>= 1.0.7)
|
123
|
+
json_pure
|
124
|
+
rubyzip
|
92
125
|
shoulda-matchers (1.0.0.beta2)
|
93
126
|
sqlite3 (1.3.3)
|
94
127
|
sqlite3-ruby (1.3.3)
|
95
128
|
sqlite3 (>= 1.3.3)
|
129
|
+
term-ansicolor (1.0.5)
|
96
130
|
thor (0.14.6)
|
97
131
|
treetop (1.4.9)
|
98
132
|
polyglot (>= 0.3.1)
|
99
|
-
tzinfo (0.3.
|
133
|
+
tzinfo (0.3.28)
|
134
|
+
xpath (0.1.4)
|
135
|
+
nokogiri (~> 1.3)
|
100
136
|
|
101
137
|
PLATFORMS
|
102
138
|
ruby
|
103
139
|
|
104
140
|
DEPENDENCIES
|
105
141
|
bigbluebutton_rails!
|
142
|
+
cucumber-rails (~> 0.5.2)
|
143
|
+
database_cleaner (~> 0.6.7)
|
106
144
|
factory_girl (~> 1.3.2)
|
107
145
|
forgery (~> 0.3.7)
|
108
146
|
generator_spec (~> 0.8.2)
|
109
|
-
|
147
|
+
rdoc (~> 3.6.0)
|
148
|
+
rspec-rails (~> 2.6.0)
|
110
149
|
shoulda-matchers (~> 1.0.0.beta)
|
111
150
|
sqlite3-ruby (~> 1.3.3)
|
data/README.rdoc
CHANGED
@@ -4,19 +4,20 @@
|
|
4
4
|
|
5
5
|
Features:
|
6
6
|
* Allows multiple servers and multiple conference rooms
|
7
|
-
* Full API access using bigbluebutton-api-ruby
|
7
|
+
* Full API access using {bigbluebutton-api-ruby}[https://github.com/mconf/bigbluebutton-api-ruby]
|
8
8
|
* Easy way to join conferences: simply create a room and call the "join" action
|
9
9
|
* Easy integration with authentication and authorization mechanisms, such as Devise and CanCan
|
10
10
|
* Possibility to create private rooms, that require a password to join
|
11
11
|
* Deals with visitors (users that are not logged), allowing (or forbidding) them to join rooms
|
12
12
|
* Random meeting IDs to avoid problems with end_meeting, timeouts and reuse of URLs
|
13
|
+
* Server activity monitor
|
13
14
|
|
14
15
|
Planned features:
|
15
|
-
* Friendly URLs (e.g. http://somewhere.com/my-server/my-room)
|
16
|
+
* Friendly URLs (e.g. http://somewhere.com/my-server/my-room) (half way done)
|
16
17
|
* Limit the number of users per room and rooms per server
|
17
18
|
* Server administration (modify config.xml, use bbb-conf, etc.)
|
18
19
|
* Load balancing
|
19
|
-
*
|
20
|
+
* Decouple servers-rooms to allow server selection on-the-fly
|
20
21
|
|
21
22
|
For more future features and issues check {our google code page}[http://code.google.com/p/mconf/issues/list?can=2&q=label%3AComponent%20label%3ABigBlueButtonRails].
|
22
23
|
|
@@ -34,8 +35,9 @@ After installing, you need to run the generator:
|
|
34
35
|
|
35
36
|
rails generate bigbluebutton_rails:install
|
36
37
|
|
37
|
-
This generator will create a migration file
|
38
|
-
|
38
|
+
This generator will create a migration file, a language file and some additional resources. These additional files are basically the JQuery library,
|
39
|
+
a stylesheet and some images. They are only used in the *views* provided by this gem, so you may or may not use them. You can easily generate the views
|
40
|
+
and modify them to use other resources.
|
39
41
|
|
40
42
|
To now more about the generators see {How to: Generators}[https://github.com/mconf/bigbluebutton_rails/wiki/How-to:-Generators]
|
41
43
|
|
@@ -59,8 +61,8 @@ The first line generates the default routes. You need to call it at least once t
|
|
59
61
|
It generates routes scoped with 'bigbluebutton'. These routes look like:
|
60
62
|
|
61
63
|
/bigbluebutton/servers
|
62
|
-
/bigbluebutton/servers/
|
63
|
-
/bigbluebutton/servers/
|
64
|
+
/bigbluebutton/servers/default-server/rooms/my-room
|
65
|
+
/bigbluebutton/servers/default-server/rooms/his-room/join
|
64
66
|
|
65
67
|
You can customize the scope name and also make the routes point to custom controllers.
|
66
68
|
|
@@ -74,13 +76,16 @@ You may also want shorter routes to access conference rooms. For that, use the o
|
|
74
76
|
|
75
77
|
bigbluebutton_routes :room_matchers
|
76
78
|
|
77
|
-
It creates routes to the actions used to access the conference room: "show", "join", "auth", "running", "end", and "
|
79
|
+
It creates routes to the actions used to access the conference room: "show", "join", "auth", "running", "end", "invite", and "join_mobile".
|
78
80
|
So you can allow access to webconference rooms using URLs such as:
|
79
81
|
|
80
|
-
http://myserver.com/
|
81
|
-
http://myserver.com/
|
82
|
+
http://myserver.com/server-name/room-name/join
|
83
|
+
http://myserver.com/user-name/public-room/join
|
84
|
+
http://myserver.com/ziltoid-room/join
|
82
85
|
|
83
|
-
Obs:
|
86
|
+
Obs: The URLs are not yet exactly like these, but soon they will be. But you can of course implement this in your application. Today they are like:
|
87
|
+
|
88
|
+
http://myserver.com/bigblugbutton/server-name/rooms/room-name/join
|
84
89
|
|
85
90
|
=== User authorization, permissions and assumptions
|
86
91
|
|
@@ -100,21 +105,6 @@ and you can reimplement them in your application controller to change their beha
|
|
100
105
|
* {How to: Integrate with Devise}[https://github.com/mconf/bigbluebutton_rails/wiki/How-to:-Integrate-with-Devise]
|
101
106
|
* {How to: Integrate with CanCan}[https://github.com/mconf/bigbluebutton_rails/wiki/How-to:-Integrate-with-CanCan]
|
102
107
|
|
103
|
-
=== Dependencies
|
104
|
-
|
105
|
-
For gem dependencies check the gemspec file.
|
106
|
-
|
107
|
-
Files:
|
108
|
-
|
109
|
-
* Javascripts:
|
110
|
-
* JQuery (jquery.min.js). See http://jquery.com
|
111
|
-
* Images:
|
112
|
-
* loading.gif
|
113
|
-
|
114
|
-
JQuery is used in the views <tt>join_wait</tt> and <tt>invite</tt> and can be copied into your application with:
|
115
|
-
|
116
|
-
rails generate bigbluebutton_rails:public
|
117
|
-
|
118
108
|
== How it works
|
119
109
|
|
120
110
|
=== Overview
|
@@ -141,6 +131,12 @@ can throw a BigBlueButtonException.
|
|
141
131
|
|
142
132
|
These are pretty simple actions. <tt>running</tt> returns a json indicating if the conference is running or not, while <tt>end</tt> ends the meeting.
|
143
133
|
|
134
|
+
==== <tt>join_mobile</tt>
|
135
|
+
|
136
|
+
This is an action that simply renders a view with a {QR code}[http://code.google.com/apis/chart/image/docs/gallery/qr_codes.html] and a link to join the
|
137
|
+
conference from a mobile device. The link and the QR code point to links using the protocol "bigbluebutton://", so it can be associated with a native mobile
|
138
|
+
application that will open the conference (such as the {Android client for BigBlueButton}[https://github.com/mconf/mconf-mobile]).
|
139
|
+
|
144
140
|
==== <tt>join</tt>, <tt>invite</tt> and <tt>auth</tt>
|
145
141
|
|
146
142
|
The actions used to redirect a user to join a room are <tt>join</tt> and <tt>invite</tt>, while <tt>auth</tt> is used by <tt>invite</tt> to authenticate
|
@@ -164,21 +160,27 @@ Internally, they use the same algorithm:
|
|
164
160
|
* If the user is not a moderator (a normal attendee):
|
165
161
|
* If the meeting is running, redirects the user to the meeting as an attendee.
|
166
162
|
* Otherwise:
|
167
|
-
* <tt>join</tt>
|
163
|
+
* <tt>join</tt> renders the join view, to wait for a moderator before joining the conference. The page will continuously pool the server to check if the meeting is running. When it starts, it redirects the user to the conference.
|
168
164
|
* <tt>invite</tt> renders the invite view again and shows a warning informing that the meeting is not running. The user must re-submit the form to try again.
|
169
165
|
|
170
|
-
== Development
|
166
|
+
== Contributing/Development
|
171
167
|
|
172
|
-
|
168
|
+
Fork this repository, clone your fork and start by installing the dependencies:
|
173
169
|
|
174
170
|
bundle install
|
175
171
|
|
172
|
+
Edit <tt>spec/integration_conf.yml.example</tt> and set values for an existent BigBlueButton server. Save it as <tt>spec/integration_conf.yml</tt>. You will need it to run the integration tests.
|
173
|
+
|
176
174
|
Prepare the rails_app used for tests:
|
177
175
|
|
178
176
|
rake setup:rails_app
|
177
|
+
rake setup:rails_app:db
|
179
178
|
|
180
179
|
Run the tests:
|
181
180
|
|
182
181
|
rake spec
|
182
|
+
rake cucumber
|
183
183
|
|
184
184
|
Develop. :)
|
185
|
+
|
186
|
+
If you want your code to be integrated in this repository, please create a branch with your modifications and submit a pull request.
|
data/Rakefile
CHANGED
@@ -1,16 +1,18 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'bundler/setup'
|
3
|
-
require '
|
3
|
+
require 'rdoc/task'
|
4
4
|
require 'rspec/core/rake_task'
|
5
|
-
require '
|
5
|
+
require 'rubygems/package_task'
|
6
|
+
require 'cucumber'
|
7
|
+
require 'cucumber/rake/task'
|
6
8
|
|
7
|
-
desc 'Default: run
|
8
|
-
task :default => :spec
|
9
|
+
desc 'Default: run specs and features.'
|
10
|
+
task :default => [:spec, :cucumber]
|
9
11
|
|
10
12
|
RSpec::Core::RakeTask.new(:spec)
|
11
13
|
|
12
14
|
desc 'Generate documentation.'
|
13
|
-
|
15
|
+
RDoc::Task.new do |rdoc|
|
14
16
|
rdoc.rdoc_dir = 'rdoc'
|
15
17
|
rdoc.title = 'BigBlueButton on Rails'
|
16
18
|
rdoc.rdoc_files.include('README.rdoc')
|
@@ -20,19 +22,69 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
|
|
20
22
|
end
|
21
23
|
|
22
24
|
eval("$specification = begin; #{ IO.read('bigbluebutton_rails.gemspec')}; end")
|
23
|
-
|
25
|
+
Gem::PackageTask.new $specification do |pkg|
|
24
26
|
pkg.need_tar = true
|
25
27
|
pkg.need_zip = true
|
26
28
|
end
|
27
29
|
|
28
30
|
desc 'Setup RailsApp used in tests.'
|
29
|
-
namespace
|
31
|
+
namespace :setup do
|
30
32
|
task :rails_app do |app|
|
31
|
-
cd
|
32
|
-
sh "rake db:drop ENV=test"
|
33
|
+
cd "spec/rails_app/"
|
33
34
|
sh "rails destroy bigbluebutton_rails:install"
|
34
35
|
sh "rails generate bigbluebutton_rails:install"
|
35
|
-
|
36
|
-
|
36
|
+
end
|
37
|
+
|
38
|
+
namespace :rails_app do |app|
|
39
|
+
task :db do
|
40
|
+
# base
|
41
|
+
cd "spec/rails_app/"
|
42
|
+
sh "rake db:drop:all"
|
43
|
+
sh "rake db:create:all"
|
44
|
+
# test
|
45
|
+
sh "rake db:migrate RAILS_ENV=test"
|
46
|
+
sh "rake db:test:prepare RAILS_ENV=test"
|
47
|
+
# development
|
48
|
+
sh "rake db:migrate RAILS_ENV=development"
|
49
|
+
sh "rake db:seed RAILS_ENV=development"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
task :cucumber do
|
55
|
+
if File.exists? "features/"
|
56
|
+
puts "* Gem features"
|
57
|
+
sh %{ cucumber features/ }
|
58
|
+
end
|
59
|
+
puts "* Dummy app features"
|
60
|
+
sh %{ cd spec/rails_app; cucumber features/ }
|
61
|
+
end
|
62
|
+
|
63
|
+
task :notes do
|
64
|
+
puts `grep -r 'OPTIMIZE\\|FIXME\\|TODO' app/ public/ spec/`
|
65
|
+
end
|
66
|
+
|
67
|
+
# FIXME: not the best way to test these migrations, but works for now
|
68
|
+
desc 'Setup the rails_app using the migration files created when upgrading the gem
|
69
|
+
version, run all tests and destroys the generated files.'
|
70
|
+
namespace :spec do
|
71
|
+
task :migrations do |app|
|
72
|
+
cd "spec/rails_app/"
|
73
|
+
sh "rails destroy bigbluebutton_rails:install"
|
74
|
+
sh "rails generate bigbluebutton_rails:install 0.0.4"
|
75
|
+
sh "rails generate bigbluebutton_rails:install 0.0.5 --migration-only"
|
76
|
+
|
77
|
+
sh "rake db:drop RAILS_ENV=test"
|
78
|
+
sh "rake db:create RAILS_ENV=test"
|
79
|
+
sh "rake db:migrate RAILS_ENV=test"
|
80
|
+
sh "rake db:test:prepare RAILS_ENV=test"
|
81
|
+
|
82
|
+
cd "../.."
|
83
|
+
Rake::Task["spec"].invoke
|
84
|
+
Rake::Task["cucumber"].invoke
|
85
|
+
|
86
|
+
cd "spec/rails_app/"
|
87
|
+
sh "rails destroy bigbluebutton_rails:install 0.0.5 --migration-only"
|
88
|
+
sh "rails destroy bigbluebutton_rails:install 0.0.4"
|
37
89
|
end
|
38
90
|
end
|
@@ -4,7 +4,7 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
4
4
|
|
5
5
|
before_filter :find_server
|
6
6
|
respond_to :html, :except => :running
|
7
|
-
respond_to :json, :only => :running
|
7
|
+
respond_to :json, :only => [:running, :show, :new, :index, :create, :update, :end, :destroy]
|
8
8
|
|
9
9
|
def index
|
10
10
|
# TODO restrict to rooms belonging to the selected server
|
@@ -12,7 +12,7 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def show
|
15
|
-
respond_with(@room = BigbluebuttonRoom.
|
15
|
+
respond_with(@room = BigbluebuttonRoom.find_by_param(params[:id]))
|
16
16
|
end
|
17
17
|
|
18
18
|
def new
|
@@ -20,7 +20,7 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def edit
|
23
|
-
respond_with(@room = BigbluebuttonRoom.
|
23
|
+
respond_with(@room = BigbluebuttonRoom.find_by_param(params[:id]))
|
24
24
|
end
|
25
25
|
|
26
26
|
def create
|
@@ -35,11 +35,12 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
35
35
|
|
36
36
|
respond_with @room do |format|
|
37
37
|
if @room.save
|
38
|
+
message = t('bigbluebutton_rails.rooms.notice.create.success')
|
38
39
|
format.html {
|
39
|
-
message = t('bigbluebutton_rails.rooms.notice.create.success')
|
40
40
|
params[:redir_url] ||= bigbluebutton_server_room_path(@server, @room)
|
41
41
|
redirect_to params[:redir_url], :notice => message
|
42
42
|
}
|
43
|
+
format.json { render :json => { :message => message }, :status => :created }
|
43
44
|
else
|
44
45
|
format.html {
|
45
46
|
unless params[:redir_url].blank?
|
@@ -49,12 +50,13 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
49
50
|
render :action => "new"
|
50
51
|
end
|
51
52
|
}
|
53
|
+
format.json { render :json => @room.errors.full_messages, :status => :unprocessable_entity }
|
52
54
|
end
|
53
55
|
end
|
54
56
|
end
|
55
57
|
|
56
58
|
def update
|
57
|
-
@room = BigbluebuttonRoom.
|
59
|
+
@room = BigbluebuttonRoom.find_by_param(params[:id])
|
58
60
|
|
59
61
|
if !params[:bigbluebutton_room].has_key?(:meetingid) or
|
60
62
|
params[:bigbluebutton_room][:meetingid].blank?
|
@@ -63,11 +65,12 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
63
65
|
|
64
66
|
respond_with @room do |format|
|
65
67
|
if @room.update_attributes(params[:bigbluebutton_room])
|
68
|
+
message = t('bigbluebutton_rails.rooms.notice.update.success')
|
66
69
|
format.html {
|
67
|
-
message = t('bigbluebutton_rails.rooms.notice.update.success')
|
68
70
|
params[:redir_url] ||= bigbluebutton_server_room_path(@server, @room)
|
69
71
|
redirect_to params[:redir_url], :notice => message
|
70
72
|
}
|
73
|
+
format.json { render :json => { :message => message } }
|
71
74
|
else
|
72
75
|
format.html {
|
73
76
|
unless params[:redir_url].blank?
|
@@ -77,51 +80,74 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
77
80
|
render :action => "edit"
|
78
81
|
end
|
79
82
|
}
|
83
|
+
format.json { render :json => @room.errors.full_messages, :status => :unprocessable_entity }
|
80
84
|
end
|
81
85
|
end
|
82
86
|
end
|
83
87
|
|
84
88
|
def destroy
|
85
|
-
@room = BigbluebuttonRoom.
|
89
|
+
@room = BigbluebuttonRoom.find_by_param(params[:id])
|
86
90
|
|
87
91
|
# TODO Destroy the room record even if end_meeting failed?
|
88
92
|
|
93
|
+
error = false
|
89
94
|
begin
|
90
95
|
@room.fetch_is_running?
|
91
96
|
@room.send_end if @room.is_running?
|
92
97
|
rescue BigBlueButton::BigBlueButtonException => e
|
93
|
-
|
98
|
+
error = true
|
99
|
+
message = e.to_s
|
94
100
|
# TODO Better error message: "Room destroyed in DB, but not in BBB..."
|
95
101
|
end
|
96
102
|
|
97
103
|
@room.destroy
|
98
|
-
|
99
|
-
|
104
|
+
|
105
|
+
respond_with do |format|
|
106
|
+
format.html {
|
107
|
+
flash[:error] = message if error
|
108
|
+
params[:redir_url] ||= bigbluebutton_server_rooms_url
|
109
|
+
redirect_to params[:redir_url]
|
110
|
+
}
|
111
|
+
if error
|
112
|
+
format.json { render :json => { :message => message }, :status => :error }
|
113
|
+
else
|
114
|
+
message = t('bigbluebutton_rails.rooms.notice.destroy.success')
|
115
|
+
format.json { render :json => { :message => message } }
|
116
|
+
end
|
117
|
+
end
|
100
118
|
end
|
101
119
|
|
102
|
-
# Used to join public rooms
|
120
|
+
# Used by logged users to join public rooms.
|
103
121
|
def join
|
104
|
-
@room = BigbluebuttonRoom.
|
122
|
+
@room = BigbluebuttonRoom.find_by_param(params[:id])
|
105
123
|
|
106
|
-
# anonymous users or users without a role join through #invite
|
107
124
|
role = bigbluebutton_role(@room)
|
108
|
-
if
|
125
|
+
if role.nil?
|
126
|
+
raise BigbluebuttonRails::RoomAccessDenied.new
|
127
|
+
|
128
|
+
# anonymous users or users with the role :password join through #invite
|
129
|
+
elsif bigbluebutton_user.nil? or role == :password
|
109
130
|
redirect_to :action => :invite
|
131
|
+
|
110
132
|
else
|
111
133
|
join_internal(bigbluebutton_user.name, role, :join)
|
112
134
|
end
|
113
|
-
|
114
135
|
end
|
115
136
|
|
116
137
|
# Used to join private rooms or to invited anonymous users (not logged)
|
117
138
|
def invite
|
118
|
-
@room = BigbluebuttonRoom.
|
139
|
+
@room = BigbluebuttonRoom.find_by_param(params[:id])
|
119
140
|
|
120
141
|
respond_with @room do |format|
|
121
142
|
|
143
|
+
role = bigbluebutton_role(@room)
|
144
|
+
if role.nil?
|
145
|
+
raise BigbluebuttonRails::RoomAccessDenied.new
|
146
|
+
|
122
147
|
# if there's already a logged user with a role in the room, join through #join
|
123
|
-
|
148
|
+
elsif !bigbluebutton_user.nil? and role != :password
|
124
149
|
format.html { redirect_to :action => :join }
|
150
|
+
|
125
151
|
else
|
126
152
|
format.html
|
127
153
|
end
|
@@ -131,7 +157,9 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
131
157
|
|
132
158
|
# Authenticates an user using name and password passed in the params from #invite
|
133
159
|
def auth
|
134
|
-
@room = BigbluebuttonRoom.
|
160
|
+
@room = BigbluebuttonRoom.find_by_param(params[:id])
|
161
|
+
|
162
|
+
raise BigbluebuttonRails::RoomAccessDenied.new if bigbluebutton_role(@room).nil?
|
135
163
|
|
136
164
|
# if there's a user logged, use his name instead of the name in the params
|
137
165
|
name = bigbluebutton_user.nil? ? params[:user][:name] : bigbluebutton_user.name
|
@@ -140,13 +168,13 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
140
168
|
unless role.nil? or name.nil?
|
141
169
|
join_internal(name, role, :invite)
|
142
170
|
else
|
143
|
-
flash[:error] = t('bigbluebutton_rails.rooms.
|
171
|
+
flash[:error] = t('bigbluebutton_rails.rooms.errors.auth.failure')
|
144
172
|
render :action => "invite", :status => :unauthorized
|
145
173
|
end
|
146
174
|
end
|
147
175
|
|
148
176
|
def running
|
149
|
-
@room = BigbluebuttonRoom.
|
177
|
+
@room = BigbluebuttonRoom.find_by_param(params[:id])
|
150
178
|
|
151
179
|
begin
|
152
180
|
@room.fetch_is_running?
|
@@ -160,30 +188,53 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
160
188
|
end
|
161
189
|
|
162
190
|
def end
|
163
|
-
@room = BigbluebuttonRoom.
|
191
|
+
@room = BigbluebuttonRoom.find_by_param(params[:id])
|
164
192
|
|
193
|
+
error = false
|
165
194
|
begin
|
166
195
|
@room.fetch_is_running?
|
167
196
|
if @room.is_running?
|
168
197
|
@room.send_end
|
169
198
|
message = t('bigbluebutton_rails.rooms.notice.end.success')
|
170
199
|
else
|
200
|
+
error = true
|
171
201
|
message = t('bigbluebutton_rails.rooms.notice.end.not_running')
|
172
202
|
end
|
173
203
|
rescue BigBlueButton::BigBlueButtonException => e
|
174
|
-
|
175
|
-
|
204
|
+
error = true
|
205
|
+
message = e.to_s
|
206
|
+
end
|
207
|
+
|
208
|
+
if error
|
209
|
+
respond_with do |format|
|
210
|
+
format.html {
|
211
|
+
flash[:error] = message
|
212
|
+
redirect_to request.referer
|
213
|
+
}
|
214
|
+
format.json { render :json => message, :status => :error }
|
215
|
+
end
|
176
216
|
else
|
177
|
-
|
217
|
+
respond_with do |format|
|
218
|
+
format.html {
|
219
|
+
redirect_to(bigbluebutton_server_room_path(@server, @room), :notice => message)
|
220
|
+
}
|
221
|
+
format.json { render :json => message }
|
222
|
+
end
|
178
223
|
end
|
179
224
|
|
180
225
|
end
|
181
226
|
|
227
|
+
def join_mobile
|
228
|
+
@room = BigbluebuttonRoom.find_by_param(params[:id])
|
229
|
+
@join_url = @room.join_url(bigbluebutton_user.name, bigbluebutton_role(@room))
|
230
|
+
@join_url.gsub!("http://", "bigbluebutton://")
|
231
|
+
end
|
232
|
+
|
182
233
|
protected
|
183
234
|
|
184
235
|
def find_server
|
185
236
|
if params.has_key?(:server_id)
|
186
|
-
@server = BigbluebuttonServer.
|
237
|
+
@server = BigbluebuttonServer.find_by_param(params[:server_id])
|
187
238
|
else
|
188
239
|
@server = BigbluebuttonServer.first
|
189
240
|
end
|
@@ -197,6 +248,9 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
197
248
|
# if the current user is a moderator, create the room (if needed)
|
198
249
|
# and join it
|
199
250
|
if role == :moderator
|
251
|
+
|
252
|
+
add_domain_to_logout_url(@room, request.protocol, request.host)
|
253
|
+
|
200
254
|
@room.send_create unless @room.is_running?
|
201
255
|
join_url = @room.join_url(username, role)
|
202
256
|
redirect_to(join_url)
|
@@ -208,7 +262,7 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
208
262
|
join_url = @room.join_url(username, role)
|
209
263
|
redirect_to(join_url)
|
210
264
|
else
|
211
|
-
flash[:error] = t('bigbluebutton_rails.rooms.
|
265
|
+
flash[:error] = t('bigbluebutton_rails.rooms.errors.auth.not_running')
|
212
266
|
render :action => wait_action
|
213
267
|
end
|
214
268
|
end
|
@@ -219,4 +273,13 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
219
273
|
end
|
220
274
|
end
|
221
275
|
|
276
|
+
def add_domain_to_logout_url(room, protocol, host)
|
277
|
+
unless @room.logout_url.nil? or @room.logout_url =~ /^[a-z]+:\/\// # matches the protocol
|
278
|
+
unless @room.logout_url =~ /^[a-z0-9]+([\-\.]{ 1}[a-z0-9]+)*/ # matches the host domain
|
279
|
+
@room.logout_url = host + @room.logout_url
|
280
|
+
end
|
281
|
+
@room.logout_url = protocol + @room.logout_url
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
222
285
|
end
|