Latest 0.1.3
Homepage https://github.com/siuying/IGJavaScriptConsole
License MIT
Platforms ios 7.0, requires ARC
Dependencies CocoaHTTPServer, JavaScriptCoreOpalAdditions, CocoaLumberjack
Frameworks JavaScriptCore
Authors

A JavaScript/Ruby REPL for your Objective-C apps.

https://i0.wp.com/f.cl.ly/items/2I3v1c0T001E2K1i1l2l/console.gif?w=1080

Check the blog post for more details.

Why?

With iOS 7 shipped with JavaScriptCore, we can now run Opal (a JavaScript
based ruby implementation) on iOS to extend the app dynamically.

Theres one major problem however, to compile the Ruby to JavaScript,
then compile the app, install it and run takes a lot of time. What
if we have a REPL that let us dynamically define and run Ruby code and
run on device or simulator in realtime?

Implementation

  • Opal A Ruby to JavaScript compiler. It even come with sprockets extension which lets you bundle the compiled script easily.
  • JavaScriptCoreOpalAdditions A thin layer of Objective-C that load and provides native features to Opal.
  • jqConsole Web based terminal.
  • Ace Web based code editor with syntax highlighting.
  • CocoaHTTPServer HTTP and WebSocket server for realtime communication
    between iOS and desktop.

Installation

Add following lines to your Podfile:

pod 'IGJavaScriptConsole', '~> 0.1.3'

Usage

To start a console, create a server by supply a JSContext and language.

#import "IGJavaScriptConsoleServer.h"

NSError* error;
self.server = [[IGJavaScriptConsoleServer alloc] initWithContext:context
                                                        language:IGJavaScriptConsoleServerLanguageRuby];
self.server.port = 3300;
if (![self.server start:&error]) {
    DDLogError(@"error: %@", error);
}

Connect your browser to your device at 3300 port (e.g. http://localhost:3300)
to connect to the console.

License

MIT License. See License.txt.

Latest podspec

{
    "name": "IGJavaScriptConsole",
    "version": "0.1.3",
    "summary": "Ruby REPL for your Objective-C apps.",
    "homepage": "https://github.com/siuying/IGJavaScriptConsole",
    "license": {
        "type": "MIT",
        "file": "LICENSE.txt"
    },
    "authors": {
        "Francis Chong": "[email protected]"
    },
    "source": {
        "git": "https://github.com/siuying/IGJavaScriptConsole.git",
        "tag": "0.1.3"
    },
    "source_files": "IGJavaScriptConsole/Server/**/*.{h,m}",
    "resources": "JavaScriptApp/JavaScriptConsoleWeb.bundle",
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "frameworks": "JavaScriptCore",
    "dependencies": {
        "CocoaHTTPServer": [
            "~> 2.3"
        ],
        "JavaScriptCoreOpalAdditions": [
            "~> 0.3.0"
        ],
        "CocoaLumberjack": [
            ">= 1.6.4"
        ]
    }
}

Pin It on Pinterest

Share This