Skip to content

Commit 827d1fa

Browse files
authored
Fish compatibility + copy to clipboard functionality (#1287)
* Add fish shell compatibility in install + Fix some typos * Add lighter scrollbar in codeblocks + add copy code to clipboard icon * Fix side effects
1 parent 1b3ff63 commit 827d1fa

File tree

9 files changed

+111
-53
lines changed

9 files changed

+111
-53
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Guides are located in the `src/actions/guides` directory. You can edit the markd
1818

1919
1. Create a new guide in `src/actions/guides`. Usually it is easiest to copy an existing guide as a starting point
2020
1. Add the guide class to the appropriate category in the [GuidesList](https://github.com/luckyframework/website/blob/main/src/models/guides_list.cr)
21-
1. That's it! View your guide by running `lucky dev` and ginding the guide in the sidebar.
21+
1. That's it! View your guide by running `lucky dev` and finding the guide in the sidebar.
2222

2323
### Learning Lucky
2424

public/assets/icons/copy.svg

Lines changed: 1 addition & 0 deletions
Loading

public/assets/icons/tick.svg

Lines changed: 1 addition & 0 deletions
Loading

src/actions/guides/deploying/heroku.cr

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@ class Guides::Deploying::Heroku < GuideAction
1717
1818
If not already created, create an app:
1919
20-
```plain
20+
```bash
2121
heroku create <APP_NAME>
2222
```
2323
2424
**Optional**: if you created the app through the dashboard instead of the CLI,
2525
add a git remote that points to your Heroku app:
2626
27-
```plain
27+
```bash
2828
heroku git:remote -a <APP-NAME>
2929
```
3030
3131
Add the following buildpacks in order:
3232
33-
```plain
33+
```bash
3434
# Skip this buildpack for API only app. Add this for HTML and Assets
3535
heroku buildpacks:add heroku/nodejs
3636
@@ -40,27 +40,27 @@ class Guides::Deploying::Heroku < GuideAction
4040
4141
Set `LUCKY_ENV` to `production`:
4242
43-
```plain
43+
```bash
4444
heroku config:set LUCKY_ENV=production
4545
```
4646
4747
Set `SECRET_KEY_BASE`:
4848
49-
```plain
49+
```bash
5050
heroku config:set SECRET_KEY_BASE=$(lucky gen.secret_key)
5151
```
5252
5353
Set `APP_DOMAIN`:
5454
55-
```plain
55+
```bash
5656
heroku config:set APP_DOMAIN=https://your-domain.com
5757
```
5858
5959
**If you don't have a custom domain** set this to `https://<APP_NAME>.herokuapp.com`.
6060
6161
Set `SEND_GRID_KEY`:
6262
63-
```plain
63+
```bash
6464
heroku config:set SEND_GRID_KEY=<key from sendgrid.com>
6565
```
6666
@@ -70,13 +70,13 @@ class Guides::Deploying::Heroku < GuideAction
7070
Add a [postgresql database](https://elements.heroku.com/addons/heroku-postgresql)
7171
add-on:
7272
73-
```plain
73+
```bash
7474
heroku addons:create heroku-postgresql:hobby-dev
7575
```
7676
7777
Push to Heroku:
7878
79-
```plain
79+
```bash
8080
git push heroku main
8181
```
8282

src/actions/guides/getting-started/installing.cr

Lines changed: 45 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@ class Guides::GettingStarted::Installing < GuideAction
2626
2727
### 2. Check installation
2828
29-
```plain
29+
```bash
3030
crystal -v
3131
```
3232
3333
Should return between `#{LuckyCliVersion.min_compatible_crystal_version}` and `#{LuckyCliVersion.max_compatible_crystal_version}`
3434
35-
## macOS (M1) requirements
35+
## macOS (Apple Silicon) requirements
3636
3737
### 1. Install Homebrew
3838
3939
Installation instructions from the [Homebrew website](https://brew.sh/)
4040
41-
```plain
41+
```bash
4242
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
4343
```
4444
@@ -48,46 +48,57 @@ class Guides::GettingStarted::Installing < GuideAction
4848
4949
Installation instructions from the [Homebrew website](https://brew.sh/)
5050
51-
```plain
51+
```bash
5252
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
5353
```
5454
5555
### 2. Install OpenSSL
5656
57-
```plain
57+
```bash
5858
brew install openssl
5959
```
6060
6161
### 3. Configure SSL for Crystal
6262
63-
You'll need to tell Crystal how to find OpenSSL by adding an `export`
64-
to your `~/.bash_profile` or `~/.zshrc`.
63+
Add the following line to your shell configuration file. This will let Crystal know where to find OpenSSL.
6564
6665
> You can run `echo $SHELL` in your terminal if you're not sure whether you
67-
are using ZSH or Bash.
66+
are using ZSH, Bash or Fish.
6867
6968
**For ZSH (the default as of macOS Catalina):**
7069
71-
macOS (Intel)
72-
```plain
73-
echo 'export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig' >>~/.zshrc
70+
macOS (Apple Silicon)
71+
```bash
72+
echo 'export PKG_CONFIG_PATH=/opt/homebrew/opt/openssl/lib/pkgconfig' >>~/.zshrc
7473
```
7574
76-
macOS (M1)
77-
```plain
78-
echo 'export PKG_CONFIG_PATH=/opt/homebrew/opt/openssl/lib/pkgconfig' >>~/.zshrc
75+
macOS (Intel)
76+
```bash
77+
echo 'export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig' >>~/.zshrc
7978
```
8079
8180
**For Bash:**
8281
82+
macOS (Apple Silicon)
83+
```bash
84+
echo 'export PKG_CONFIG_PATH=/opt/homebrew/opt/openssl/lib/pkgconfig' >>~/.bash_profile
85+
```
86+
8387
macOS (Intel)
84-
```plain
88+
```bash
8589
echo 'export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig' >>~/.bash_profile
8690
```
8791
88-
macOS (M1)
89-
```plain
90-
echo 'export PKG_CONFIG_PATH=/opt/homebrew/opt/openssl/lib/pkgconfig' >>~/.bash_profile
92+
**For Fish:**
93+
94+
macOS (Apple Silicon)
95+
```bash
96+
echo 'set -gx PKG_CONFIG_PATH /opt/homebrew/opt/openssl/lib/pkgconfig' >> ~/.config/fish/config.fish
97+
```
98+
99+
macOS (Intel)
100+
```bash
101+
echo 'set -gx PKG_CONFIG_PATH /usr/local/opt/openssl/lib/pkgconfig' >> ~/.config/fish/config.fish
91102
```
92103
93104
> If you get an error like this: "Package libssl/libcrypto was not found in the
@@ -100,19 +111,19 @@ class Guides::GettingStarted::Installing < GuideAction
100111
101112
### Debian
102113
103-
```plain
114+
```bash
104115
apt-get install libc6-dev libevent-dev libpcre2-dev libpng-dev libssl-dev libyaml-dev zlib1g-dev
105116
```
106117
107118
### Ubuntu
108119
109-
```plain
120+
```bash
110121
apt-get install libc6-dev libevent-dev libpcre2-dev libpcre3-dev libpng-dev libssl-dev libyaml-dev zlib1g-dev
111122
```
112123
113124
### Fedora (28)
114125
115-
```plain
126+
```bash
116127
dnf install glibc-devel libevent-devel pcre2-devel openssl-devel libyaml-devel zlib-devel libpng-devel
117128
```
118129
@@ -122,15 +133,15 @@ class Guides::GettingStarted::Installing < GuideAction
122133
123134
### 1. Install the Lucky CLI with Homebrew
124135
125-
```plain
136+
```bash
126137
brew install luckyframework/homebrew-lucky/lucky
127138
```
128139
129140
### 3. Check installation
130141
131142
Let's make sure the Lucky CLI installed correctly:
132143
133-
```plain
144+
```bash
134145
lucky -v
135146
```
136147
@@ -140,40 +151,40 @@ class Guides::GettingStarted::Installing < GuideAction
140151
141152
### 1. Clone the CLI repo
142153
143-
```plain
154+
```bash
144155
git clone https://github.com/luckyframework/lucky_cli
145156
```
146157
147158
### 2. Change into the newly cloned directory
148159
149-
```plain
160+
```bash
150161
cd lucky_cli
151162
```
152163
153164
### 3. Check out the latest released version
154165
155-
```plain
166+
```bash
156167
git checkout #{LuckyCliVersion.current_tag}
157168
```
158169
159170
### 4. Install shards
160171
161172
We call packages/libraries in Crystal "shards". Let's install the shards that Lucky CLI needs:
162173
163-
```plain
174+
```bash
164175
shards install --without-development
165176
```
166177
167178
### 5. Build the CLI
168179
169-
```plain
180+
```bash
170181
shards build --production
171182
```
172183
173184
### 6. Move the generated binary to your path
174185
175186
This will let you use `lucky` from the command line.
176-
```plain
187+
```bash
177188
cp bin/lucky /usr/local/bin
178189
```
179190
Or anywhere else you deem fit
@@ -182,7 +193,7 @@ class Guides::GettingStarted::Installing < GuideAction
182193
183194
Let's make sure the Lucky CLI installed correctly:
184195
185-
```plain
196+
```bash
186197
lucky -v
187198
```
188199
@@ -206,7 +217,7 @@ class Guides::GettingStarted::Installing < GuideAction
206217
If you're using [Postgres.app](https://postgresapp.com) on macOS make sure
207218
[Postgres CLI tools](https://postgresapp.com/documentation/cli-tools.html) are installed
208219
209-
```plain
220+
```bash
210221
sudo mkdir -p /etc/paths.d &&
211222
echo /Applications/Postgres.app/Contents/Versions/latest/bin | sudo tee /etc/paths.d/postgresapp
212223
```
@@ -219,7 +230,7 @@ class Guides::GettingStarted::Installing < GuideAction
219230
use PostgreSQL without a password, you'll need to ensure your `pg_hba.conf` file is updated.
220231
We recommend adding this entry right after the `postgres` user entry:
221232
222-
```plain
233+
```bash
223234
# TYPE DATABASE USER ADDRESS METHOD
224235
# "local" is for Unix domain socket connections only
225236
local all all trust
@@ -238,7 +249,7 @@ class Guides::GettingStarted::Installing < GuideAction
238249
239250
First open a new session to reload your terminal, then:
240251
241-
```plain
252+
```bash
242253
psql --version
243254
```
244255
@@ -256,7 +267,7 @@ class Guides::GettingStarted::Installing < GuideAction
256267
257268
### 2. Check installation
258269
259-
```plain
270+
```bash
260271
node -v
261272
yarn -v
262273
```

src/actions/guides/getting-started/starting_project.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Guides::GettingStarted::StartingProject < GuideAction
3636
3737
This option is great if you need to generate a Lucky app programmatically, or just prefer to get going right away.
3838
39-
```
39+
```bash
4040
# Generate a Full Web app with Authentication
4141
lucky init.custom my_app
4242

src/css/components/_markdown-content.scss

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
font-family: Menlo, Roboto Mono, Courier New, monospace;
112112
border-radius: 4px;
113113
padding: 1px 5px;
114+
scrollbar-color: #4a5568 #2e3440;
114115

115116
a {
116117
@apply text-blue-dark no-underline border-b border-blue-light;
@@ -122,11 +123,23 @@
122123
}
123124

124125
pre {
125-
code {
126-
a {
127-
@apply no-underline text-grey border-grey-dark;
126+
position: relative;
127+
128+
.copy-code-button {
129+
position: absolute;
130+
right: 12px;
131+
top: 12px;
132+
transition: opacity 0.1s ease;
133+
opacity: 0;
134+
background-color: #2e3440; // Assuming a default background color for the button
135+
&:hover {
136+
opacity: 1 !important;
128137
}
129138
}
139+
140+
&:hover .copy-code-button {
141+
opacity: 0.8;
142+
}
130143
}
131144

132145
&.-large-code {
@@ -215,4 +228,7 @@
215228
}
216229
}
217230
}
231+
.bordered-icon {
232+
@apply w-6 h-6 rounded-md border border-grey-light p-1;
233+
}
218234
}

src/models/lucky_cli_version.cr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ module LuckyCliVersion
88
end
99

1010
def current_version : SemanticVersion
11-
SemanticVersion.new(1, 1, 0)
11+
SemanticVersion.new(1, 1, 1)
1212
end
1313

1414
def min_compatible_crystal_version : SemanticVersion
1515
SemanticVersion.new(1, 6, 0)
1616
end
1717

1818
def max_compatible_crystal_version : SemanticVersion
19-
SemanticVersion.new(1, 10, 1)
19+
SemanticVersion.new(1, 11, 2)
2020
end
2121
end

0 commit comments

Comments
 (0)