rails_embed_editor 0.0.1 → 1.0.0
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.
- checksums.yaml +8 -8
- data/app/assets/javascripts/rails_embed_editor/application.coffee +43 -12
- data/app/assets/stylesheets/rails_embed_editor/application.scss +7 -0
- data/app/controllers/rails_embed_editor/application_controller.rb +17 -0
- data/app/controllers/rails_embed_editor/editor_controller.rb +6 -1
- data/app/helpers/rails_embed_editor/application_helper.rb +1 -0
- data/lib/generators/rails_embed_editor/install_generator.rb +11 -0
- data/lib/generators/rails_embed_editor/templates/initializer.rb +6 -0
- data/lib/rails_embed_editor.rb +1 -0
- data/lib/rails_embed_editor/authorization.rb +12 -0
- data/lib/rails_embed_editor/config.rb +11 -0
- data/lib/rails_embed_editor/version.rb +3 -3
- data/test/dummy/log/test.log +385 -0
- data/test/generators/install_generator_test.rb +18 -0
- data/test/test_helper.rb +6 -3
- data/test/tmp/config/initializers/rails_embed_editor.rb +6 -0
- metadata +65 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDFjZGNkMzQ0YzJiZWI3MDdlMTYyZjFkNDg0M2MwZWIyZDkwZDgwNA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MzUwM2Y3NTlmZjUyOTFmMzA2NTgzNTY2Yjg3NzQ2OWI5MTk0NTI1Mg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDgwNDE0NWM5NDhjZjRjYTc0NTdlMTBmMWRlNzc0MTA2ZDY0OWZjZDk0NTE2
|
10
|
+
YzZiMjZlNWM3MDYwMzMxNDhhZWRmNmZiYzlkYjc0MjE2Mjg4NDgwYmMwMzQy
|
11
|
+
ODQ2MmJhNjYyZTUyYWZlMDRiMzllOWI3ZGVjY2QyMTRjZDRkZjI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YzdhODQ0YTQwNTkxMjNiYWE4MWZhNjBmMDdmYzE5NjA5N2ZhNTdmMmJjM2Ez
|
14
|
+
NDJmZWFiOWI3ZmIxOWIyYzFiNzBlNTcxYTM3MmIxYzFkMGRkZTAwYTE2MmM3
|
15
|
+
YjYzZDBhZWZiNDgyMjBhM2ZiNGFjNGUzM2UxMTg4NzBjOWZjYTg=
|
@@ -3,7 +3,10 @@
|
|
3
3
|
#= require ace/ace
|
4
4
|
#= require ace/mode-ruby
|
5
5
|
#= require ace/theme-monokai
|
6
|
+
#= require ace/theme-github
|
6
7
|
|
8
|
+
window.rails_embed_editor_default_theme ?= 'github'
|
9
|
+
Range = require('ace/range').Range
|
7
10
|
$(document).ready () ->
|
8
11
|
window.load_rails_embed_code_editor()
|
9
12
|
|
@@ -18,13 +21,14 @@ window.load_rails_embed_code_editor = () ->
|
|
18
21
|
first_line: container.data('first-line')
|
19
22
|
last_line: container.data('last-line')
|
20
23
|
editormode: container.data('editormode')
|
24
|
+
highlight: compute_range(container.data('highlight'), container.data('first-line'))
|
21
25
|
}
|
22
26
|
setup_editor(container[0], options)
|
23
27
|
|
24
28
|
|
25
29
|
setup_editor = (element, options) ->
|
26
30
|
defaults = {
|
27
|
-
theme:
|
31
|
+
theme: window.rails_embed_editor_default_theme
|
28
32
|
mode: 'ruby'
|
29
33
|
firstLineNumber: 1
|
30
34
|
editormode: 'readonly'
|
@@ -40,20 +44,47 @@ setup_editor = (element, options) ->
|
|
40
44
|
editor.setOption("maxLines", 40);
|
41
45
|
editor.setOption("minLines", 5);
|
42
46
|
|
47
|
+
editor.getSession().addMarker(options['highlight'], "editor_highlight", "text") unless options['highlight'] == null
|
48
|
+
|
43
49
|
if options['editormode'] != 'readonly'
|
44
50
|
options['last_line'] ?= options['firstLineNumber'] + editor.session.getLength()
|
45
51
|
|
46
52
|
button = $('<div><button class="rails_embed_code_editor_button">Save</button></div>').appendTo(element).children()
|
47
53
|
button.text('Enable edit') if options['editormode'] == 'readwrite'
|
48
54
|
button.click () ->
|
49
|
-
if options['editormode']
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
55
|
+
if options['editormode'] != 'readonly'
|
56
|
+
if options['editormode'] == 'readwrite' and editor.getReadOnly()
|
57
|
+
button.text('Save')
|
58
|
+
editor.setReadOnly(false)
|
59
|
+
else
|
60
|
+
$.post('/rails_embed_editor/edit', {
|
61
|
+
content: editor.getValue()
|
62
|
+
first_line: options['first_line']
|
63
|
+
last_line: options['last_line']
|
64
|
+
filename: options['filename']
|
65
|
+
}).success (data) ->
|
66
|
+
if data['success'] == true
|
67
|
+
button.text('Saved!')
|
68
|
+
|
69
|
+
else
|
70
|
+
button.text('Error')
|
71
|
+
console.log('Error saving:' + data['message'])
|
72
|
+
setTimeout(() ->
|
73
|
+
button.text("Save")
|
74
|
+
, 2000)
|
75
|
+
|
76
|
+
compute_range = (str, line = 1) ->
|
77
|
+
offset = parseInt(line)
|
78
|
+
return null if str == undefined
|
79
|
+
_array = str.toString().split(',')
|
80
|
+
for i in [0..._array.length]
|
81
|
+
_array[i] = parseInt(_array[i])
|
82
|
+
switch _array.length
|
83
|
+
when 1
|
84
|
+
new Range(_array[0] - offset, 0, _array[0] - offset, Infinity)
|
85
|
+
when 2
|
86
|
+
new Range(_array[0] - offset, 0, _array[1] - offset, Infinity)
|
87
|
+
when 4
|
88
|
+
new Range(_array[0] - offset, _array[1], _array[2] - offset, _array[3])
|
89
|
+
else
|
90
|
+
null
|
@@ -1,4 +1,21 @@
|
|
1
1
|
module RailsEmbedEditor
|
2
2
|
class ApplicationController < ActionController::Base
|
3
|
+
|
4
|
+
def _authorize!(*args)
|
5
|
+
if defined? current_user
|
6
|
+
RailsEmbedEditor::Authorization.authorize!(current_user, *args)
|
7
|
+
else
|
8
|
+
true
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def _authorize(*args)
|
13
|
+
begin
|
14
|
+
_authorize! *args
|
15
|
+
true
|
16
|
+
rescue CanCan::AccessDenied => e
|
17
|
+
false
|
18
|
+
end
|
19
|
+
end
|
3
20
|
end
|
4
21
|
end
|
@@ -1,6 +1,11 @@
|
|
1
1
|
module RailsEmbedEditor
|
2
|
-
class EditorController < ApplicationController
|
2
|
+
class EditorController < RailsEmbedEditor::ApplicationController
|
3
3
|
def edit
|
4
|
+
unless _authorize :edit, :local_file
|
5
|
+
render :json => {:success => false, :message => 'You dont have access to this file!'}
|
6
|
+
return
|
7
|
+
end
|
8
|
+
|
4
9
|
filename = params[:filename]
|
5
10
|
text = params[:content]
|
6
11
|
if filename.nil? or text.nil?
|
@@ -8,6 +8,7 @@ module RailsEmbedEditor
|
|
8
8
|
last_line = manager.last_line
|
9
9
|
content_tag('div', text, :class => 'rails_embed_code_editor',
|
10
10
|
'data-first-line' => first_line, 'data-last-line' => last_line, 'data-filename' => filename,
|
11
|
+
'data-highlight' => options[:highlight],
|
11
12
|
'data-editormode' => options[:editormode])
|
12
13
|
end
|
13
14
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
module RailsEmbedEditor
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path('../templates', __FILE__)
|
5
|
+
desc 'Creates a InstallGenerator initializer and copy locale files to your application.'
|
6
|
+
|
7
|
+
def install
|
8
|
+
template 'initializer.rb', 'config/initializers/rails_embed_editor.rb'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/rails_embed_editor.rb
CHANGED
@@ -3,7 +3,18 @@ require 'active_support/core_ext/module/attribute_accessors'
|
|
3
3
|
module RailsEmbedEditor
|
4
4
|
module Config
|
5
5
|
class << self
|
6
|
+
attr_accessor :authorize_with
|
7
|
+
|
6
8
|
def reset
|
9
|
+
self.authorize_with = nil
|
10
|
+
end
|
11
|
+
|
12
|
+
def authorize_with(param = nil)
|
13
|
+
if param.nil?
|
14
|
+
@authorize_with
|
15
|
+
else
|
16
|
+
@authorize_with = param
|
17
|
+
end
|
7
18
|
|
8
19
|
end
|
9
20
|
end
|
@@ -1,3 +1,3 @@
|
|
1
|
-
module RailsEmbedEditor
|
2
|
-
VERSION = '0.0
|
3
|
-
end
|
1
|
+
module RailsEmbedEditor
|
2
|
+
VERSION = '1.0.0'
|
3
|
+
end
|
data/test/dummy/log/test.log
CHANGED
@@ -1139,5 +1139,390 @@ FileManagerTest: test_Save_text
|
|
1139
1139
|
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1140
1140
|
--------------------------------
|
1141
1141
|
RailsEmbedEditorTest: test_truth
|
1142
|
+
--------------------------------
|
1143
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1144
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1145
|
+
-------------------------------------------
|
1146
|
+
EditorControllerTest: test_should_edit_file
|
1147
|
+
-------------------------------------------
|
1148
|
+
Processing by RailsEmbedEditor::EditorController#edit as HTML
|
1149
|
+
Parameters: {"filename"=>"C:/dev/ws/ruby/rails_embed_editor/test/tmp/edit_test/dumbfile.erb", "first_line"=>"2", "last_line"=>"5", "content"=>"Replace with some othe ansowmn content"}
|
1150
|
+
Completed 200 OK in 3ms (Views: 0.0ms | ActiveRecord: 0.0ms)
|
1151
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1152
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1153
|
+
------------------------------------------
|
1154
|
+
EditorControllerTest: test_should_not_edit
|
1155
|
+
------------------------------------------
|
1156
|
+
Processing by RailsEmbedEditor::EditorController#edit as HTML
|
1157
|
+
Completed 200 OK in 1ms (Views: 0.0ms | ActiveRecord: 0.0ms)
|
1158
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1159
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1160
|
+
----------------------------------------------------------------
|
1161
|
+
InstallGeneratorTest: test_Assert_all_files_are_properly_created
|
1162
|
+
----------------------------------------------------------------
|
1163
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1164
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1165
|
+
--------------------------------------------
|
1166
|
+
ConfigTest: test_Load_config_fine_with_block
|
1167
|
+
--------------------------------------------
|
1168
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1169
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1170
|
+
---------------------------------------------------
|
1171
|
+
ConfigTest: test_Test_config_function_without_param
|
1172
|
+
---------------------------------------------------
|
1173
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1174
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1175
|
+
---------------------------------------------------
|
1176
|
+
FileManagerTest: test_Init_from_options_with_around
|
1177
|
+
---------------------------------------------------
|
1178
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1179
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1180
|
+
--------------------------------------------------
|
1181
|
+
FileManagerTest: test_Init_from_options_with_range
|
1182
|
+
--------------------------------------------------
|
1183
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1184
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1185
|
+
--------------------------------------
|
1186
|
+
FileManagerTest: test_Read_right_lines
|
1187
|
+
--------------------------------------
|
1188
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1189
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1190
|
+
-------------------------------
|
1191
|
+
FileManagerTest: test_Save_text
|
1192
|
+
-------------------------------
|
1193
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1194
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1195
|
+
--------------------------------
|
1196
|
+
RailsEmbedEditorTest: test_truth
|
1197
|
+
--------------------------------
|
1198
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1199
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1200
|
+
-------------------------------------------
|
1201
|
+
EditorControllerTest: test_should_edit_file
|
1202
|
+
-------------------------------------------
|
1203
|
+
Processing by RailsEmbedEditor::EditorController#edit as HTML
|
1204
|
+
Parameters: {"filename"=>"C:/dev/ws/ruby/rails_embed_editor/test/tmp/edit_test/dumbfile.erb", "first_line"=>"2", "last_line"=>"5", "content"=>"Replace with some othe ansowmn content"}
|
1205
|
+
Completed 200 OK in 2ms (Views: 0.0ms | ActiveRecord: 0.0ms)
|
1206
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1207
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1208
|
+
------------------------------------------
|
1209
|
+
EditorControllerTest: test_should_not_edit
|
1210
|
+
------------------------------------------
|
1211
|
+
Processing by RailsEmbedEditor::EditorController#edit as HTML
|
1212
|
+
Completed 200 OK in 1ms (Views: 0.0ms | ActiveRecord: 0.0ms)
|
1213
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1214
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1215
|
+
----------------------------------------------------------------
|
1216
|
+
InstallGeneratorTest: test_Assert_all_files_are_properly_created
|
1217
|
+
----------------------------------------------------------------
|
1218
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1219
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1220
|
+
--------------------------------------------
|
1221
|
+
ConfigTest: test_Load_config_fine_with_block
|
1222
|
+
--------------------------------------------
|
1223
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1224
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1225
|
+
---------------------------------------------------
|
1226
|
+
ConfigTest: test_Test_config_function_without_param
|
1227
|
+
---------------------------------------------------
|
1228
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1229
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1230
|
+
---------------------------------------------------
|
1231
|
+
FileManagerTest: test_Init_from_options_with_around
|
1232
|
+
---------------------------------------------------
|
1233
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1234
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1235
|
+
--------------------------------------------------
|
1236
|
+
FileManagerTest: test_Init_from_options_with_range
|
1237
|
+
--------------------------------------------------
|
1238
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1239
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1240
|
+
--------------------------------------
|
1241
|
+
FileManagerTest: test_Read_right_lines
|
1242
|
+
--------------------------------------
|
1243
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1244
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1245
|
+
-------------------------------
|
1246
|
+
FileManagerTest: test_Save_text
|
1247
|
+
-------------------------------
|
1248
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1249
|
+
[1m[36m (1.0ms)[0m [1mbegin transaction[0m
|
1250
|
+
--------------------------------
|
1251
|
+
RailsEmbedEditorTest: test_truth
|
1252
|
+
--------------------------------
|
1253
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1254
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1255
|
+
-------------------------------------------
|
1256
|
+
EditorControllerTest: test_should_edit_file
|
1257
|
+
-------------------------------------------
|
1258
|
+
Processing by RailsEmbedEditor::EditorController#edit as HTML
|
1259
|
+
Parameters: {"filename"=>"C:/dev/ws/ruby/rails_embed_editor/test/tmp/edit_test/dumbfile.erb", "first_line"=>"2", "last_line"=>"5", "content"=>"Replace with some othe ansowmn content"}
|
1260
|
+
Completed 500 Internal Server Error in 2ms
|
1261
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1262
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1263
|
+
------------------------------------------
|
1264
|
+
EditorControllerTest: test_should_not_edit
|
1265
|
+
------------------------------------------
|
1266
|
+
Processing by RailsEmbedEditor::EditorController#edit as HTML
|
1267
|
+
Completed 500 Internal Server Error in 2ms
|
1268
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1269
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1270
|
+
----------------------------------------------------------------
|
1271
|
+
InstallGeneratorTest: test_Assert_all_files_are_properly_created
|
1272
|
+
----------------------------------------------------------------
|
1273
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1274
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1275
|
+
--------------------------------------------
|
1276
|
+
ConfigTest: test_Load_config_fine_with_block
|
1277
|
+
--------------------------------------------
|
1278
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1279
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1280
|
+
---------------------------------------------------
|
1281
|
+
ConfigTest: test_Test_config_function_without_param
|
1282
|
+
---------------------------------------------------
|
1283
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1284
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1285
|
+
---------------------------------------------------
|
1286
|
+
FileManagerTest: test_Init_from_options_with_around
|
1287
|
+
---------------------------------------------------
|
1288
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1289
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1290
|
+
--------------------------------------------------
|
1291
|
+
FileManagerTest: test_Init_from_options_with_range
|
1292
|
+
--------------------------------------------------
|
1293
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1294
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1295
|
+
--------------------------------------
|
1296
|
+
FileManagerTest: test_Read_right_lines
|
1297
|
+
--------------------------------------
|
1298
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1299
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1300
|
+
-------------------------------
|
1301
|
+
FileManagerTest: test_Save_text
|
1302
|
+
-------------------------------
|
1303
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1304
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1305
|
+
--------------------------------
|
1306
|
+
RailsEmbedEditorTest: test_truth
|
1307
|
+
--------------------------------
|
1308
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1309
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1310
|
+
-------------------------------------------
|
1311
|
+
EditorControllerTest: test_should_edit_file
|
1312
|
+
-------------------------------------------
|
1313
|
+
Processing by RailsEmbedEditor::EditorController#edit as HTML
|
1314
|
+
Parameters: {"filename"=>"C:/dev/ws/ruby/rails_embed_editor/test/tmp/edit_test/dumbfile.erb", "first_line"=>"2", "last_line"=>"5", "content"=>"Replace with some othe ansowmn content"}
|
1315
|
+
Completed 500 Internal Server Error in 1ms
|
1316
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1317
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1318
|
+
------------------------------------------
|
1319
|
+
EditorControllerTest: test_should_not_edit
|
1320
|
+
------------------------------------------
|
1321
|
+
Processing by RailsEmbedEditor::EditorController#edit as HTML
|
1322
|
+
Completed 500 Internal Server Error in 1ms
|
1323
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1324
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1325
|
+
----------------------------------------------------------------
|
1326
|
+
InstallGeneratorTest: test_Assert_all_files_are_properly_created
|
1327
|
+
----------------------------------------------------------------
|
1328
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1329
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1330
|
+
--------------------------------------------
|
1331
|
+
ConfigTest: test_Load_config_fine_with_block
|
1332
|
+
--------------------------------------------
|
1333
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1334
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1335
|
+
---------------------------------------------------
|
1336
|
+
ConfigTest: test_Test_config_function_without_param
|
1337
|
+
---------------------------------------------------
|
1338
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1339
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1340
|
+
---------------------------------------------------
|
1341
|
+
FileManagerTest: test_Init_from_options_with_around
|
1342
|
+
---------------------------------------------------
|
1343
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1344
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1345
|
+
--------------------------------------------------
|
1346
|
+
FileManagerTest: test_Init_from_options_with_range
|
1347
|
+
--------------------------------------------------
|
1348
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1349
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1350
|
+
--------------------------------------
|
1351
|
+
FileManagerTest: test_Read_right_lines
|
1352
|
+
--------------------------------------
|
1353
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1354
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1355
|
+
-------------------------------
|
1356
|
+
FileManagerTest: test_Save_text
|
1357
|
+
-------------------------------
|
1358
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1359
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1360
|
+
--------------------------------
|
1361
|
+
RailsEmbedEditorTest: test_truth
|
1362
|
+
--------------------------------
|
1363
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1364
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1365
|
+
-------------------------------------------
|
1366
|
+
EditorControllerTest: test_should_edit_file
|
1367
|
+
-------------------------------------------
|
1368
|
+
Processing by RailsEmbedEditor::EditorController#edit as HTML
|
1369
|
+
Parameters: {"filename"=>"C:/dev/ws/ruby/rails_embed_editor/test/tmp/edit_test/dumbfile.erb", "first_line"=>"2", "last_line"=>"5", "content"=>"Replace with some othe ansowmn content"}
|
1370
|
+
Completed 200 OK in 2ms (Views: 1.0ms | ActiveRecord: 0.0ms)
|
1371
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1372
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1373
|
+
------------------------------------------
|
1374
|
+
EditorControllerTest: test_should_not_edit
|
1375
|
+
------------------------------------------
|
1376
|
+
Processing by RailsEmbedEditor::EditorController#edit as HTML
|
1377
|
+
Completed 200 OK in 1ms (Views: 1.0ms | ActiveRecord: 0.0ms)
|
1378
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1379
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1380
|
+
----------------------------------------------------------------
|
1381
|
+
InstallGeneratorTest: test_Assert_all_files_are_properly_created
|
1382
|
+
----------------------------------------------------------------
|
1383
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1384
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1385
|
+
--------------------------------------------
|
1386
|
+
ConfigTest: test_Load_config_fine_with_block
|
1387
|
+
--------------------------------------------
|
1388
|
+
[1m[35m (1.0ms)[0m rollback transaction
|
1389
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1390
|
+
---------------------------------------------------
|
1391
|
+
ConfigTest: test_Test_config_function_without_param
|
1392
|
+
---------------------------------------------------
|
1393
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1394
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1395
|
+
---------------------------------------------------
|
1396
|
+
FileManagerTest: test_Init_from_options_with_around
|
1397
|
+
---------------------------------------------------
|
1398
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1399
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1400
|
+
--------------------------------------------------
|
1401
|
+
FileManagerTest: test_Init_from_options_with_range
|
1402
|
+
--------------------------------------------------
|
1403
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1404
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1405
|
+
--------------------------------------
|
1406
|
+
FileManagerTest: test_Read_right_lines
|
1407
|
+
--------------------------------------
|
1408
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1409
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1410
|
+
-------------------------------
|
1411
|
+
FileManagerTest: test_Save_text
|
1412
|
+
-------------------------------
|
1413
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1414
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1415
|
+
--------------------------------
|
1416
|
+
RailsEmbedEditorTest: test_truth
|
1417
|
+
--------------------------------
|
1418
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1419
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1420
|
+
-------------------------------------------
|
1421
|
+
EditorControllerTest: test_should_edit_file
|
1422
|
+
-------------------------------------------
|
1423
|
+
Processing by RailsEmbedEditor::EditorController#edit as HTML
|
1424
|
+
Parameters: {"filename"=>"C:/dev/ws/ruby/rails_embed_editor/test/tmp/edit_test/dumbfile.erb", "first_line"=>"2", "last_line"=>"5", "content"=>"Replace with some othe ansowmn content"}
|
1425
|
+
Completed 200 OK in 2ms (Views: 0.0ms | ActiveRecord: 0.0ms)
|
1426
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1427
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1428
|
+
------------------------------------------
|
1429
|
+
EditorControllerTest: test_should_not_edit
|
1430
|
+
------------------------------------------
|
1431
|
+
Processing by RailsEmbedEditor::EditorController#edit as HTML
|
1432
|
+
Completed 200 OK in 1ms (Views: 0.0ms | ActiveRecord: 0.0ms)
|
1433
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1434
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1435
|
+
----------------------------------------------------------------
|
1436
|
+
InstallGeneratorTest: test_Assert_all_files_are_properly_created
|
1437
|
+
----------------------------------------------------------------
|
1438
|
+
[1m[35m (1.0ms)[0m rollback transaction
|
1439
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1440
|
+
--------------------------------------------
|
1441
|
+
ConfigTest: test_Load_config_fine_with_block
|
1442
|
+
--------------------------------------------
|
1443
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1444
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1445
|
+
---------------------------------------------------
|
1446
|
+
ConfigTest: test_Test_config_function_without_param
|
1447
|
+
---------------------------------------------------
|
1448
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1449
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1450
|
+
---------------------------------------------------
|
1451
|
+
FileManagerTest: test_Init_from_options_with_around
|
1452
|
+
---------------------------------------------------
|
1453
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1454
|
+
[1m[36m (1.0ms)[0m [1mbegin transaction[0m
|
1455
|
+
--------------------------------------------------
|
1456
|
+
FileManagerTest: test_Init_from_options_with_range
|
1457
|
+
--------------------------------------------------
|
1458
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1459
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1460
|
+
--------------------------------------
|
1461
|
+
FileManagerTest: test_Read_right_lines
|
1462
|
+
--------------------------------------
|
1463
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1464
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1465
|
+
-------------------------------
|
1466
|
+
FileManagerTest: test_Save_text
|
1467
|
+
-------------------------------
|
1468
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1469
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1470
|
+
--------------------------------
|
1471
|
+
RailsEmbedEditorTest: test_truth
|
1472
|
+
--------------------------------
|
1473
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1474
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1475
|
+
-------------------------------------------
|
1476
|
+
EditorControllerTest: test_should_edit_file
|
1477
|
+
-------------------------------------------
|
1478
|
+
Processing by RailsEmbedEditor::EditorController#edit as HTML
|
1479
|
+
Parameters: {"filename"=>"C:/dev/ws/ruby/rails_embed_editor/test/tmp/edit_test/dumbfile.erb", "first_line"=>"2", "last_line"=>"5", "content"=>"Replace with some othe ansowmn content"}
|
1480
|
+
Completed 200 OK in 2ms (Views: 0.0ms | ActiveRecord: 0.0ms)
|
1481
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1482
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1483
|
+
------------------------------------------
|
1484
|
+
EditorControllerTest: test_should_not_edit
|
1485
|
+
------------------------------------------
|
1486
|
+
Processing by RailsEmbedEditor::EditorController#edit as HTML
|
1487
|
+
Completed 200 OK in 1ms (Views: 0.0ms | ActiveRecord: 0.0ms)
|
1488
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1489
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1490
|
+
----------------------------------------------------------------
|
1491
|
+
InstallGeneratorTest: test_Assert_all_files_are_properly_created
|
1492
|
+
----------------------------------------------------------------
|
1493
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1494
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1495
|
+
--------------------------------------------
|
1496
|
+
ConfigTest: test_Load_config_fine_with_block
|
1497
|
+
--------------------------------------------
|
1498
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1499
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1500
|
+
---------------------------------------------------
|
1501
|
+
ConfigTest: test_Test_config_function_without_param
|
1502
|
+
---------------------------------------------------
|
1503
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1504
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1505
|
+
---------------------------------------------------
|
1506
|
+
FileManagerTest: test_Init_from_options_with_around
|
1507
|
+
---------------------------------------------------
|
1508
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1509
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1510
|
+
--------------------------------------------------
|
1511
|
+
FileManagerTest: test_Init_from_options_with_range
|
1512
|
+
--------------------------------------------------
|
1513
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1514
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1515
|
+
--------------------------------------
|
1516
|
+
FileManagerTest: test_Read_right_lines
|
1517
|
+
--------------------------------------
|
1518
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1519
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1520
|
+
-------------------------------
|
1521
|
+
FileManagerTest: test_Save_text
|
1522
|
+
-------------------------------
|
1523
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1524
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1525
|
+
--------------------------------
|
1526
|
+
RailsEmbedEditorTest: test_truth
|
1142
1527
|
--------------------------------
|
1143
1528
|
[1m[35m (0.0ms)[0m rollback transaction
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'rails/generators'
|
3
|
+
require 'generators/rails_embed_editor/install_generator'
|
4
|
+
|
5
|
+
|
6
|
+
class InstallGeneratorTest < Rails::Generators::TestCase
|
7
|
+
tests RailsEmbedEditor::InstallGenerator
|
8
|
+
destination File.expand_path('../../tmp', __FILE__)
|
9
|
+
|
10
|
+
setup do
|
11
|
+
prepare_destination
|
12
|
+
end
|
13
|
+
|
14
|
+
test 'Assert all files are properly created' do
|
15
|
+
run_generator
|
16
|
+
assert_file 'config/initializers/rails_embed_editor.rb'
|
17
|
+
end
|
18
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -1,11 +1,14 @@
|
|
1
|
+
# Configure Rails Environment
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
|
1
4
|
require 'coveralls'
|
2
5
|
Coveralls.wear!
|
3
6
|
|
4
|
-
# Configure Rails Environment
|
5
|
-
ENV["RAILS_ENV"] = "test"
|
6
7
|
|
7
8
|
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
8
|
-
require
|
9
|
+
require 'rails/test_help'
|
10
|
+
|
11
|
+
|
9
12
|
|
10
13
|
Rails.backtrace_cleaner.remove_silencers!
|
11
14
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_embed_editor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Timothee Guerin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -72,6 +72,62 @@ dependencies:
|
|
72
72
|
- - ! '>='
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: cancan
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ! '>='
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ! '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: tzinfo-data
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ! '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ! '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: minitest
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ! '>='
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: minitest-reporters
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ! '>='
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
type: :development
|
125
|
+
prerelease: false
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ! '>='
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
75
131
|
description: A tool that allow to display a embed editor on your page and edit local
|
76
132
|
file(Views, Controller, ...). Details otw
|
77
133
|
email:
|
@@ -90,7 +146,10 @@ files:
|
|
90
146
|
- app/helpers/rails_embed_editor/application_helper.rb
|
91
147
|
- app/views/layouts/rails_embed_editor/application.html.erb
|
92
148
|
- config/routes.rb
|
149
|
+
- lib/generators/rails_embed_editor/install_generator.rb
|
150
|
+
- lib/generators/rails_embed_editor/templates/initializer.rb
|
93
151
|
- lib/rails_embed_editor.rb
|
152
|
+
- lib/rails_embed_editor/authorization.rb
|
94
153
|
- lib/rails_embed_editor/config.rb
|
95
154
|
- lib/rails_embed_editor/editor_mode.rb
|
96
155
|
- lib/rails_embed_editor/engine.rb
|
@@ -132,12 +191,14 @@ files:
|
|
132
191
|
- test/dummy/public/422.html
|
133
192
|
- test/dummy/public/500.html
|
134
193
|
- test/dummy/public/favicon.ico
|
194
|
+
- test/generators/install_generator_test.rb
|
135
195
|
- test/integration/navigation_test.rb
|
136
196
|
- test/rails_embed_editor/config_test.rb
|
137
197
|
- test/rails_embed_editor/dumbfile.erb
|
138
198
|
- test/rails_embed_editor/file_manager_test.rb
|
139
199
|
- test/rails_embed_editor_test.rb
|
140
200
|
- test/test_helper.rb
|
201
|
+
- test/tmp/config/initializers/rails_embed_editor.rb
|
141
202
|
- test/tmp/edit_test/dumbfile.erb
|
142
203
|
homepage: http://github.com/timcolonel/rails_embed_editor
|
143
204
|
licenses: []
|
@@ -199,10 +260,12 @@ test_files:
|
|
199
260
|
- test/dummy/public/favicon.ico
|
200
261
|
- test/dummy/Rakefile
|
201
262
|
- test/dummy/README.rdoc
|
263
|
+
- test/generators/install_generator_test.rb
|
202
264
|
- test/integration/navigation_test.rb
|
203
265
|
- test/rails_embed_editor/config_test.rb
|
204
266
|
- test/rails_embed_editor/dumbfile.erb
|
205
267
|
- test/rails_embed_editor/file_manager_test.rb
|
206
268
|
- test/rails_embed_editor_test.rb
|
207
269
|
- test/test_helper.rb
|
270
|
+
- test/tmp/config/initializers/rails_embed_editor.rb
|
208
271
|
- test/tmp/edit_test/dumbfile.erb
|