ace_vimtura-rails 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.travis.yml +3 -0
  4. data/Gemfile +4 -0
  5. data/README.md +54 -0
  6. data/Rakefile +1 -0
  7. data/ace_vimtura-rails.gemspec +25 -0
  8. data/app/assets/javascripts/ace_vimtura/ace_vimtura.js +198 -0
  9. data/app/assets/javascripts/ace_vimtura/lib/ace/ace.js +11 -0
  10. data/app/assets/javascripts/ace_vimtura/lib/ace/mode-haml.js +1 -0
  11. data/app/assets/javascripts/ace_vimtura/lib/ace/mode-html.js +1 -0
  12. data/app/assets/javascripts/ace_vimtura/lib/ace/mode-jade.js +1 -0
  13. data/app/assets/javascripts/ace_vimtura/lib/ace/mode-markdown.js +1 -0
  14. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/ambiance.js +1 -0
  15. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/chaos.js +1 -0
  16. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/chrome.js +1 -0
  17. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/clouds.js +1 -0
  18. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/clouds_midnight.js +1 -0
  19. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/cobalt.js +1 -0
  20. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/crimson_editor.js +1 -0
  21. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/dawn.js +1 -0
  22. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/dreamweaver.js +1 -0
  23. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/eclipse.js +1 -0
  24. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/github.js +1 -0
  25. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/idle_fingers.js +1 -0
  26. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/iplastic.js +1 -0
  27. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/katzenmilch.js +1 -0
  28. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/kr_theme.js +1 -0
  29. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/kuroir.js +1 -0
  30. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/merbivore.js +1 -0
  31. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/merbivore_soft.js +1 -0
  32. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/mono_industrial.js +1 -0
  33. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/monokai.js +1 -0
  34. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/pastel_on_dark.js +1 -0
  35. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/solarized_dark.js +1 -0
  36. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/solarized_light.js +1 -0
  37. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/sqlserver.js +1 -0
  38. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/terminal.js +1 -0
  39. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/textmate.js +1 -0
  40. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/tomorrow.js +1 -0
  41. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/tomorrow_night.js +1 -0
  42. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/tomorrow_night_blue.js +1 -0
  43. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/tomorrow_night_bright.js +1 -0
  44. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/tomorrow_night_eighties.js +1 -0
  45. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/twilight.js +1 -0
  46. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/vibrant_ink.js +1 -0
  47. data/app/assets/javascripts/ace_vimtura/lib/ace/theme/xcode.js +1 -0
  48. data/app/assets/javascripts/ace_vimtura/lib/ace/vim.js +1 -0
  49. data/app/assets/javascripts/ace_vimtura/lib/renderers/haml.js +1 -0
  50. data/app/assets/javascripts/ace_vimtura/lib/renderers/markdown.js +6 -0
  51. data/app/assets/javascripts/ace_vimtura/lib/require.js +2087 -0
  52. data/app/assets/javascripts/ace_vimtura/main.js +23 -0
  53. data/app/assets/javascripts/ace_vimtura/preview.js +90 -0
  54. data/app/assets/javascripts/ace_vimtura/renderers/haml.js +13 -0
  55. data/app/assets/javascripts/ace_vimtura/renderers/html.js +16 -0
  56. data/app/assets/javascripts/ace_vimtura/renderers/jade.js +1 -0
  57. data/app/assets/javascripts/ace_vimtura/renderers/markdown.js +28 -0
  58. data/app/assets/javascripts/ace_vimtura/style.js +10 -0
  59. data/bin/console +14 -0
  60. data/bin/setup +7 -0
  61. data/lib/ace_vimtura/rails.rb +8 -0
  62. data/lib/ace_vimtura/rails/engine.rb +6 -0
  63. data/lib/ace_vimtura/rails/version.rb +5 -0
  64. metadata +133 -0
