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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 929173ad31be6464b75779784d2c1bb1d37f04d548b1869783e156bc1a13cb11
4
- data.tar.gz: 351871aa23247e031ab56b163a3e3684b8cc995d8fe0dc65b6c529b851c51332
3
+ metadata.gz: 59a21e1f498c47b6ee14766f23b04d3a75297abf4cf4871ee35ae22307455b54
4
+ data.tar.gz: 501c6ad1040355ce2e96f9209d65eb8489e52ffbe21d4e8a43b5294dd3adf0b0
5
5
  SHA512:
6
- metadata.gz: ce2a20ab053f5e3ed0f8bb68cd085beb60e87a5f45c39e9af95626714eb309275f6464b9d5690ad6b7eedf34b6d476999b890ac16e72db8b1fc2dc0a838eedb8
7
- data.tar.gz: c418c12ae3bf2ee02255350c330b6271a07d0bcd053ea2b45acf762b852e5e0eb04daf4676bbec9980bfe803f2e6b83c598bd39e51075527fbf8233b9f2f4087
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
- - `GH_TOKEN`: The only required scope is `public_repo` if your TIL repo is public and `repo` if it is private. You can
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
- - `GH_REPO`: The repo name, e.g. `pjambet/til`
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.
@@ -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 = CGI.escape(commit_title.split.map(&:downcase).join('-'))
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
- puts "You can see your new TIL at : https://github.com/#{repo_name}/blob/master/#{category}/#{filename}"
182
- puts "You can edit your new TIL at : https://github.com/#{repo_name}/edit/master/#{category}/#{filename}"
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)
@@ -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)] \
@@ -1,5 +1,5 @@
1
1
  module Til
2
2
 
3
- VERSION = '0.0.7'
3
+ VERSION = '0.0.8'
4
4
 
5
5
  end
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.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre Jambet