parade-liveruby 0.0.1

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.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in parade-liveruby.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Franklin Webber
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # Parade::Liveruby
2
+
3
+ Provide live execution of ruby code for Parade
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'parade-liveruby'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install parade-liveruby
18
+
19
+ ## Usage
20
+
21
+ Require it in your `parade` file:
22
+
23
+ ```ruby
24
+ require 'parade-liveruby'
25
+
26
+ title "Example Presentation"
27
+
28
+ description "My Awesome Presentation"
29
+
30
+ section "Introduction" do
31
+ slides "intro.md"
32
+ slides "installation.md"
33
+ slides "navigation.md"
34
+ end
35
+ ```
36
+
37
+ Require it in your `config.ru` file:
38
+
39
+ ```ruby
40
+ require "parade"
41
+ require "parade-liveruby"
42
+ run Parade::Server.new
43
+ ```
44
+
45
+ ## Contributing
46
+
47
+ 1. Fork it
48
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
49
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
50
+ 4. Push to the branch (`git push origin my-new-feature`)
51
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,31 @@
1
+ require "parade-liveruby/version"
2
+
3
+ module Parade
4
+ module Liveruby
5
+ extend self
6
+
7
+ module Server
8
+ def self.included(server)
9
+ server.get '/eval_ruby' do
10
+ eval_ruby(params[:code])
11
+ end
12
+ end
13
+
14
+ def eval_ruby(code)
15
+ eval(code).to_s
16
+ rescue => exception
17
+ exception.message
18
+ end
19
+ end
20
+
21
+ def javascript_file
22
+ File.expand_path(File.join(File.dirname(__FILE__),"parade-liveruby","parade-liveruby.js"))
23
+ end
24
+
25
+ end
26
+
27
+ Server.register Liveruby::Server
28
+
29
+ Server.register_javascript Liveruby.javascript_file
30
+
31
+ end
@@ -0,0 +1,19 @@
1
+ $(document).ready(function() {
2
+
3
+ var rubyInvocation = function(code) {
4
+ $.get('/eval_ruby', { code: code }, function(result) {
5
+ if (result != null) { $.publish('code:execution:results',result); }
6
+ $.publish('code:execution:finished');
7
+ });
8
+ };
9
+
10
+ // Register ruby with the code executor
11
+ codeExecutor.registerVisibleCodeBlock('ruby',$('.execute .ruby pre:visible'),rubyInvocation);
12
+
13
+ $('.execute pre.ruby').live("click", function() {
14
+ var code = $(this).text();
15
+ $.publish('code:execute',{ lang: 'ruby', code: code, elem: $(this) });
16
+ });
17
+
18
+
19
+ });
@@ -0,0 +1,5 @@
1
+ module Parade
2
+ module Liveruby
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'parade-liveruby/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "parade-liveruby"
8
+ gem.version = Parade::Liveruby::VERSION
9
+ gem.authors = ["Franklin Webber"]
10
+ gem.email = ["franklin.webber@gmail.com"]
11
+ gem.description = %q{Adds the ability to evaluate ruby code live within a Parade presentation}
12
+ gem.summary = %q{Adds the ability to evaluate ruby code live within a Parade presentation}
13
+ gem.homepage = "https://github.com/burtlo/parade-liveruby"
14
+ gem.license = "MIT"
15
+
16
+ gem.files = `git ls-files`.split($/)
17
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
+ gem.require_paths = ["lib"]
20
+ end
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: parade-liveruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Franklin Webber
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-03-05 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Adds the ability to evaluate ruby code live within a Parade presentation
15
+ email:
16
+ - franklin.webber@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - .gitignore
22
+ - Gemfile
23
+ - LICENSE.txt
24
+ - README.md
25
+ - Rakefile
26
+ - lib/parade-liveruby.rb
27
+ - lib/parade-liveruby/parade-liveruby.js
28
+ - lib/parade-liveruby/version.rb
29
+ - parade-liveruby.gemspec
30
+ homepage: https://github.com/burtlo/parade-liveruby
31
+ licenses:
32
+ - MIT
33
+ post_install_message:
34
+ rdoc_options: []
35
+ require_paths:
36
+ - lib
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ! '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ! '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ requirements: []
50
+ rubyforge_project:
51
+ rubygems_version: 1.8.25
52
+ signing_key:
53
+ specification_version: 3
54
+ summary: Adds the ability to evaluate ruby code live within a Parade presentation
55
+ test_files: []