idecoder 0.1.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 +7 -0
- data/.gitignore +9 -0
- data/.idea/.gitignore +2 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/idecoder.iml +18 -0
- data/.idea/inspectionProfiles/Project_Default.xml +6 -0
- data/.idea/misc.xml +7 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vcs.xml +6 -0
- data/.travis.yml +6 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +75 -0
- data/Rakefile +10 -0
- data/app/assets/javascripts/idecoder.js +29 -0
- data/app/assets/stylesheets/idecoder.css +0 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/commands.txt +1 -0
- data/idecoder.gemspec +31 -0
- data/lib/idecoder.rb +1 -0
- data/lib/idecoder/rails.rb +12 -0
- data/lib/idecoder/rails/version.rb +3 -0
- data/lib/idecoder/templates/idecoder.erb +4 -0
- data/lib/idecoder/view_helpers.rb +15 -0
- data/railtie.rb +8 -0
- data/script_inserter.rb +21 -0
- metadata +72 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4d9869de16697b705c0007375503b299911a714e7d9f9c8dc1ca07627356f277
|
4
|
+
data.tar.gz: 06c013b75b5b6ce94177f1517b81e0fd6eed06f76dafe4bbf88ecce9b10c2eee
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6a336ee96dd385099d3da23d0d58eb32377628204998fae1d255af09af9a4d87e1f0357a321a2e248ecbd5f5e5146276a2d3b959e18a915b1e77d7b9fe40bf88
|
7
|
+
data.tar.gz: 9fedafe1434276575b22e3d27de4e247a2cead2ffa7e50f63dfbf0340eed6085657b52ce71c026b179dccbfe544cfb89db90546730627418da4ec3600fae2105
|
data/.gitignore
ADDED
data/.idea/.gitignore
ADDED
data/.idea/.rakeTasks
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
3
|
+
You are allowed to:
|
4
|
+
1. Remove rake task
|
5
|
+
2. Add existing rake tasks
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build idecoder-0.1.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install idecoder-0.1.0.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install idecoder-0.1.0.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v0.1.0 and build and push idecoder-0.1.0.gem to TODO: Set to 'http://mygemserver.com'" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="Run tests" fullCmd="test" taksId="test" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
|
data/.idea/idecoder.iml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="ModuleRunConfigurationManager">
|
4
|
+
<shared />
|
5
|
+
</component>
|
6
|
+
<component name="NewModuleRootManager">
|
7
|
+
<content url="file://$MODULE_DIR$">
|
8
|
+
<sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
|
9
|
+
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
10
|
+
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
11
|
+
</content>
|
12
|
+
<orderEntry type="inheritedJdk" />
|
13
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.1.4, RVM: ruby-2.6.3) [gem]" level="application" />
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.14.1, RVM: ruby-2.6.3) [gem]" level="application" />
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v12.3.2, RVM: ruby-2.6.3) [gem]" level="application" />
|
17
|
+
</component>
|
18
|
+
</module>
|
data/.idea/misc.xml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="JavaScriptSettings">
|
4
|
+
<option name="languageLevel" value="ES6" />
|
5
|
+
</component>
|
6
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-2.6.3" project-jdk-type="RUBY_SDK" />
|
7
|
+
</project>
|
data/.idea/modules.xml
ADDED
data/.idea/vcs.xml
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 michel popolin
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
# Idecoder gem
|
2
|
+
|
3
|
+
[](http://badge.fury.io/rb/idecoder)
|
4
|
+
|
5
|
+
Idecoder was created for developers building web applications with coding editors. Idecoder.js provides a plugin that gives the developer a screen inside their own app
|
6
|
+
to give the users a way to develop codes.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
gem 'idecoder'
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install idecoder
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
Simply add the `render_idecoder` helper method to your Rails layout or to any specific page you wish.
|
24
|
+
|
25
|
+
<pre>
|
26
|
+
<html>
|
27
|
+
<head>...</head>
|
28
|
+
<body>
|
29
|
+
<h1>My Content</h1>
|
30
|
+
...
|
31
|
+
<%= render_idecoder %>
|
32
|
+
</body>
|
33
|
+
</html>
|
34
|
+
</pre>
|
35
|
+
|
36
|
+
To add options to the Idecoder plugin, simply pass them as a _Hash_ to the helper method:
|
37
|
+
|
38
|
+
<pre>
|
39
|
+
# Switching to Haml
|
40
|
+
%html
|
41
|
+
%head
|
42
|
+
... something ...
|
43
|
+
%body
|
44
|
+
%h1 Any content
|
45
|
+
... something ...
|
46
|
+
|
47
|
+
= render_idecoder {language: 'sql', read_only: 'false'}
|
48
|
+
</pre>
|
49
|
+
|
50
|
+
If you wish to have Idecoder in your production and/or staging environment, pass the last argument of `false`:
|
51
|
+
|
52
|
+
<pre>
|
53
|
+
= render_idecoder {language: 'ruby', read_only: 'false'}, <i style='color: #c00'>false</i>
|
54
|
+
</pre>
|
55
|
+
|
56
|
+
### Options
|
57
|
+
|
58
|
+
| Value | Default | Description |
|
59
|
+
|----------|----------|------------------------------------------|
|
60
|
+
| language | ruby | select the language used in editor. See below for options |
|
61
|
+
| read_only | true | Does not allow the user to make changes in databases |
|
62
|
+
|
63
|
+
|
64
|
+
**Dependencies**
|
65
|
+
|
66
|
+
Marx.Idecoder has a dependency on jQuery version >= 1.10.x
|
67
|
+
|
68
|
+
|
69
|
+
## Contributing
|
70
|
+
|
71
|
+
1. Fork it ( https://github.com/popolin/idecoder/fork )
|
72
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
73
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
74
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
75
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
window.Idecoder = function(options) {
|
2
|
+
var _this = this;
|
3
|
+
this._url = "http://marxjs.com";
|
4
|
+
return _this.initialize(options);
|
5
|
+
};
|
6
|
+
|
7
|
+
$.extend(Idecoder.prototype, {
|
8
|
+
settings: {
|
9
|
+
language: 'ruby',
|
10
|
+
read_only: false,
|
11
|
+
},
|
12
|
+
initialize: function(options) {
|
13
|
+
$.extend(this.settings);
|
14
|
+
return this.create_canvas();
|
15
|
+
},
|
16
|
+
/*=========================
|
17
|
+
BUILD CONTROLS
|
18
|
+
=========================
|
19
|
+
*/
|
20
|
+
|
21
|
+
create_canvas: function() {
|
22
|
+
var _this = this;
|
23
|
+
$('body').append("<div class=\"idecoder-js \">\n <link rel=\"stylesheet\" href=\"/assets/stylesheets/idecoder.css\">\n</div>");
|
24
|
+
},
|
25
|
+
$: function(el) {
|
26
|
+
return this.$el.find(el);
|
27
|
+
},
|
28
|
+
|
29
|
+
});
|
File without changes
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "idecoder"
|
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(__FILE__)
|
data/bin/setup
ADDED
data/commands.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
gem build idecoder
|
data/idecoder.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require_relative 'lib/idecoder/rails/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "idecoder"
|
5
|
+
spec.version = Idecoder::VERSION
|
6
|
+
spec.authors = ["michel popolin"]
|
7
|
+
spec.email = ["micpopolin@gmail.com"]
|
8
|
+
|
9
|
+
spec.summary = %q{This creates code editor to use in your project.}
|
10
|
+
spec.description = %q{Now you can easily put an editor inside your project. With environment variables reader and autocompletes.}
|
11
|
+
spec.homepage = "https://github.com/popolin/idecoder"
|
12
|
+
spec.license = "MIT"
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
14
|
+
|
15
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
16
|
+
|
17
|
+
if spec.respond_to?(:metadata)
|
18
|
+
spec.metadata["allowed_push_host"] = 'https://rubygems.org'
|
19
|
+
else
|
20
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
21
|
+
end
|
22
|
+
|
23
|
+
# Specify which files should be added to the gem when it is released.
|
24
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
26
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
27
|
+
end
|
28
|
+
spec.bindir = "exe"
|
29
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
|
+
spec.require_paths = ["lib"]
|
31
|
+
end
|
data/lib/idecoder.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'idecoder/rails' if defined?(Rails)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'erb'
|
2
|
+
|
3
|
+
module Marxjs
|
4
|
+
module ViewHelpers
|
5
|
+
include ActionView::Helpers::OutputSafetyHelper
|
6
|
+
|
7
|
+
def render_idecoder options={}, dev_only=true
|
8
|
+
if dev_only == false || (dev_only && ::Rails.env.development?)
|
9
|
+
binding.local_variable_set(:options, options.to_json)
|
10
|
+
template_file = ::File.read(::File.expand_path('../templates/idecoder.erb', __FILE__))
|
11
|
+
raw ERB.new(template_file).result(binding)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/railtie.rb
ADDED
data/script_inserter.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
module Idecoder
|
2
|
+
module ScriptInserter
|
3
|
+
BODY_TAG = %r{</body>}
|
4
|
+
|
5
|
+
JS_SCRIPT = %q{
|
6
|
+
<script src='idecoder.js'></script>
|
7
|
+
<script>
|
8
|
+
var idecoder = new Idecoder()
|
9
|
+
</script>
|
10
|
+
}
|
11
|
+
|
12
|
+
def insert_idecoder
|
13
|
+
if (
|
14
|
+
response.content_type == 'text/html' &&
|
15
|
+
response.body.match(BODY_TAG)
|
16
|
+
)
|
17
|
+
response.body = response.body.gsub(BODY_TAG, JS_SCRIPT + '\\0')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: idecoder
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- michel popolin
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-09-08 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Now you can easily put an editor inside your project. With environment
|
14
|
+
variables reader and autocompletes.
|
15
|
+
email:
|
16
|
+
- micpopolin@gmail.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- ".gitignore"
|
22
|
+
- ".idea/.gitignore"
|
23
|
+
- ".idea/.rakeTasks"
|
24
|
+
- ".idea/idecoder.iml"
|
25
|
+
- ".idea/inspectionProfiles/Project_Default.xml"
|
26
|
+
- ".idea/misc.xml"
|
27
|
+
- ".idea/modules.xml"
|
28
|
+
- ".idea/vcs.xml"
|
29
|
+
- ".travis.yml"
|
30
|
+
- Gemfile
|
31
|
+
- LICENSE.txt
|
32
|
+
- README.md
|
33
|
+
- Rakefile
|
34
|
+
- app/assets/javascripts/idecoder.js
|
35
|
+
- app/assets/stylesheets/idecoder.css
|
36
|
+
- bin/console
|
37
|
+
- bin/setup
|
38
|
+
- commands.txt
|
39
|
+
- idecoder.gemspec
|
40
|
+
- lib/idecoder.rb
|
41
|
+
- lib/idecoder/rails.rb
|
42
|
+
- lib/idecoder/rails/version.rb
|
43
|
+
- lib/idecoder/templates/idecoder.erb
|
44
|
+
- lib/idecoder/view_helpers.rb
|
45
|
+
- railtie.rb
|
46
|
+
- script_inserter.rb
|
47
|
+
homepage: https://github.com/popolin/idecoder
|
48
|
+
licenses:
|
49
|
+
- MIT
|
50
|
+
metadata:
|
51
|
+
homepage_uri: https://github.com/popolin/idecoder
|
52
|
+
allowed_push_host: https://rubygems.org
|
53
|
+
post_install_message:
|
54
|
+
rdoc_options: []
|
55
|
+
require_paths:
|
56
|
+
- lib
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.3.0
|
62
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
requirements: []
|
68
|
+
rubygems_version: 3.0.8
|
69
|
+
signing_key:
|
70
|
+
specification_version: 4
|
71
|
+
summary: This creates code editor to use in your project.
|
72
|
+
test_files: []
|