@@ -0,0 +1,23 @@
1
+ requirejs.config({
2
+ baseUrl: 'assets/ace_vimtura',
3
+ paths: {
4
+ ace_vimtura: 'ace_vimtura'
5
+ },
6
+ packages: [
7
+ {
8
+ name: 'ace',
9
+ main: 'ace',
10
+ location: "lib/ace"
11
+ }, {
12
+ name: 'ace/keyboard/vim',
13
+ main: 'vim',
14
+ location: 'lib/ace'
15
+ }
16
+ ]
17
+ });
18
+
19
+ require(['./ace_vimtura'], function(av) {
20
+ if (window) {
21
+ return window.AceVimtura = av;
22
+ }
23
+ });
@@ -0,0 +1,90 @@
1
+ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
2
+
3
+ define(function() {
4
+ AceVimtura.Preview = (function() {
5
+ function Preview() {
6
+ this.toggle = bind(this.toggle, this);
7
+ this.disable = bind(this.disable, this);
8
+ this.enable = bind(this.enable, this);
9
+ this.html = bind(this.html, this);
10
+ this.instantUpdate = bind(this.instantUpdate, this);
11
+ this.update = bind(this.update, this);
12
+ this.dom = document.createElement('div');
13
+ this.dom.classList.add('av_preview');
14
+ this.timeout = null;
15
+ this.isEnabled = false;
16
+ AceVimtura.dom.appendChild(this.dom);
17
+ this.enable();
18
+ }
19
+
20
+ Preview.prototype.update = function() {
21
+ if (this.timeout) {
22
+ window.clearTimeout(this.timeout);
23
+ }
24
+ return this.timeout = window.setTimeout((function(_this) {
25
+ return function() {
26
+ _this.instantUpdate();
27
+ return _this.timeout = null;
28
+ };
29
+ })(this), AceVimtura.options.refreshTimeout);
30
+ };
31
+
32
+ Preview.prototype.instantUpdate = function() {
33
+ var rend;
34
+ if (!(rend = AceVimtura.renderer)) {
35
+ return;
36
+ }
37
+ return this.html(rend.render(AceVimtura.ace.getValue()));
38
+ };
39
+
40
+ Preview.prototype.html = function(text) {
41
+ if (text) {
42
+ return this.dom.innerHTML = text;
43
+ } else {
44
+ return this.dom.innerHTML;
45
+ }
46
+ };
47
+
48
+ Preview.prototype.enable = function() {
49
+ var reg;
50
+ this.isEnabled = true;
51
+ reg = AceVimtura.ace._eventRegistry;
52
+ if (!reg['change']) {
53
+ return;
54
+ }
55
+ if (reg['change'].indexOf(this.update) > -1) {
56
+ return;
57
+ }
58
+ this.instantUpdate();
59
+ AceVimtura.ace.on('change', this.update);
60
+ return this.dom.classList.remove('collapsed');
61
+ };
62
+
63
+ Preview.prototype.disable = function() {
64
+ var i, reg;
65
+ this.isEnabled = false;
66
+ reg = AceVimtura.ace._eventRegistry;
67
+ if (!reg['change']) {
68
+ return;
69
+ }
70
+ i = reg['change'].indexOf(this.update);
71
+ if (i < 0) {
72
+ return;
73
+ }
74
+ reg['change'].splice(i, 1);
75
+ return this.dom.classList.add('collapsed');
76
+ };
77
+
78
+ Preview.prototype.toggle = function() {
79
+ if (this.isEnabled) {
80
+ return this.disable();
81
+ } else {
82
+ return this.enable();
83
+ }
84
+ };
85
+
86
+ return Preview;
87
+
88
+ })();
89
+ return AceVimtura.Preview;
90
+ });
@@ -0,0 +1,13 @@
1
+ define(['lib/renderers/haml'], function(haml) {
2
+ return AceVimtura.Renderers.Haml = (function() {
3
+ function Haml(options) {
4
+ if (options == null) {
5
+ options = {};
6
+ }
7
+ return AceVimtura.Renderers.Vendor.Haml;
8
+ }
9
+
10
+ return Haml;
11
+
12
+ })();
13
+ });
@@ -0,0 +1,16 @@
1
+ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
2
+
3
+ define(function() {
4
+ return AceVimtura.Renderers.Html = (function() {
5
+ function Html(options) {
6
+ this.render = bind(this.render, this);
7
+ }
8
+
9
+ Html.prototype.render = function(text) {
10
+ return text;
11
+ };
12
+
13
+ return Html;
14
+
15
+ })();
16
+ });
@@ -0,0 +1,28 @@
1
+ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
2
+
3
+ define(['lib/renderers/markdown'], function(marked) {
4
+ return AceVimtura.Renderers.Markdown = (function() {
5
+ function Markdown(options) {
6
+ if (options == null) {
7
+ options = {};
8
+ }
9
+ this.render = bind(this.render, this);
10
+ this.marked = marked;
11
+ options.gfm || (options.gfm = true);
12
+ options.tables || (options.tables = true);
13
+ options.breaks || (options.breaks = false);
14
+ options.pedantic || (options.pedantic = true);
15
+ options.sanitize || (options.sanitize = true);
16
+ options.smartLists || (options.smartLists = true);
17
+ options.smartypants || (options.smartypants = true);
18
+ this.marked.setOptions(options);
19
+ }
20
+
21
+ Markdown.prototype.render = function(text) {
22
+ return this.marked(text);
23
+ };
24
+
25
+ return Markdown;
26
+
27
+ })();
28
+ });
@@ -0,0 +1,10 @@
1
+ (function() {
2
+ define(function() {
3
+ var st, string;
4
+ string = '.av_editor { display: inline-block; width: 48%; min-height: 500px; height: 100%; transition: width 1s; -webkit-transition: width 1s; } .av_editor.fullscreen { width: 100%; } .av_preview { display: inline-block; width: 48%; min-height: 500px; height: 100%; background: #eee; overflow-x: hidden; overflow-y: scroll; transition: width 1s; -webkit-transition: width 1s; } .av_preview.collapsed { width: 0; }';
5
+ st = document.createElement('style');
6
+ st.innerHTML = string;
7
+ return document.head.appendChild(st);
8
+ });
9
+
10
+ }).call(this);
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "ace_vimtura/rails"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,8 @@
1
+ require "ace_vimtura/rails/version"
2
+ require "ace_vimtura/rails/engine"
3
+
4
+ module AceVimtura
5
+ module Rails
6
+ # Your code goes here...
7
+ end
8
+ end
@@ -0,0 +1,6 @@
1
+ module AceVimtura
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module AceVimtura
2
+ module Rails
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,133 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ace_vimtura-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - d-theus
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-06-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.9'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: Gem version == node package version
42
+ email:
43
+ - slma0x02@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - ".travis.yml"
50
+ - Gemfile
51
+ - README.md
52
+ - Rakefile
53
+ - ace_vimtura-rails.gemspec
54
+ - app/assets/javascripts/ace_vimtura/ace_vimtura.js
55
+ - app/assets/javascripts/ace_vimtura/lib/ace/ace.js
56
+ - app/assets/javascripts/ace_vimtura/lib/ace/mode-haml.js
57
+ - app/assets/javascripts/ace_vimtura/lib/ace/mode-html.js
58
+ - app/assets/javascripts/ace_vimtura/lib/ace/mode-jade.js
59
+ - app/assets/javascripts/ace_vimtura/lib/ace/mode-markdown.js
60
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/ambiance.js
61
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/chaos.js
62
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/chrome.js
63
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/clouds.js
64
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/clouds_midnight.js
65
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/cobalt.js
66
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/crimson_editor.js
67
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/dawn.js
68
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/dreamweaver.js
69
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/eclipse.js
70
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/github.js
71
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/idle_fingers.js
72
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/iplastic.js
73
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/katzenmilch.js
74
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/kr_theme.js
75
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/kuroir.js
76
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/merbivore.js
77
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/merbivore_soft.js
78
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/mono_industrial.js
79
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/monokai.js
80
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/pastel_on_dark.js
81
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/solarized_dark.js
82
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/solarized_light.js
83
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/sqlserver.js
84
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/terminal.js
85
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/textmate.js
86
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/tomorrow.js
87
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/tomorrow_night.js
88
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/tomorrow_night_blue.js
89
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/tomorrow_night_bright.js
90
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/tomorrow_night_eighties.js
91
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/twilight.js
92
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/vibrant_ink.js
93
+ - app/assets/javascripts/ace_vimtura/lib/ace/theme/xcode.js
94
+ - app/assets/javascripts/ace_vimtura/lib/ace/vim.js
95
+ - app/assets/javascripts/ace_vimtura/lib/renderers/haml.js
96
+ - app/assets/javascripts/ace_vimtura/lib/renderers/markdown.js
97
+ - app/assets/javascripts/ace_vimtura/lib/require.js
98
+ - app/assets/javascripts/ace_vimtura/main.js
99
+ - app/assets/javascripts/ace_vimtura/preview.js
100
+ - app/assets/javascripts/ace_vimtura/renderers/haml.js
101
+ - app/assets/javascripts/ace_vimtura/renderers/html.js
102
+ - app/assets/javascripts/ace_vimtura/renderers/jade.js
103
+ - app/assets/javascripts/ace_vimtura/renderers/markdown.js
104
+ - app/assets/javascripts/ace_vimtura/style.js
105
+ - bin/console
106
+ - bin/setup
107
+ - lib/ace_vimtura/rails.rb
108
+ - lib/ace_vimtura/rails/engine.rb
109
+ - lib/ace_vimtura/rails/version.rb
110
+ homepage: http://github.com/d-theus/ace_vimtura-rails
111
+ licenses: []
112
+ metadata: {}
113
+ post_install_message:
114
+ rdoc_options: []
115
+ require_paths:
116
+ - lib
117
+ required_ruby_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ required_rubygems_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ requirements: []
128
+ rubyforge_project:
129
+ rubygems_version: 2.4.5
130
+ signing_key:
131
+ specification_version: 4
132
+ summary: Rails wrapper for http://github.com/d-theus/ace_vimtura
133
+ test_files: []