<commit_before>= WebTools Example

The WebTools Sinatra application running in MagLev allows you to explore a
MagLev Ruby application's Classes, Modules, Methods, Constants, and Ancestors 
in a web browser.

It will also allow you to explore GemStone/S Smalltalk code, and to examine
detailed statistics about all processes connected to GemStone/S.

=== Setup

1. Download and install MagLev using instructions at https://github.com/MagLev/maglev/blob/master/README.rdoc
2. Start the MagLev server
    $ maglev start
3. Install necessary gems:
    $ bundle install
    ### Temporary workaround for https://magtrac.gemstone.com/ticket/879 ###
    $ maglev-gem pristine rack

== Viewing Ruby code

Run the WebTools Sinatra application

    $ rake

This will start WEBrick in your current window. Hit Ctl-C to stop.

Browse to http://localhost:9292/, click on a class or module, then
click on a constant or method. Results appear in the bottom pane.
File locations with line numbers appear at the bottom. Time spent on
the server/network/client appear at the top,

=== Add classes and modules from ActiveModel

    $ rake meta

Click on "Refresh View" in WebTools. Note that AValidPerson now appears in the
class list, as do a number of classes/modules from ActiveModel and ActiveSupport.

Click on the class AValidPerson and compare it with the source
(meta_demo.rb).  Some things to note:

1. You get to see all of the methods written by metaprogramming.
2. You can see the file and line number of the code that generated each
   method. This makes it simpler to track down which part of ActiveWhatever
   is messing with your code.

=== Modify meta_demo.rb and view updates

Edit the file meta_demo.rb. Add :age to both validates_presence_of and attr_accessor.
The changed lines should look like

    validates_presence_of :first_name, :last_name, :age
    attr_accessor :first_name, :last_name, :age

Then

    $ rake meta

Click on "Refresh View" in WebTools. AValidPerson will now include the
new instance methods age and age=.

=== Add some data

    $ rake demodata

Click on "Refresh View" in WebTools. Note that AAADemo now appears in the
class list. Click on the class AAADemo and compare it with the source
(demo_data.rb). 

== Viewing GemStone/S code, processes and statistics

The code for this example was inspired by the Smalltalk example found in
$MAGLEV_HOME/gemstone/examples/www.  The smalltalk example code can be
invoked from ruby (a demonstration of how to invoke Smalltalk from Ruby),
via:

  $ rake smalltalk:run

Then browse to http://localhost:8080/ and explore

Hit Ctl-C in the terminal window to stop.

== Known problems

Network timeouts are not caught. EAGAIN is not handled. If you're running WebTools on
a slow network, this may cause data to not appear in the bottom pane.

The line number displayed for evals is always 2. This will be fixed at a later date.

== Contributing
 
* Fork the project from https://github.com/MagLev/webtools
* Start a feature or topic branch
* Commit and push until you are happy with your contribution
* Add some tests to ensure we don't break things in a future release
* Make sure to test with the latest MagLev
* Send a pull request

MagLev Ruby code in this project is MIT licensed. See LICENSE.txt in this directory.
<b>By sending a pull request, you agree your contributed code is also MIT licensed.</b>

This project includes a copy of CodeMirror, copyrighted by <NAME>.
See public/CodeMirror/LICENSE.
<commit_msg>Minor edits to README<commit_after>= WebTools Example

The WebTools Sinatra application running in MagLev allows you to explore a
MagLev Ruby application's Classes, Modules, Methods, Constants, and Ancestors
in a web browser.

It will also allow you to explore GemStone/S Smalltalk code, and to examine
detailed statistics about all processes connected to GemStone/S.

=== Setup

1. Download and install MagLev using instructions at
   https://github.com/MagLev/maglev/blob/master/README.rdoc

2. Start the MagLev server
    $ cd $MAGLEV_HOME
    $ maglev start

3. Install necessary gems:
    $ cd <to this directory>
    $ $MAGLEV_HOME/bin/bundle install

    ### Temporary workaround for https://magtrac.gemstone.com/ticket/879 ###
    $ maglev-gem pristine rack

== Viewing Ruby code

Run the WebTools Sinatra application

    $ rake

This will start WEBrick in your current window. Hit Ctl-C to stop.

Browse to http://localhost:9292/, click on a class or module, then
click on a constant or method. Results appear in the bottom pane.
File locations with line numbers appear at the bottom. Time spent on
the server/network/client appear at the top,

=== Add classes and modules from ActiveModel

    $ rake meta

Click on "Refresh View" in WebTools. Note that AValidPerson now appears in the
class list, as do a number of classes/modules from ActiveModel and ActiveSupport.

Click on the class AValidPerson and compare it with the source
(meta_demo.rb).  Some things to note:

1. You get to see all of the methods written by metaprogramming.
2. You can see the file and line number of the code that generated each
   method. This makes it simpler to track down which part of ActiveWhatever
   is messing with your code.

=== Modify meta_demo.rb and view updates

Edit the file meta_demo.rb. Add :age to both validates_presence_of and attr_accessor.
The changed lines should look like

    validates_presence_of :first_name, :last_name, :age
    attr_accessor :first_name, :last_name, :age

Then

    $ rake meta

Click on "Refresh View" in WebTools. AValidPerson will now include the
new instance methods age and age=.

=== Add some data

    $ rake demodata

Click on "Refresh View" in WebTools. Note that AAADemo now appears in the
class list. Click on the class AAADemo and compare it with the source
(demo_data.rb).

== Viewing GemStone/S code, processes and statistics

The code for this example was inspired by the Smalltalk example found in
$MAGLEV_HOME/gemstone/examples/www.  The smalltalk example code can be
invoked from ruby (a demonstration of how to invoke Smalltalk from Ruby),
via:

  $ rake smalltalk:run

Then browse to http://localhost:8080/ and explore

Hit Ctl-C in the terminal window to stop.

== Known problems

Network timeouts are not caught. EAGAIN is not handled. If you're running WebTools on
a slow network, this may cause data to not appear in the bottom pane.

The line number displayed for evals is always 2. This will be fixed at a later date.

== Contributing

* Fork the project from https://github.com/MagLev/webtools
* Start a feature or topic branch
* Commit and push until you are happy with your contribution
* Add some tests to ensure we don't break things in a future release
* Make sure to test with the latest MagLev
* Send a pull request

MagLev Ruby code in this project is MIT licensed. See LICENSE.txt in this directory.
<b>By sending a pull request, you agree your contributed code is also MIT licensed.</b>

This project includes a copy of CodeMirror, copyrighted by <NAME>.
See public/CodeMirror/LICENSE.

{'fraction_non_alphanumeric': 0.0539389638041164, 'fraction_numerical': 0.004826117814052519, 'mean_word_length': 3.9515108924806746, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '592264', 'n_tokens_mistral': 2019, 'n_tokens_neox': 1917, 'n_words': 1017}