idecoder 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ *.gem
@@ -0,0 +1,2 @@
1
+ # Default ignored files
2
+ /workspace.xml
@@ -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>
@@ -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>
@@ -0,0 +1,6 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="Rubocop" enabled="false" level="WARNING" enabled_by_default="false" />
5
+ </profile>
6
+ </component>
@@ -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>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/idecoder.iml" filepath="$PROJECT_DIR$/.idea/idecoder.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.6.3
6
+ before_install: gem install bundler -v 2.1.4
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in idecoder.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
7
+ gem "minitest", "~> 5.0"
@@ -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.
@@ -0,0 +1,75 @@
1
+ # Idecoder gem
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/idecoder.svg)](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
+ &lt;html>
27
+ &lt;head>...&lt;/head>
28
+ &lt;body>
29
+ &lt;h1>My Content&lt;/h1>
30
+ ...
31
+ &lt;%= render_idecoder %>
32
+ &lt;/body>
33
+ &lt;/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
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :default => :test
@@ -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
@@ -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__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1 @@
1
+ gem build idecoder
@@ -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
@@ -0,0 +1 @@
1
+ require 'idecoder/rails' if defined?(Rails)
@@ -0,0 +1,12 @@
1
+ require "idecoder/rails/version"
2
+ require "idecoder/view_helpers"
3
+
4
+ module Marxjs
5
+ module Rails
6
+ class Engine < ::Rails::Engine
7
+ initializer "idecoder.view_helpers" do
8
+ ActionView::Base.send :include, ViewHelpers
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,3 @@
1
+ module Idecoder
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,4 @@
1
+ <script src="assets/idecoder.js"></script>
2
+ <script>
3
+ var idecoder = new Idecoder(<%= options %>);
4
+ </script>
@@ -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
@@ -0,0 +1,8 @@
1
+ module Idecoder
2
+ class Railtie < Rails::Railtie
3
+ initializer "idecoder" do |app|
4
+ ActionController::Base.send include: Idecoder::ScriptInserter
5
+ ActionController::Base.after_filter :insert_idecoder
6
+ end
7
+ end
8
+ end
@@ -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: []