amazon-chime-sdk-rails 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +87 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +47 -0
  5. data/.yardopts +6 -0
  6. data/CHANGELOG.md +3 -0
  7. data/Gemfile +25 -0
  8. data/LICENSE +21 -0
  9. data/README.md +1109 -0
  10. data/Rakefile +20 -0
  11. data/amazon-chime-sdk-rails.gemspec +29 -0
  12. data/gemfiles/Gemfile.rails-5.0 +25 -0
  13. data/gemfiles/Gemfile.rails-5.1 +25 -0
  14. data/gemfiles/Gemfile.rails-5.2 +25 -0
  15. data/gemfiles/Gemfile.rails-6.0 +25 -0
  16. data/lib/amazon-chime-sdk-rails.rb +37 -0
  17. data/lib/chime_sdk/config.rb +90 -0
  18. data/lib/chime_sdk/controller/attendees.rb +128 -0
  19. data/lib/chime_sdk/controller/common.rb +202 -0
  20. data/lib/chime_sdk/controller/meetings.rb +192 -0
  21. data/lib/chime_sdk/meeting_coordinator.rb +184 -0
  22. data/lib/chime_sdk/version.rb +4 -0
  23. data/lib/generators/chime_sdk/controllers_generator.rb +104 -0
  24. data/lib/generators/chime_sdk/install_generator.rb +27 -0
  25. data/lib/generators/chime_sdk/js_generator.rb +67 -0
  26. data/lib/generators/chime_sdk/views_generator.rb +43 -0
  27. data/lib/generators/templates/chime_sdk.rb +28 -0
  28. data/lib/generators/templates/controllers/README +35 -0
  29. data/lib/generators/templates/controllers/meeting_attendees_controller.rb +106 -0
  30. data/lib/generators/templates/controllers/meetings_controller.rb +146 -0
  31. data/lib/generators/templates/views/meetings/index.html.erb +27 -0
  32. data/lib/generators/templates/views/meetings/show.html.erb +136 -0
  33. data/spec/factories/rooms.rb +5 -0
  34. data/spec/factories/users.rb +8 -0
  35. data/spec/generators/controllers_generator_spec.rb +113 -0
  36. data/spec/generators/install_generator_spec.rb +24 -0
  37. data/spec/generators/js_generator_spec.rb +26 -0
  38. data/spec/generators/views_generator_spec.rb +46 -0
  39. data/spec/rails_app/Rakefile +15 -0
  40. data/spec/rails_app/app/assets/config/manifest.js +2 -0
  41. data/spec/rails_app/app/assets/images/.keep +0 -0
  42. data/spec/rails_app/app/assets/javascripts/.keep +0 -0
  43. data/spec/rails_app/app/assets/stylesheets/application.css +15 -0
  44. data/spec/rails_app/app/assets/stylesheets/scaffolds.scss +65 -0
  45. data/spec/rails_app/app/controllers/api/meeting_attendees_controller.rb +3 -0
  46. data/spec/rails_app/app/controllers/api/meetings_controller.rb +3 -0
  47. data/spec/rails_app/app/controllers/api/rooms_controller.rb +3 -0
  48. data/spec/rails_app/app/controllers/application_controller.rb +11 -0
  49. data/spec/rails_app/app/controllers/entries_controller.rb +47 -0
  50. data/spec/rails_app/app/controllers/meeting_attendees_controller.rb +121 -0
  51. data/spec/rails_app/app/controllers/meetings_controller.rb +162 -0
  52. data/spec/rails_app/app/controllers/rooms_controller.rb +76 -0
  53. data/spec/rails_app/app/controllers/spa_controller.rb +6 -0
  54. data/spec/rails_app/app/javascript/App.vue +50 -0
  55. data/spec/rails_app/app/javascript/channels/consumer.js +6 -0
  56. data/spec/rails_app/app/javascript/channels/index.js +5 -0
  57. data/spec/rails_app/app/javascript/components/DeviseTokenAuth.vue +84 -0
  58. data/spec/rails_app/app/javascript/components/meetings/Index.vue +100 -0
  59. data/spec/rails_app/app/javascript/components/meetings/Meeting.vue +178 -0
  60. data/spec/rails_app/app/javascript/components/rooms/Index.vue +53 -0
  61. data/spec/rails_app/app/javascript/components/rooms/Show.vue +91 -0
  62. data/spec/rails_app/app/javascript/packs/application.js +17 -0
  63. data/spec/rails_app/app/javascript/packs/spa.js +14 -0
  64. data/spec/rails_app/app/javascript/router/index.js +74 -0
  65. data/spec/rails_app/app/javascript/store/index.js +37 -0
  66. data/spec/rails_app/app/models/application_record.rb +3 -0
  67. data/spec/rails_app/app/models/entry.rb +5 -0
  68. data/spec/rails_app/app/models/room.rb +12 -0
  69. data/spec/rails_app/app/models/user.rb +6 -0
  70. data/spec/rails_app/app/views/devise/registrations/new.html.erb +34 -0
  71. data/spec/rails_app/app/views/layouts/_header.html.erb +20 -0
  72. data/spec/rails_app/app/views/layouts/application.html.erb +18 -0
  73. data/spec/rails_app/app/views/meetings/index.html.erb +28 -0
  74. data/spec/rails_app/app/views/meetings/show.html.erb +136 -0
  75. data/spec/rails_app/app/views/rooms/_form.html.erb +22 -0
  76. data/spec/rails_app/app/views/rooms/_room.json.jbuilder +7 -0
  77. data/spec/rails_app/app/views/rooms/edit.html.erb +6 -0
  78. data/spec/rails_app/app/views/rooms/index.html.erb +27 -0
  79. data/spec/rails_app/app/views/rooms/index.json.jbuilder +1 -0
  80. data/spec/rails_app/app/views/rooms/new.html.erb +5 -0
  81. data/spec/rails_app/app/views/rooms/show.html.erb +42 -0
  82. data/spec/rails_app/app/views/rooms/show.json.jbuilder +1 -0
  83. data/spec/rails_app/app/views/spa/index.html.erb +1 -0
  84. data/spec/rails_app/babel.config.js +72 -0
  85. data/spec/rails_app/bin/bundle +114 -0
  86. data/spec/rails_app/bin/rails +9 -0
  87. data/spec/rails_app/bin/rake +9 -0
  88. data/spec/rails_app/bin/setup +36 -0
  89. data/spec/rails_app/bin/spring +17 -0
  90. data/spec/rails_app/bin/webpack +18 -0
  91. data/spec/rails_app/bin/webpack-dev-server +18 -0
  92. data/spec/rails_app/bin/yarn +11 -0
  93. data/spec/rails_app/config.ru +5 -0
  94. data/spec/rails_app/config/application.rb +21 -0
  95. data/spec/rails_app/config/boot.rb +4 -0
  96. data/spec/rails_app/config/cable.yml +10 -0
  97. data/spec/rails_app/config/credentials.yml.enc +1 -0
  98. data/spec/rails_app/config/database.yml +25 -0
  99. data/spec/rails_app/config/environment.rb +14 -0
  100. data/spec/rails_app/config/environments/development.rb +62 -0
  101. data/spec/rails_app/config/environments/production.rb +112 -0
  102. data/spec/rails_app/config/environments/test.rb +49 -0
  103. data/spec/rails_app/config/initializers/application_controller_renderer.rb +8 -0
  104. data/spec/rails_app/config/initializers/assets.rb +15 -0
  105. data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  106. data/spec/rails_app/config/initializers/chime_sdk.rb +28 -0
  107. data/spec/rails_app/config/initializers/content_security_policy.rb +30 -0
  108. data/spec/rails_app/config/initializers/cookies_serializer.rb +5 -0
  109. data/spec/rails_app/config/initializers/devise.rb +311 -0
  110. data/spec/rails_app/config/initializers/devise_token_auth.rb +60 -0
  111. data/spec/rails_app/config/initializers/filter_parameter_logging.rb +4 -0
  112. data/spec/rails_app/config/initializers/inflections.rb +16 -0
  113. data/spec/rails_app/config/initializers/mime_types.rb +4 -0
  114. data/spec/rails_app/config/initializers/wrap_parameters.rb +14 -0
  115. data/spec/rails_app/config/locales/devise.en.yml +65 -0
  116. data/spec/rails_app/config/locales/en.yml +33 -0
  117. data/spec/rails_app/config/puma.rb +38 -0
  118. data/spec/rails_app/config/routes.rb +24 -0
  119. data/spec/rails_app/config/secrets.yml +8 -0
  120. data/spec/rails_app/config/spring.rb +6 -0
  121. data/spec/rails_app/config/storage.yml +34 -0
  122. data/spec/rails_app/config/webpack/development.js +5 -0
  123. data/spec/rails_app/config/webpack/environment.js +7 -0
  124. data/spec/rails_app/config/webpack/loaders/vue.js +6 -0
  125. data/spec/rails_app/config/webpack/production.js +5 -0
  126. data/spec/rails_app/config/webpack/test.js +5 -0
  127. data/spec/rails_app/config/webpacker.yml +97 -0
  128. data/spec/rails_app/db/migrate/20200912140231_devise_create_users.rb +45 -0
  129. data/spec/rails_app/db/migrate/20200912140352_add_tokens_to_users.rb +12 -0
  130. data/spec/rails_app/db/migrate/20200912140657_create_rooms.rb +9 -0
  131. data/spec/rails_app/db/migrate/20200912140749_create_entries.rb +10 -0
  132. data/spec/rails_app/db/schema.rb +49 -0
  133. data/spec/rails_app/db/seeds.rb +41 -0
  134. data/spec/rails_app/log/.keep +0 -0
  135. data/spec/rails_app/package.json +23 -0
  136. data/spec/rails_app/postcss.config.js +12 -0
  137. data/spec/rails_app/public/404.html +67 -0
  138. data/spec/rails_app/public/422.html +67 -0
  139. data/spec/rails_app/public/500.html +66 -0
  140. data/spec/rails_app/public/favicon.ico +0 -0
  141. data/spec/rails_app/public/robots.txt +1 -0
  142. data/spec/rails_app/tmp/.keep +0 -0
  143. data/spec/requests/atendees_spec.rb +182 -0
  144. data/spec/requests/meetings_spec.rb +433 -0
  145. data/spec/spec_helper.rb +35 -0
  146. metadata +400 -0
