til-rb 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/til/core.rb +6 -3
- data/lib/til/readme_updater.rb +2 -2
- data/lib/til/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: 59a21e1f498c47b6ee14766f23b04d3a75297abf4cf4871ee35ae22307455b54
|
4
|
+
data.tar.gz: 501c6ad1040355ce2e96f9209d65eb8489e52ffbe21d4e8a43b5294dd3adf0b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eeee1045a7652efbf9de6793e5f03895a790f22e9ebd8fd634d59fa71a3d42ae050c3aa1b6a6d4b83e8a9f299ee33a52527f06ce8aadf9bce9d556f78c4fa044
|
7
|
+
data.tar.gz: ce2e02df0edf57fc1c9cd9d1b6ae73c2d32ec1f6ba8a00b7fa3cd46d2913823a18eeadecd7178e26b158618de13b967f725965a365db94c1bb319ac9319cb95f
|
data/README.md
CHANGED
@@ -45,10 +45,10 @@ Note: The format expectations mentioned above are the following:
|
|
45
45
|
|
46
46
|
Add the following variables to your environment:
|
47
47
|
|
48
|
-
- `
|
48
|
+
- `TIL_RB_GITHUB_TOKEN`: The only required scope is `public_repo` if your TIL repo is public and `repo` if it is private. You can
|
49
49
|
create a token [in the GitHub
|
50
50
|
settings](https://github.com/settings/tokens/new?scopes=public_repo&description=Token%20for%20til-rb)
|
51
|
-
- `
|
51
|
+
- `TIL_RB_GITHUB_REPO`: The repo name, e.g. `pjambet/til`
|
52
52
|
|
53
53
|
You might want to add those to either your `.bashrc` or `.zshrc` but please be careful in case you share those publicly
|
54
54
|
as the token is private and *must not* be shared publicly.
|
data/lib/til/core.rb
CHANGED
@@ -144,7 +144,7 @@ module Til
|
|
144
144
|
|
145
145
|
def new_filename(commit_title)
|
146
146
|
today = Time.now.strftime '%Y-%m-%d'
|
147
|
-
name =
|
147
|
+
name = commit_title.split.map(&:downcase).join('-')
|
148
148
|
"#{today}_#{name}.md"
|
149
149
|
end
|
150
150
|
|
@@ -178,8 +178,11 @@ module Til
|
|
178
178
|
commit = github_client.create_commit repo_name, commit_title, tree.sha, ref.object.sha
|
179
179
|
github_client.update_ref repo_name, 'heads/master', commit.sha
|
180
180
|
|
181
|
-
|
182
|
-
|
181
|
+
cgi_escaped_filename = CGI.escape(filename)
|
182
|
+
til_url = "https://github.com/#{repo_name}/blob/master/#{category}/#{cgi_escaped_filename}"
|
183
|
+
til_edit_url = "https://github.com/#{repo_name}/edit/master/#{category}/#{cgi_escaped_filename}"
|
184
|
+
puts "You can see your new TIL at : #{til_url}"
|
185
|
+
puts "You can edit your new TIL at : #{til_edit_url}"
|
183
186
|
end
|
184
187
|
|
185
188
|
def update_readme_content(category, commit_title, filename, readme_content)
|
data/lib/til/readme_updater.rb
CHANGED
@@ -17,7 +17,7 @@ module Til
|
|
17
17
|
loc_in_page = @initial_content.index("### #{existing_cat[1]}")
|
18
18
|
next_cat_location = @initial_content.index('###', loc_in_page + 1)
|
19
19
|
|
20
|
-
new_line = "- [#{item_title}](#{category}/#{filename})"
|
20
|
+
new_line = "- [#{item_title}](#{category}/#{CGI.escape(filename)})"
|
21
21
|
new_readme_content = ''
|
22
22
|
if next_cat_location
|
23
23
|
breakpoint = next_cat_location - 2
|
@@ -64,7 +64,7 @@ module Til
|
|
64
64
|
|
65
65
|
next_bound = @initial_content.index('###', current_search_index + 1)
|
66
66
|
|
67
|
-
new_line = "- [#{item_title}](#{category}/#{filename})"
|
67
|
+
new_line = "- [#{item_title}](#{category}/#{CGI.escape(filename)})"
|
68
68
|
|
69
69
|
if next_bound
|
70
70
|
new_readme_content = @initial_content[0..(first_dashdashdash + 2)] \
|
data/lib/til/version.rb
CHANGED