rails_embed_editor 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +15 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +34 -0
  5. data/app/assets/javascripts/rails_embed_editor/application.coffee +59 -0
  6. data/app/assets/stylesheets/rails_embed_editor/application.scss +66 -0
  7. data/app/controllers/rails_embed_editor/application_controller.rb +4 -0
  8. data/app/controllers/rails_embed_editor/editor_controller.rb +16 -0
  9. data/app/helpers/rails_embed_editor/application_helper.rb +14 -0
  10. data/app/views/layouts/rails_embed_editor/application.html.erb +14 -0
  11. data/config/routes.rb +3 -0
  12. data/lib/rails_embed_editor/config.rb +11 -0
  13. data/lib/rails_embed_editor/editor_mode.rb +7 -0
  14. data/lib/rails_embed_editor/engine.rb +10 -0
  15. data/lib/rails_embed_editor/file_manager.rb +54 -0
  16. data/lib/rails_embed_editor/version.rb +3 -0
  17. data/lib/rails_embed_editor.rb +15 -0
  18. data/lib/tasks/rails_embed_editor_tasks.rake +4 -0
  19. data/test/controller/editor_controller_test.rb +34 -0
  20. data/test/dummy/README.rdoc +28 -0
  21. data/test/dummy/Rakefile +6 -0
  22. data/test/dummy/app/assets/javascripts/application.js +13 -0
  23. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  24. data/test/dummy/app/controllers/application_controller.rb +5 -0
  25. data/test/dummy/app/helpers/application_helper.rb +2 -0
  26. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  27. data/test/dummy/bin/bundle +3 -0
  28. data/test/dummy/bin/rails +4 -0
  29. data/test/dummy/bin/rake +4 -0
  30. data/test/dummy/config/application.rb +23 -0
  31. data/test/dummy/config/boot.rb +5 -0
  32. data/test/dummy/config/database.yml +25 -0
  33. data/test/dummy/config/environment.rb +5 -0
  34. data/test/dummy/config/environments/development.rb +29 -0
  35. data/test/dummy/config/environments/production.rb +80 -0
  36. data/test/dummy/config/environments/test.rb +36 -0
  37. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  38. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  39. data/test/dummy/config/initializers/inflections.rb +16 -0
  40. data/test/dummy/config/initializers/mime_types.rb +5 -0
  41. data/test/dummy/config/initializers/secret_token.rb +12 -0
  42. data/test/dummy/config/initializers/session_store.rb +3 -0
  43. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  44. data/test/dummy/config/locales/en.yml +23 -0
  45. data/test/dummy/config/routes.rb +4 -0
  46. data/test/dummy/config.ru +4 -0
  47. data/test/dummy/db/test.sqlite3 +0 -0
  48. data/test/dummy/log/development.log +0 -0
  49. data/test/dummy/log/test.log +1143 -0
  50. data/test/dummy/public/404.html +58 -0
  51. data/test/dummy/public/422.html +58 -0
  52. data/test/dummy/public/500.html +57 -0
  53. data/test/dummy/public/favicon.ico +0 -0
  54. data/test/integration/navigation_test.rb +10 -0
  55. data/test/rails_embed_editor/config_test.rb +14 -0
  56. data/test/rails_embed_editor/dumbfile.erb +13 -0
  57. data/test/rails_embed_editor/file_manager_test.rb +51 -0
  58. data/test/rails_embed_editor_test.rb +7 -0
  59. data/test/test_helper.rb +19 -0
  60. data/test/tmp/edit_test/dumbfile.erb +11 -0
  61. metadata +208 -0
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/404.html -->
52
+ <div class="dialog">
53
+ <h1>The page you were looking for doesn't exist.</h1>
54
+ <p>You may have mistyped the address or the page may have moved.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/422.html -->
52
+ <div class="dialog">
53
+ <h1>The change you wanted was rejected.</h1>
54
+ <p>Maybe you tried to change something you didn't have access to.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -0,0 +1,57 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/500.html -->
52
+ <div class="dialog">
53
+ <h1>We're sorry, but something went wrong.</h1>
54
+ </div>
55
+ <p>If you are the application owner check the logs for more information.</p>
56
+ </body>
57
+ </html>
File without changes
@@ -0,0 +1,10 @@
1
+ require 'test_helper'
2
+
3
+ class NavigationTest < ActionDispatch::IntegrationTest
4
+ fixtures :all
5
+
6
+ # test "the truth" do
7
+ # assert true
8
+ # end
9
+ end
10
+
@@ -0,0 +1,14 @@
1
+ require 'test_helper'
2
+
3
+ #Tests I18nAdminUtils::Config
4
+ class ConfigTest < ActiveSupport::TestCase
5
+ test 'Load config fine with block' do
6
+ RailsEmbedEditor.config do |config|
7
+
8
+ end
9
+ end
10
+
11
+ test 'Test config function without param' do
12
+ assert RailsEmbedEditor.config == RailsEmbedEditor::Config
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ line1
2
+ line2
3
+ line3
4
+ line4
5
+ line5
6
+ line6
7
+ line7
8
+ line8
9
+ line9
10
+ line10
11
+ line11
12
+ line12
13
+ line13
@@ -0,0 +1,51 @@
1
+ require 'test_helper'
2
+ class FileManagerTest < ActiveSupport::TestCase
3
+
4
+ def destination
5
+ File.expand_path('../../tmp/edit_test', __FILE__)
6
+ end
7
+
8
+ def filename
9
+ "#{destination}/dumbfile.erb"
10
+ end
11
+
12
+ def setup
13
+ FileUtils.mkdir_p(File.dirname(filename))
14
+ FileUtils.cp 'test/rails_embed_editor/dumbfile.erb', filename
15
+ end
16
+
17
+ test 'Init from options with around' do
18
+ line = 5
19
+ radius = 3
20
+ manager = RailsEmbedEditor::FileManager.from_options(filename, {:line => line, :radius => radius})
21
+ assert manager.first_line = line-radius
22
+ assert manager.last_line = line+radius
23
+ end
24
+ test 'Init from options with range' do
25
+ first_line = 2
26
+ last_line = 5
27
+ manager = RailsEmbedEditor::FileManager.from_options(filename, {:first_line => first_line, :last_line => last_line})
28
+ assert manager.first_line = first_line
29
+ assert manager.last_line = last_line
30
+ end
31
+
32
+ test 'Read right lines' do
33
+ first_line = 2
34
+ last_line = 5
35
+ manager = RailsEmbedEditor::FileManager.from_options(filename, {:first_line => first_line, :last_line => last_line})
36
+ assert manager.read_lines.size == last_line - first_line + 1
37
+ end
38
+
39
+ test 'Save text' do
40
+ first_line = 2
41
+ last_line = 5
42
+ manager = RailsEmbedEditor::FileManager.from_options(filename, {:first_line => first_line, :last_line => last_line})
43
+ text = "REPLACED 3 LINES\nBY 2"
44
+ line_count = File.open(filename) { |f| f.count }
45
+ puts line_count
46
+ line_count_should_be = line_count - (last_line - first_line + 1-text.split(/\r?\n/).size)
47
+ manager.save_text text
48
+ line_count = File.open(filename) { |f| f.count }
49
+ assert line_count_should_be == line_count, "Wrong line count: \n\t should be:\t #{line_count_should_be} \n\t but is:\t#{line_count}"
50
+ end
51
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class RailsEmbedEditorTest < ActiveSupport::TestCase
4
+ test "truth" do
5
+ assert_kind_of Module, RailsEmbedEditor
6
+ end
7
+ end
@@ -0,0 +1,19 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
4
+ # Configure Rails Environment
5
+ ENV["RAILS_ENV"] = "test"
6
+
7
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
8
+ require "rails/test_help"
9
+
10
+ Rails.backtrace_cleaner.remove_silencers!
11
+
12
+ # Load support files
13
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
14
+
15
+ # Load fixtures from the engine
16
+ if ActiveSupport::TestCase.method_defined?(:fixture_path=)
17
+ ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
18
+ end
19
+
@@ -0,0 +1,11 @@
1
+ line1
2
+ REPLACED 3 LINES
3
+ BY 2
4
+ line6
5
+ line7
6
+ line8
7
+ line9
8
+ line10
9
+ line11
10
+ line12
11
+ line13
metadata ADDED
@@ -0,0 +1,208 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails_embed_editor
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Timothee Guerin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '4.0'
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: 4.0.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '4.0'
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: 4.0.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: ace-rails-ap
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ! '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: json
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ! '>='
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: sqlite3
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ! '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ description: A tool that allow to display a embed editor on your page and edit local
76
+ file(Views, Controller, ...). Details otw
77
+ email:
78
+ - timothee.guerin@outlook.com
79
+ executables: []
80
+ extensions: []
81
+ extra_rdoc_files: []
82
+ files:
83
+ - MIT-LICENSE
84
+ - README.rdoc
85
+ - Rakefile
86
+ - app/assets/javascripts/rails_embed_editor/application.coffee
87
+ - app/assets/stylesheets/rails_embed_editor/application.scss
88
+ - app/controllers/rails_embed_editor/application_controller.rb
89
+ - app/controllers/rails_embed_editor/editor_controller.rb
90
+ - app/helpers/rails_embed_editor/application_helper.rb
91
+ - app/views/layouts/rails_embed_editor/application.html.erb
92
+ - config/routes.rb
93
+ - lib/rails_embed_editor.rb
94
+ - lib/rails_embed_editor/config.rb
95
+ - lib/rails_embed_editor/editor_mode.rb
96
+ - lib/rails_embed_editor/engine.rb
97
+ - lib/rails_embed_editor/file_manager.rb
98
+ - lib/rails_embed_editor/version.rb
99
+ - lib/tasks/rails_embed_editor_tasks.rake
100
+ - test/controller/editor_controller_test.rb
101
+ - test/dummy/README.rdoc
102
+ - test/dummy/Rakefile
103
+ - test/dummy/app/assets/javascripts/application.js
104
+ - test/dummy/app/assets/stylesheets/application.css
105
+ - test/dummy/app/controllers/application_controller.rb
106
+ - test/dummy/app/helpers/application_helper.rb
107
+ - test/dummy/app/views/layouts/application.html.erb
108
+ - test/dummy/bin/bundle
109
+ - test/dummy/bin/rails
110
+ - test/dummy/bin/rake
111
+ - test/dummy/config.ru
112
+ - test/dummy/config/application.rb
113
+ - test/dummy/config/boot.rb
114
+ - test/dummy/config/database.yml
115
+ - test/dummy/config/environment.rb
116
+ - test/dummy/config/environments/development.rb
117
+ - test/dummy/config/environments/production.rb
118
+ - test/dummy/config/environments/test.rb
119
+ - test/dummy/config/initializers/backtrace_silencers.rb
120
+ - test/dummy/config/initializers/filter_parameter_logging.rb
121
+ - test/dummy/config/initializers/inflections.rb
122
+ - test/dummy/config/initializers/mime_types.rb
123
+ - test/dummy/config/initializers/secret_token.rb
124
+ - test/dummy/config/initializers/session_store.rb
125
+ - test/dummy/config/initializers/wrap_parameters.rb
126
+ - test/dummy/config/locales/en.yml
127
+ - test/dummy/config/routes.rb
128
+ - test/dummy/db/test.sqlite3
129
+ - test/dummy/log/development.log
130
+ - test/dummy/log/test.log
131
+ - test/dummy/public/404.html
132
+ - test/dummy/public/422.html
133
+ - test/dummy/public/500.html
134
+ - test/dummy/public/favicon.ico
135
+ - test/integration/navigation_test.rb
136
+ - test/rails_embed_editor/config_test.rb
137
+ - test/rails_embed_editor/dumbfile.erb
138
+ - test/rails_embed_editor/file_manager_test.rb
139
+ - test/rails_embed_editor_test.rb
140
+ - test/test_helper.rb
141
+ - test/tmp/edit_test/dumbfile.erb
142
+ homepage: http://github.com/timcolonel/rails_embed_editor
143
+ licenses: []
144
+ metadata: {}
145
+ post_install_message:
146
+ rdoc_options: []
147
+ require_paths:
148
+ - lib
149
+ required_ruby_version: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ! '>='
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
154
+ required_rubygems_version: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ! '>='
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
159
+ requirements: []
160
+ rubyforge_project:
161
+ rubygems_version: 2.2.2
162
+ signing_key:
163
+ specification_version: 4
164
+ summary: A tool that allow to display a embed editor on your page and edit local file(Views,
165
+ Controller, ...)
166
+ test_files:
167
+ - test/controller/editor_controller_test.rb
168
+ - test/dummy/app/assets/javascripts/application.js
169
+ - test/dummy/app/assets/stylesheets/application.css
170
+ - test/dummy/app/controllers/application_controller.rb
171
+ - test/dummy/app/helpers/application_helper.rb
172
+ - test/dummy/app/views/layouts/application.html.erb
173
+ - test/dummy/bin/bundle
174
+ - test/dummy/bin/rails
175
+ - test/dummy/bin/rake
176
+ - test/dummy/config/application.rb
177
+ - test/dummy/config/boot.rb
178
+ - test/dummy/config/database.yml
179
+ - test/dummy/config/environment.rb
180
+ - test/dummy/config/environments/development.rb
181
+ - test/dummy/config/environments/production.rb
182
+ - test/dummy/config/environments/test.rb
183
+ - test/dummy/config/initializers/backtrace_silencers.rb
184
+ - test/dummy/config/initializers/filter_parameter_logging.rb
185
+ - test/dummy/config/initializers/inflections.rb
186
+ - test/dummy/config/initializers/mime_types.rb
187
+ - test/dummy/config/initializers/secret_token.rb
188
+ - test/dummy/config/initializers/session_store.rb
189
+ - test/dummy/config/initializers/wrap_parameters.rb
190
+ - test/dummy/config/locales/en.yml
191
+ - test/dummy/config/routes.rb
192
+ - test/dummy/config.ru
193
+ - test/dummy/db/test.sqlite3
194
+ - test/dummy/log/development.log
195
+ - test/dummy/log/test.log
196
+ - test/dummy/public/404.html
197
+ - test/dummy/public/422.html
198
+ - test/dummy/public/500.html
199
+ - test/dummy/public/favicon.ico
200
+ - test/dummy/Rakefile
201
+ - test/dummy/README.rdoc
202
+ - test/integration/navigation_test.rb
203
+ - test/rails_embed_editor/config_test.rb
204
+ - test/rails_embed_editor/dumbfile.erb
205
+ - test/rails_embed_editor/file_manager_test.rb
206
+ - test/rails_embed_editor_test.rb
207
+ - test/test_helper.rb
208
+ - test/tmp/edit_test/dumbfile.erb