@@ -0,0 +1,27 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <h1>Meetings by Amazon Chime SDK</h1>
4
+
5
+ <table>
6
+ <thead>
7
+ <tr>
8
+ <th>Meeting ID</th>
9
+ <th>External Meeting ID</th>
10
+ <th>Media Region</th>
11
+ <th colspan="1"></th>
12
+ </tr>
13
+ </thead>
14
+
15
+ <tbody>
16
+ <% @meetings.each do |meeting| %>
17
+ <tr>
18
+ <td><%= link_to(meeting[:Meeting][:MeetingId], meeting_resource_path(meeting[:Meeting][:MeetingId])) %></td>
19
+ <td><%= meeting[:Meeting][:ExternalMeetingId] %></td>
20
+ <td><%= meeting[:Meeting][:MediaRegion] %></td>
21
+ <td><%= link_to 'Destroy', meeting_resource_path(meeting[:Meeting][:MeetingId]), method: :delete, data: { confirm: 'Are you sure?' } %></td>
22
+ </tr>
23
+ <% end %>
24
+ </tbody>
25
+ </table>
26
+
27
+ <p><%= link_to 'Create Meeting', meeting_resources_path, method: :post %></p>
@@ -0,0 +1,136 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <h1>Meeting by Amazon Chime SDK</h1>
4
+
5
+ <p><%= link_to("Show Meetings", meeting_resources_path) %></p>
6
+
7
+ <% if @meeting %>
8
+ <strong>Meeting</strong>
9
+ <p>
10
+ Meeting ID : <%= link_to(@meeting[:Meeting][:MeetingId], meeting_resource_path(@meeting[:Meeting][:MeetingId])) %><br>
11
+ External Meeting ID : <%= @meeting[:Meeting][:ExternalMeetingId] %><br>
12
+ Media Region : <%= @meeting[:Meeting][:MediaRegion] %>
13
+ </p>
14
+
15
+ <div id="meeting" meeting-data="<%= @meeting.to_json %>"></div>
16
+ <% end %>
17
+
18
+ <% if @attendee %>
19
+ <strong>Attendee</strong>
20
+ <p>
21
+ Attendee ID : <%= link_to(@attendee[:Attendee][:AttendeeId], attendee_resource_path(@meeting[:Meeting][:MeetingId], @attendee[:Attendee][:AttendeeId])) %><br>
22
+ External User ID : <%= @attendee[:Attendee][:ExternalUserId] %><br>
23
+ Application Attendee Name : <%= application_attendee_name(@attendee) %>
24
+ </p>
25
+
26
+ <div id="status">
27
+ <strong>Status</strong>
28
+ <div id="meeting-status">
29
+ <p>Meeting : Offline <input type="button" value="Join a meeting" onclick="join()"></p>
30
+ </div>
31
+ <div id="attendee-status"></div>
32
+ </div>
33
+
34
+ <audio id="audio"></audio>
35
+
36
+ <div id="attendee" attendee-data="<%= @attendee.to_json %>"></div>
37
+ <div id="attendee-resources-path" attendee-resources-path-data="<%= attendee_resources_path(@meeting[:Meeting][:MeetingId]) %>"></div>
38
+ <% end %>
39
+
40
+ <%= javascript_include_tag "amazon-chime-sdk.min.js" %>
41
+ <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
42
+
43
+ <script defer>
44
+ // This is a very simple script as a template view using Amazon Chime SDK.
45
+ // This script only provides simple audio meeting function.
46
+ // See the following guide to develop your own video meeting application.
47
+ // https://github.com/aws/amazon-chime-sdk-js
48
+ // https://aws.github.io/amazon-chime-sdk-js/modules/gettingstarted.html
49
+
50
+ // Customize this function to extract attendee name to show
51
+ function showApplicationUserName(attendee) {
52
+ return attendee.Attendee.AttendeeId;
53
+ // return `${attendee.Attendee.ApplicationMetadata.User.name} (${attendee.Attendee.AttendeeId})`;
54
+ }
55
+
56
+ const meeting = JSON.parse(document.getElementById('meeting').getAttribute('meeting-data'));
57
+ const attendee = JSON.parse(document.getElementById('attendee').getAttribute('attendee-data'));
58
+ const attendeeResourcesPath = document.getElementById('attendee-resources-path').getAttribute('attendee-resources-path-data');
59
+ const audioOutputElement = document.getElementById('audio');
60
+
61
+ const logger = new ChimeSDK.ConsoleLogger('ChimeMeetingLogs', ChimeSDK.LogLevel.INFO);
62
+ const deviceController = new ChimeSDK.DefaultDeviceController(logger);
63
+ const configuration = new ChimeSDK.MeetingSessionConfiguration(meeting, attendee);
64
+ const meetingSession = new ChimeSDK.DefaultMeetingSession(configuration, logger, deviceController);
65
+
66
+ const attendeeApi = axios.create({
67
+ baseURL: `${attendeeResourcesPath}/`
68
+ });
69
+
70
+ async function join() {
71
+ try {
72
+ const audioInputDevices = await meetingSession.audioVideo.listAudioInputDevices();
73
+ const audioOutputDevices = await meetingSession.audioVideo.listAudioOutputDevices();
74
+ await meetingSession.audioVideo.chooseAudioInputDevice(audioInputDevices[0].deviceId);
75
+ await meetingSession.audioVideo.chooseAudioOutputDevice(audioOutputDevices[0].deviceId);
76
+ } catch (error) {
77
+ // handle error - unable to acquire audio device perhaps due to permissions blocking
78
+ console.log(error);
79
+ }
80
+ meetingSession.audioVideo.bindAudioElement(audioOutputElement);
81
+ meetingSession.audioVideo.start();
82
+ document.getElementById("meeting-status").innerHTML = '<p>Meeting : Online <input type="button" value="Leave a meeting" onclick="leave()"></p><div id="audio-status"></div>';
83
+ document.getElementById("audio-status").innerHTML = '<p>Audio : Active <input type="button" value="Mute" onclick="mute()"></p>';
84
+ document.getElementById("attendee-status").innerHTML = '<strong>Present Attendees</strong>';
85
+ parepareAttendeeStatus();
86
+ }
87
+
88
+ function leave() {
89
+ meetingSession.audioVideo.stop();
90
+ document.getElementById("meeting-status").innerHTML = '<p>Meeting : Offline <input type="button" value="Join a meeting" onclick="join()">';
91
+ document.getElementById("attendee-status").innerHTML = '';
92
+ }
93
+
94
+ function mute() {
95
+ meetingSession.audioVideo.realtimeMuteLocalAudio();
96
+ document.getElementById("audio-status").innerHTML = '<p>Audio : Muted <input type="button" value="Unmute" onclick="unmute()"></p>';
97
+ }
98
+
99
+ function unmute() {
100
+ const unmuted = meetingSession.audioVideo.realtimeUnmuteLocalAudio();
101
+ if (unmuted) {
102
+ document.getElementById("audio-status").innerHTML = '<p>Audio : Active <input type="button" value="Mute" onclick="mute()"></p>';
103
+ } else {
104
+ console.log('You cannot unmute yourself');
105
+ }
106
+ }
107
+
108
+ function parepareAttendeeStatus() {
109
+ const presentAttendeeMap = {};
110
+ const callback = (presentAttendeeId, present) => {
111
+ if (present) {
112
+ attendeeApi.get(presentAttendeeId)
113
+ .then(response => {
114
+ presentAttendeeMap[presentAttendeeId] = response.data;
115
+ updateAttendeeStatus(presentAttendeeMap);
116
+ })
117
+ .catch(error => {
118
+ console.log(error);
119
+ });
120
+ } else {
121
+ delete presentAttendeeMap[presentAttendeeId]
122
+ updateAttendeeStatus(presentAttendeeMap);
123
+ }
124
+ };
125
+ meetingSession.audioVideo.realtimeSubscribeToAttendeeIdPresence(callback);
126
+ }
127
+
128
+ function updateAttendeeStatus(presentAttendeeMap) {
129
+ presentAttendees = "<strong>Present Attendees</strong><ul>";
130
+ Object.values(presentAttendeeMap).forEach(attendee => {
131
+ presentAttendees = presentAttendees + `<li>${showApplicationUserName(attendee)}</li>`
132
+ });
133
+ presentAttendees = presentAttendees + '</ul>'
134
+ document.getElementById("attendee-status").innerHTML = presentAttendees;
135
+ }
136
+ </script>
@@ -0,0 +1,5 @@
1
+ FactoryBot.define do
2
+ factory :room do
3
+ name { "DefaultRoom" }
4
+ end
5
+ end
@@ -0,0 +1,8 @@
1
+ FactoryBot.define do
2
+ factory :user do
3
+ name { Array.new(10){[*"A".."Z", *"0".."9"].sample}.join }
4
+ email { name + '@example.com' }
5
+ password { "password" }
6
+ password_confirmation { "password" }
7
+ end
8
+ end
@@ -0,0 +1,113 @@
1
+ require 'generators/chime_sdk/controllers_generator'
2
+
3
+ describe ChimeSdk::Generators::ControllersGenerator, type: :generator do
4
+ destination File.expand_path("../../../tmp", __FILE__)
5
+ before { prepare_destination }
6
+
7
+ it 'runs generating controllers tasks' do
8
+ gen = generator
9
+ expect(gen).to receive :generate_controllers
10
+ expect(gen).to receive(:readme).and_return(true)
11
+ gen.invoke_all
12
+ end
13
+
14
+ describe 'generating files' do
15
+ context 'without prefix argument' do
16
+ before do
17
+ run_generator
18
+ end
19
+
20
+ describe 'app/controllers/meetings_controller' do
21
+ subject { file('app/controllers/meetings_controller.rb') }
22
+ it { is_expected.to exist }
23
+ it { is_expected.to contain(/class MeetingsController < ApplicationController/) }
24
+ it { is_expected.to contain(" meetings_path(params)\n") }
25
+ end
26
+
27
+ describe 'app/controllers/meeting_attendees_controller' do
28
+ subject { file('app/controllers/meeting_attendees_controller.rb') }
29
+ it { is_expected.to exist }
30
+ it { is_expected.to contain(/class MeetingAttendeesController < ApplicationController/) }
31
+ it { is_expected.to contain(" meetings_path(params)\n") }
32
+ end
33
+ end
34
+
35
+ context 'with room as prefix' do
36
+ before do
37
+ run_generator %w(room)
38
+ end
39
+
40
+ describe 'app/controllers/room_meetings_controller' do
41
+ subject { file('app/controllers/room_meetings_controller.rb') }
42
+ it { is_expected.to exist }
43
+ it { is_expected.to contain(/class RoomMeetingsController < ApplicationController/) }
44
+ it { is_expected.to contain(" room_meetings_path(@room, params)\n") }
45
+ end
46
+
47
+ describe 'app/controllers/room_meeting_attendees_controller' do
48
+ subject { file('app/controllers/room_meeting_attendees_controller.rb') }
49
+ it { is_expected.to exist }
50
+ it { is_expected.to contain(/class RoomMeetingAttendeesController < ApplicationController/) }
51
+ it { is_expected.to contain(" room_meetings_path(@room, params)\n") }
52
+ end
53
+ end
54
+
55
+ context 'with room as --parent option' do
56
+ before do
57
+ run_generator %w(--parent room)
58
+ end
59
+
60
+ describe 'app/controllers/meetings_controller' do
61
+ subject { file('app/controllers/meetings_controller.rb') }
62
+ it { is_expected.to exist }
63
+ it { is_expected.to contain(/class MeetingsController < ApplicationController/) }
64
+ it { is_expected.to contain(" room_meetings_path(@room, params)\n") }
65
+ end
66
+
67
+ describe 'app/controllers/meeting_attendees_controller' do
68
+ subject { file('app/controllers/meeting_attendees_controller.rb') }
69
+ it { is_expected.to exist }
70
+ it { is_expected.to contain(/class MeetingAttendeesController < ApplicationController/) }
71
+ it { is_expected.to contain(" room_meetings_path(@room, params)\n") }
72
+ end
73
+ end
74
+
75
+ context 'with api as --namespace option' do
76
+ before do
77
+ run_generator %w(--namespace api)
78
+ end
79
+
80
+ describe 'app/controllers/api/meetings_controller' do
81
+ subject { file('app/controllers/api/meetings_controller.rb') }
82
+ it { is_expected.to exist }
83
+ it { is_expected.to contain(/class Api::MeetingsController < ApplicationController/) }
84
+ it { is_expected.to contain(" api_meetings_path(params)\n") }
85
+ end
86
+
87
+ describe 'app/controllers/api/meeting_attendees_controller' do
88
+ subject { file('app/controllers/api/meeting_attendees_controller.rb') }
89
+ it { is_expected.to exist }
90
+ it { is_expected.to contain(/class Api::MeetingAttendeesController < ApplicationController/) }
91
+ it { is_expected.to contain(" api_meetings_path(params)\n") }
92
+ end
93
+ end
94
+
95
+ context 'with meetings as --controllers option' do
96
+ before do
97
+ run_generator %w(--controllers meetings)
98
+ end
99
+
100
+ describe 'app/controllers/meetings_controller' do
101
+ subject { file('app/controllers/meetings_controller.rb') }
102
+ it { is_expected.to exist }
103
+ it { is_expected.to contain(/class MeetingsController < ApplicationController/) }
104
+ it { is_expected.to contain(" meetings_path(params)\n") }
105
+ end
106
+
107
+ describe 'app/controllers/meeting_attendees_controller' do
108
+ subject { file('app/controllers/meeting_attendees_controller.rb') }
109
+ it { is_expected.not_to exist }
110
+ end
111
+ end
112
+ end
113
+ end
@@ -0,0 +1,24 @@
1
+ require 'generators/chime_sdk/install_generator'
2
+
3
+ describe ChimeSdk::Generators::InstallGenerator, type: :generator do
4
+ destination File.expand_path("../../../tmp", __FILE__)
5
+ before { prepare_destination }
6
+
7
+ it 'runs generating initializer task' do
8
+ gen = generator
9
+ expect(gen).to receive :copy_initializer
10
+ gen.invoke_all
11
+ end
12
+
13
+ describe 'generating files' do
14
+ before do
15
+ run_generator
16
+ end
17
+
18
+ describe 'config/initializers/chime_sdk.rb as an initializer' do
19
+ subject { file('config/initializers/chime_sdk.rb') }
20
+ it { is_expected.to exist }
21
+ it { is_expected.to contain(/ChimeSdk.configure do |config|/) }
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,26 @@
1
+ require 'generators/chime_sdk/js_generator'
2
+
3
+ describe ChimeSdk::Generators::JsGenerator, type: :generator do
4
+ destination File.expand_path("../../../tmp", __FILE__)
5
+ before { prepare_destination }
6
+
7
+ it 'runs generating Amazon Chime SDK single .js file task' do
8
+ gen = generator
9
+ expect(gen).to receive :build_and_copy_chime_sdk_js
10
+ gen.invoke_all
11
+ end
12
+
13
+ describe 'generating files' do
14
+ context 'when npm is installed' do
15
+ before do
16
+ run_generator
17
+ end
18
+
19
+ # This test takes a long time. Skip it by xdescribe if you are developing the gem.
20
+ describe 'app/assets/javascripts/amazon-chime-sdk.min.js' do
21
+ subject { file('app/assets/javascripts/amazon-chime-sdk.min.js') }
22
+ it { is_expected.to exist }
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,46 @@
1
+ require 'generators/chime_sdk/views_generator'
2
+
3
+ describe ChimeSdk::Generators::ViewsGenerator, type: :generator do
4
+ destination File.expand_path("../../../tmp", __FILE__)
5
+ before { prepare_destination }
6
+
7
+ it 'runs generating views tasks' do
8
+ gen = generator
9
+ expect(gen).to receive :generate_views
10
+ gen.invoke_all
11
+ end
12
+
13
+ describe 'generating files' do
14
+ context 'without prefix argument' do
15
+ before do
16
+ run_generator
17
+ end
18
+
19
+ describe 'app/views/meetings/index.html.erb' do
20
+ subject { file('app/views/meetings/index.html.erb') }
21
+ it { is_expected.to exist }
22
+ end
23
+
24
+ describe 'app/views/meetings/show.html.erb' do
25
+ subject { file('app/views/meetings/show.html.erb') }
26
+ it { is_expected.to exist }
27
+ end
28
+ end
29
+
30
+ context 'with room as prefix argument' do
31
+ before do
32
+ run_generator %w(room)
33
+ end
34
+
35
+ describe 'rapp/views/oom_meetings/index.html.erb' do
36
+ subject { file('app/views/room_meetings/index.html.erb') }
37
+ it { is_expected.to exist }
38
+ end
39
+
40
+ describe 'app/views/room_meetings/show.html.erb' do
41
+ subject { file('app/views/room_meetings/show.html.erb') }
42
+ it { is_expected.to exist }
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,15 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require_relative 'config/application'
5
+
6
+ Rails.application.load_tasks
7
+
8
+ # Define dummy module for Rake tasks
9
+ require 'devise_token_auth'
10
+ unless defined?(DeviseTokenAuth::Concerns::User)
11
+ module DeviseTokenAuth::Concerns
12
+ module User
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,2 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../stylesheets .css
File without changes
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
6
+ * vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,65 @@
1
+ body {
2
+ background-color: #fff;
3
+ color: #333;
4
+ margin: 33px; }
5
+
6
+ body, p, ol, ul, td {
7
+ font-family: verdana, arial, helvetica, sans-serif;
8
+ font-size: 13px;
9
+ line-height: 18px; }
10
+
11
+ pre {
12
+ background-color: #eee;
13
+ padding: 10px;
14
+ font-size: 11px; }
15
+
16
+ a {
17
+ color: #000; }
18
+
19
+ a:visited {
20
+ color: #666; }
21
+
22
+ a:hover {
23
+ color: #fff;
24
+ background-color: #000; }
25
+
26
+ th {
27
+ padding-bottom: 5px; }
28
+
29
+ td {
30
+ padding: 0 5px 7px; }
31
+
32
+ div.field,
33
+ div.actions {
34
+ margin-bottom: 10px; }
35
+
36
+ #notice {
37
+ color: green; }
38
+
39
+ .field_with_errors {
40
+ padding: 2px;
41
+ background-color: red;
42
+ display: table; }
43
+
44
+ #error_explanation {
45
+ width: 450px;
46
+ border: 2px solid red;
47
+ padding: 7px 7px 0;
48
+ margin-bottom: 20px;
49
+ background-color: #f0f0f0; }
50
+
51
+ #error_explanation h2 {
52
+ text-align: left;
53
+ font-weight: bold;
54
+ padding: 5px 5px 5px 15px;
55
+ font-size: 12px;
56
+ margin: -7px -7px 0;
57
+ background-color: #c00;
58
+ color: #fff; }
59
+
60
+ #error_explanation ul li {
61
+ font-size: 12px;
62
+ list-style: square; }
63
+
64
+ label {
65
+ display: block; }