rails-playground 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +69 -12
- data/lib/playground/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e6f391f1502b01239960e5145d05b49ae9755005752522da1c03e99d2370432
|
4
|
+
data.tar.gz: 1ab8fa50c4af8d581acaf3481eb2084ba8623059dd590ba0a4e8860c22c56327
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fece1535773657f3f106ea134df148c183c4ba06eb4e58cf40a65207f99525292183eb71ef33bf377e3eb70427866027820f12807db152dfbbabf3b95d649ec1
|
7
|
+
data.tar.gz: 1710240c7197c094694d05cf5841643e2123af21fbe62c3d9018bb279b65d08af95b3cceb456273d221667e826eb4af1dbc1f27d4e3341af26bfaefe689c0d37
|
data/README.md
CHANGED
@@ -1,45 +1,58 @@
|
|
1
|
-
# Playground
|
1
|
+
# (Rails) Playground
|
2
2
|
|
3
3
|
Back-and-forths from your editor and your rails console is a thing of the past!
|
4
4
|
|
5
|
-
![
|
5
|
+
![playground-demo](https://user-images.githubusercontent.com/7149034/158045230-3129bf4e-8eeb-4096-9293-04a8c6003bed.gif)
|
6
6
|
|
7
|
-
|
7
|
+
## Features
|
8
8
|
|
9
|
-
|
10
|
-
* use and save gitignored scripts for personal use.
|
11
|
-
* use and save version-controller scripts with your team.
|
9
|
+
### Query Editor
|
12
10
|
|
13
|
-
|
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.
|
12
|
+
|
13
|
+
### Script Management
|
14
|
+
|
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.
|
14
16
|
|
15
17
|
## Usage
|
16
18
|
|
19
|
+
### Query Editor
|
20
|
+
|
17
21
|
There are three ways to run ruby code in the console:
|
18
22
|
|
19
23
|
* Select your code in the editor and press cmd+Enter
|
20
24
|
* Put your cursor on any line (no selection) and press cmd+Enter
|
21
25
|
* Type your code straight in the terminal box just like in a rails console
|
22
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
|
+
|
23
33
|
## Installation
|
24
34
|
|
25
|
-
|
35
|
+
### Query Editor
|
26
36
|
|
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
|
-
|
29
|
-
Add this line to your application's Gemfile:
|
39
|
+
Add this line to your application's Gemfile under the development group:
|
30
40
|
|
31
41
|
```ruby
|
32
42
|
group :development do
|
33
|
-
gem "playground"
|
43
|
+
gem "rails-playground", require: "playground"
|
34
44
|
end
|
35
45
|
```
|
36
46
|
|
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._
|
48
|
+
|
37
49
|
And then execute:
|
38
50
|
```bash
|
39
51
|
$ bundle
|
40
52
|
```
|
41
53
|
|
42
|
-
|
54
|
+
Finally mount the engine in your routes file and access the web playground at `/playground` on your local host.
|
55
|
+
|
43
56
|
```ruby
|
44
57
|
Rails.application.routes.draw do
|
45
58
|
mount Playground::Engine => "/playground"
|
@@ -47,6 +60,50 @@ Rails.application.routes.draw do
|
|
47
60
|
end
|
48
61
|
```
|
49
62
|
|
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.
|
70
|
+
|
71
|
+
**Example**
|
72
|
+
|
73
|
+
Here is an example of file structure
|
74
|
+
|
75
|
+
* scripts version controlled
|
76
|
+
* lib/playground/shared_script_a.rb
|
77
|
+
* lib/playground/shared_script_b.rb
|
78
|
+
* lib/playground/namespace/shared_script_c.rb
|
79
|
+
* scripts ignored
|
80
|
+
* lib/playground/my_scripts/my_script_a.rb
|
81
|
+
* lib/playground/my_scripts/my_script_b.rb
|
82
|
+
|
83
|
+
```
|
84
|
+
.gitignore
|
85
|
+
|
86
|
+
/lib/playground/my_scripts/
|
87
|
+
```
|
88
|
+
|
89
|
+
```
|
90
|
+
my_app/
|
91
|
+
├─ app/
|
92
|
+
├─ bin/
|
93
|
+
├─ config/
|
94
|
+
├─ db/
|
95
|
+
├─ lib/
|
96
|
+
│ ├─ playground/
|
97
|
+
│ │ ├─ namespace/
|
98
|
+
│ │ │ ├─ shared_script_c.rb
|
99
|
+
│ │ ├─ my_scripts/
|
100
|
+
│ │ │ ├─ my_script_a.rb
|
101
|
+
│ │ │ ├─ my_script_b.rb
|
102
|
+
│ │ ├─ shared_script_a.rb
|
103
|
+
│ │ ├─ shared_script_b.rb
|
104
|
+
├─ .gitignore
|
105
|
+
```
|
106
|
+
|
50
107
|
## Troubleshouting
|
51
108
|
|
52
109
|
### Session :id is no longer available in memory.
|
data/lib/playground/version.rb
CHANGED