You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inspired by the Go playground and SQL Server Management Studio (SSMS) Query Editor, `rails-playground` is a rails engine that eases experiments with your application domain.
7
+
## Features
8
+
9
+
### Query Editor
8
10
9
-
In addition to a web console, `rails-playground`comes with a script management feature to help your personal and team development. It allows you to:
11
+
Inspired by the Go playground and SQL Server Management Studio (SSMS) Query Editor, `rails-playground`is a rails engine that eases experiments with your application domain.
10
12
11
-
* use and save gitignored scripts for personal use.
12
-
* use and save version-controller scripts with your team.
13
+
### Script Management
13
14
14
-
This way, shared scripts stay close to the code and more maintainable while your personal script do not pollute the git history.
15
+
The gem also comes with a script management tool to help share useful scripts with your teamates. Shared scripts stay close to the code and become more maintainable while personal scripts are git ignored and don't pollute the git history.
15
16
16
17
## Usage
17
18
19
+
### Query Editor
20
+
18
21
There are three ways to run ruby code in the console:
19
22
20
23
* Select your code in the editor and press cmd+Enter
21
24
* Put your cursor on any line (no selection) and press cmd+Enter
22
25
* Type your code straight in the terminal box just like in a rails console
23
26
27
+
### Script Management
28
+
29
+
Any files under `lib/playground` folder will appear in the sidebar. You can filter them by name from the search input.
30
+
31
+
See [Ignoring personal scripts](#ignoring-personal-scripts) to share scripts with your team while ignoring personal scripts.
32
+
24
33
## Installation
25
34
35
+
### Query Editor
36
+
26
37
Playground is built on top of `web-console` gem. Just like `web-console`, it's only meant to be used in development. Every `web-console` information still holds true for `rails-playground`. Check `web-console`[repository for more information](https://github.com/rails/web-console)
27
38
28
39
Add this line to your application's Gemfile under the development group:
@@ -33,14 +44,14 @@ group :development do
33
44
end
34
45
```
35
46
36
-
_**Naming issue:** The gem was originally supposed to be called `playground` but it already exists in RubyGems... Thus the gem is now called `rails-playground` but the functionality remains under the `playground` namespace for now._
47
+
_**Naming issue:** The gem was originally called `playground` but it already exists in RubyGems... Thus the gem is now called `rails-playground` but the functionality remains under the `playground` namespace for now._
37
48
38
49
And then execute:
39
50
```bash
40
51
$ bundle
41
52
```
42
53
43
-
Finally mount the engine in your routes file and access the playground at `http://localhost:{PORT}/playground` on your local machine.
54
+
Finally mount the engine in your routes file and access the web playground at `/playground` on your local host.
44
55
45
56
```ruby
46
57
Rails.application.routes.draw do
@@ -49,7 +60,49 @@ Rails.application.routes.draw do
49
60
end
50
61
```
51
62
52
-
_You can choose any relative path and switch from `/playground` to `/rails/play` for example._
63
+
_Nothing stops you from choosing any relative path. For example you could switch from `/playground` to `/rails/play`._
64
+
65
+
### Ignoring personal scripts
66
+
67
+
Adding a folder from lib/playground in `.gitignore` will still show in the sidebar.
68
+
**Decide on a convention** with your teamates and commit the path to your `.gitignore`.
69
+
Unlike any other scripts, any changes made to ignored scripts won't be recorded in your git history.
0 commit comments