til-rb 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +53 -0
- data/bin/til +1 -1
- data/lib/til/core.rb +2 -2
- data/lib/til/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c97869d1c32d177ee5086d135865e9d21145e754d09a3542dbeb0558d10121ba
|
4
|
+
data.tar.gz: 100e0765c9ad27450614b785d2099794ee674425c2e35b6128b9bffaf9873836
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb6b75930c31b17a85a18229561e96cd4843c65f03cf8a2f9e43a7d0566d512cd50965ce86806091ceda929774aa9c7b6dc3576dec1c7be293a15c45f9af264b
|
7
|
+
data.tar.gz: 987ddd76bf8394424e404f776837301d70477907f8bdb4387bae61af2fcb00a3f15522b1629f14c81f6fac741a81f1f2d2a92a358518e4127a9f79741c01335e
|
data/README.md
CHANGED
@@ -5,3 +5,56 @@
|
|
5
5
|
A work-in-progress tool to maintain a TIL repo.
|
6
6
|
|
7
7
|
Inspiration: https://github.com/jbranchaud/til
|
8
|
+
|
9
|
+
See it in action below:
|
10
|
+
|
11
|
+

|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
### Step 1: Install the gem
|
16
|
+
|
17
|
+
```
|
18
|
+
gem install til-rb
|
19
|
+
```
|
20
|
+
|
21
|
+
### Step 2: Create a GitHub repo
|
22
|
+
|
23
|
+
You need a GitHub repo to store your TILs. The gem has pretty strict expectations about the format of the README.md
|
24
|
+
file, so I recommend forking [this repo](https://github.com/pjambet/til-template), or just copying the content to a
|
25
|
+
fresh new repo.
|
26
|
+
|
27
|
+
Note: The format expectations mentioned above are the following:
|
28
|
+
|
29
|
+
- A "categories" section as defined by a leading markdown separator `---`, followed by a blank line, the `###
|
30
|
+
Categories` title, and a list of all the categories.
|
31
|
+
- A links section as defined by a leading markdown separator `---`, followed by a blank line and a series of markdown
|
32
|
+
titles for each categories present in the previous section.
|
33
|
+
|
34
|
+
### Step 3: Add the environment variables
|
35
|
+
|
36
|
+
Add the following variables to your environment:
|
37
|
+
|
38
|
+
- `GH_TOKEN`: The only required scope is `public_repo` if your TIL repo is public and `repo` if it is private. You can
|
39
|
+
create a token [in the GitHub
|
40
|
+
settings](https://github.com/settings/tokens/new?scopes=public_repo&description=Token%20for%20til-rb)
|
41
|
+
- `GH_REPO`: The repo name, e.g. `pjambet/til`
|
42
|
+
|
43
|
+
You might want to add those to either your `.bashrc` or `.zshrc` but please be careful in case you share those publicly
|
44
|
+
as the token is private and *must not* be shared publicly.
|
45
|
+
|
46
|
+
### Step 4:
|
47
|
+
|
48
|
+
Run `til` from the command line
|
49
|
+
|
50
|
+
## Future improvements
|
51
|
+
|
52
|
+
- An `init` command that will create a repo for you
|
53
|
+
- A `configure` command that will store the token and the repo name in a file in `~/.config/til/config` or `~/.til`
|
54
|
+
|
55
|
+
## Known issues
|
56
|
+
|
57
|
+
The current version (0.0.5) deletes the temporary file before attempting to create the new commit, so if anything goes
|
58
|
+
wrong there, the content of the file will be lost.
|
59
|
+
This will be fixed soon, by only deleting the temporary file after the commit was created, but please keep that in mind
|
60
|
+
if you typed a long TIL and definitely don't want to lose its content.
|
data/bin/til
CHANGED
@@ -7,7 +7,7 @@ options = {}
|
|
7
7
|
OptionParser.new do |opts|
|
8
8
|
opts.banner = 'Usage: til [options]'
|
9
9
|
|
10
|
-
opts.on('-
|
10
|
+
opts.on('-t', '--title=TITLE', 'Set the title from the command line') do |title|
|
11
11
|
options[:title] = title
|
12
12
|
end
|
13
13
|
|
data/lib/til/core.rb
CHANGED
@@ -163,8 +163,8 @@ module Til
|
|
163
163
|
commit = github_client.create_commit repo_name, commit_title, tree.sha, ref.object.sha
|
164
164
|
github_client.update_ref repo_name, 'heads/master', commit.sha
|
165
165
|
|
166
|
-
puts "You can see your new TIL at : https://github.com/
|
167
|
-
puts "You can edit your new TIL at : https://github.com/
|
166
|
+
puts "You can see your new TIL at : https://github.com/#{repo_name}/blob/master/#{category}/#{filename}"
|
167
|
+
puts "You can edit your new TIL at : https://github.com/#{repo_name}/edit/master/#{category}/#{filename}"
|
168
168
|
end
|
169
169
|
|
170
170
|
def update_readme_content(category, commit_title, filename, readme_content)
|
data/lib/til/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: til-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pierre Jambet
|
@@ -66,7 +66,7 @@ files:
|
|
66
66
|
- lib/til/core.rb
|
67
67
|
- lib/til/readme_updater.rb
|
68
68
|
- lib/til/version.rb
|
69
|
-
homepage: https://
|
69
|
+
homepage: https://github.com/pjambet/til-rb/
|
70
70
|
licenses:
|
71
71
|
- MIT
|
72
72
|
metadata: {}
|