opal-rails-web_console 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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ee8ed7a9be7be9cd7c432a8687495ef9015df9d0
4
+ data.tar.gz: d7680b5d7ec60375e7634adcd6f54bf44bdd7c96
5
+ SHA512:
6
+ metadata.gz: c0877a695adf09daf705226853699a0687b55c02147684365a605508302c7e0a049f0ec042874e82651bad35375f3de5357a95afba8e438997c0603b27d2082b
7
+ data.tar.gz: 3a5248d1e116e9350b7c2343f9d24a2d5772761be035b633c0d892e588090e5403801b825029da70e5de906747c45918e81cdefbca383ac7739a131ebf440492
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /.DS_Store
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.2
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in opal-rails-web_console.gemspec
4
+ gemspec
5
+
6
+ gem 'opal-irb', github: 'fkchang/opal-irb'
@@ -0,0 +1,48 @@
1
+ # Opal::Rails::WebConsole
2
+
3
+ Enable to type ruby codes in an interactive web console for opal on the browser for Ruby on Rails applications, just like the rails web-console
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'opal-irb', github: 'fkchang/opal-irb'
11
+ gem 'opal-rails-web_console'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ ## Usage
19
+
20
+ ### require javascript e.g.: `application.js.rb`
21
+
22
+ require 'opal-rails_web_console'
23
+
24
+ ### require stylesheet e.g.: `application.css`
25
+
26
+ *= require opal-rails_web_console
27
+
28
+ ### call helper in layout, e.g.: `application.html.erb`
29
+
30
+ <%= opal_console %>
31
+
32
+ ## Screenshots
33
+
34
+ ![screen shot 2015-08-30 at 7 00 25 pm](https://cloud.githubusercontent.com/assets/71397/9566898/fc9264f4-4f4a-11e5-9489-f2950204a627.png)
35
+
36
+ ## Development
37
+
38
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
39
+
40
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
41
+
42
+ ## Contributing
43
+
44
+ 1. Fork it ( https://github.com/rainchen/opal-rails-web_console/fork )
45
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
46
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
47
+ 4. Push to the branch (`git push origin my-new-feature`)
48
+ 5. Create a new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,8 @@
1
+ //=require 'jquery-ui/dialog'
2
+
3
+ //=require 'codemirror'
4
+ //=require 'codemirror/modes/ruby'
5
+ //=require 'codemirror/keymaps/emacs'
6
+
7
+ //=require 'opal_irb_jqconsole'
8
+ //=require './setup_opal_irb_jqconsole'
@@ -0,0 +1,53 @@
1
+ class OpalWebConsole
2
+ class << self
3
+ def init
4
+ return false if @inited # make sure `init` can be run once only
5
+
6
+ # creates a panel at the bottom
7
+ OpalIrbJqconsole.create_bottom_panel(hidden=false)
8
+
9
+ # add topbar title
10
+ Element.id("opal-irb-console-topbar").prepend(
11
+ %{<span id="opal-irb-console-topbar-title">Web console for Opal #{Opal::VERSION} on ruby #{RUBY_VERSION}</span>}
12
+ )
13
+
14
+ # show how to open web console when closed the web console
15
+ Element.id("collapse-opal-irb-console").on(:click) {
16
+ show_tips if !@show_tips
17
+ }
18
+
19
+ hide_tips
20
+
21
+ @inited = true
22
+ end
23
+
24
+ def show
25
+ OpalIrbJqconsole.show_panel
26
+ end
27
+
28
+ def hide
29
+ OpalIrbJqconsole.hide_panel
30
+ show_tips if !@show_tips
31
+ end
32
+
33
+ def show_tips
34
+ @show_tips = true
35
+ show_cmd = if defined? Opal.eval
36
+ 'Opal.eval("OpalWebConsole.show")'
37
+ else
38
+ 'Opal.OpalWebConsole.$show()'
39
+ end
40
+ puts "OpalWebConsole Tips: run `#{show_cmd}` in browser console to show web console"
41
+ end
42
+
43
+ def hide_tips
44
+ hide_cmd = if defined? Opal.eval
45
+ 'Opal.eval("OpalWebConsole.hide")'
46
+ else
47
+ 'Opal.OpalWebConsole.$hide()'
48
+ end
49
+
50
+ puts "OpalWebConsole Tips: run `#{hide_cmd}` in browser console to hide web console"
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,17 @@
1
+ /*
2
+ *= require jquery-ui/dialog
3
+ *= require codemirror
4
+ *= require opal-irb/jqconsole
5
+ *= require_self
6
+ */
7
+
8
+ #opal-irb-console {
9
+ /* use same color as rails web-console */
10
+ background-color: #333;
11
+ height: 200px;
12
+ }
13
+
14
+ #opal-irb-console-topbar-title {
15
+ display: inline-block; vertical-align: middle; /* vertical center */
16
+ text-indent: 6px;
17
+ }
@@ -0,0 +1,5 @@
1
+ module OpalWebConsoleHelper
2
+ def opal_console
3
+ javascript_tag %{Opal.OpalWebConsole.$init()}
4
+ end
5
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "opal/rails/web_console"
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,14 @@
1
+ require "opal/rails/web_console/version"
2
+ require "opal/rails/web_console/engine"
3
+
4
+ require "opal-irb-rails"
5
+ require "codemirror-rails"
6
+ require "jquery-ui-rails"
7
+
8
+ module Opal
9
+ module Rails
10
+ module WebConsole
11
+ # Your code goes here...
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,8 @@
1
+ module Opal
2
+ module Rails
3
+ module WebConsole
4
+ class Engine < ::Rails::Engine
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ module Opal
2
+ module Rails
3
+ module WebConsole
4
+ VERSION = "0.1.0"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'opal/rails/web_console/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "opal-rails-web_console"
8
+ spec.version = Opal::Rails::WebConsole::VERSION
9
+ spec.authors = ["RainChen"]
10
+ spec.email = ["hirainchen@gmail.com"]
11
+
12
+ spec.summary = %q{Interactive web console for opal on the browser for Ruby on Rails applications}
13
+ spec.description = %q{Enable to type ruby codes in an interactive web console for opal on the browser for Ruby on Rails applications, just like the rails web-console}
14
+ spec.homepage = "https://github.com/rainchen/opal-rails-web_console"
15
+
16
+ spec.license = "MIT"
17
+
18
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ spec.bindir = "exe"
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.9"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+
26
+ spec.add_dependency "opal-irb", ">= 0"
27
+ spec.add_dependency "jquery-ui-rails", ">= 0"
28
+ spec.add_dependency "codemirror-rails", ">= 0"
29
+ end
metadata ADDED
@@ -0,0 +1,131 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: opal-rails-web_console
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - RainChen
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-08-30 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
+ - !ruby/object:Gem::Dependency
42
+ name: opal-irb
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: jquery-ui-rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: codemirror-rails
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Enable to type ruby codes in an interactive web console for opal on the
84
+ browser for Ruby on Rails applications, just like the rails web-console
85
+ email:
86
+ - hirainchen@gmail.com
87
+ executables: []
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - ".rspec"
93
+ - ".travis.yml"
94
+ - Gemfile
95
+ - README.md
96
+ - Rakefile
97
+ - app/assets/javascripts/opal-rails_web_console.js
98
+ - app/assets/javascripts/setup_opal_irb_jqconsole.js.rb
99
+ - app/assets/stylesheets/opal-rails_web_console.css
100
+ - app/helpers/opal_web_console_helper.rb
101
+ - bin/console
102
+ - bin/setup
103
+ - lib/opal/rails/web_console.rb
104
+ - lib/opal/rails/web_console/engine.rb
105
+ - lib/opal/rails/web_console/version.rb
106
+ - opal-rails-web_console.gemspec
107
+ homepage: https://github.com/rainchen/opal-rails-web_console
108
+ licenses:
109
+ - MIT
110
+ metadata: {}
111
+ post_install_message:
112
+ rdoc_options: []
113
+ require_paths:
114
+ - lib
115
+ required_ruby_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ requirements: []
126
+ rubyforge_project:
127
+ rubygems_version: 2.4.8
128
+ signing_key:
129
+ specification_version: 4
130
+ summary: Interactive web console for opal on the browser for Ruby on Rails applications
131
+ test_files: []