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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +69 -12
  3. data/lib/playground/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b917e43620b4e703b4b826f87f5be69b7c541d79be6d47637d95e8375e31017c
4
- data.tar.gz: c45d1fb0ce17fd85cc8151d57a27139caa51f902e2fb513afe53e8c9cd3d6b9f
3
+ metadata.gz: 0e6f391f1502b01239960e5145d05b49ae9755005752522da1c03e99d2370432
4
+ data.tar.gz: 1ab8fa50c4af8d581acaf3481eb2084ba8623059dd590ba0a4e8860c22c56327
5
5
  SHA512:
6
- metadata.gz: dd51b76541ea6d549d3dfa0df68b575e07e2f57f0e6010fc3239c87597d8ba5dba5302d193905ca3a95fe077732c016227d4ce1ea05b26e6afa849f7db226411
7
- data.tar.gz: 5820201bf6cb9220511d7ffa66a4048b535c14cc908648037f063cf278db2ff07653d8e202f572f8e0feb9434153ae79b8c77541eb1d4338f242c13617e9c865
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
- ![CleanShot 2022-03-12 at 23 41 03](https://user-images.githubusercontent.com/7149034/158014859-47625c95-aa59-489a-9681-eb36e378dcba.gif)
5
+ ![playground-demo](https://user-images.githubusercontent.com/7149034/158045230-3129bf4e-8eeb-4096-9293-04a8c6003bed.gif)
6
6
 
7
- Inspired by the Go playground and SQL Server Management Studio (SSMS) Query Editor, `playground` is a rails engine that makes it really easy to experiment with your application domain.
7
+ ## Features
8
8
 
9
- In addition to a web console, `playground` comes with a script management feature to help your personal and team development. It allows you to:
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
- This way, shared scripts stay close to the code and more maintainable while your personal script do not pollute the git history.
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
- Playground is built on top of `web-console` gem. Just like `web-console`, `playground` is only meant to be used in development. Every `web-console` information still holds true for `playground`. Check `web-console` [repository for more information](https://github.com/rails/web-console)
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
- You can require `playground` after `web-console` in your Gemfile if you already use it.
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
- Then mount `playground` 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.
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.
@@ -1,3 +1,3 @@
1
1
  module Playground
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-playground
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre Barret