hugo-notion 0.1.0.pre.alpha.2 → 0.1.0.pre.alpha.3

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: 911a882054fd1e8bd0aad7878f6e75948bc0b0a6d9ac3b433147b300e0942498
4
- data.tar.gz: ab2c4b42f4cd5a10e50b23826cc638c4db1ef001208ad276c37b402f5738cbc8
3
+ metadata.gz: 998722740c86d07e77edb0bcfa625cf6cd9c956f90a525cf1146604324ed26bd
4
+ data.tar.gz: 596a6adb5d21930ea0a46beb2a4cd7e1a3d309d18f2dd2ade153e9d8414f70e5
5
5
  SHA512:
6
- metadata.gz: d549fc486805ea9333bc763503261e60cf814be278d0cca1e047a7f076274564751d78cc6380f75b482db42580aea8a23f457c5e30646492b10b6e21937dcce4
7
- data.tar.gz: f9b669857c40d138d3e9030094f582e18e93262b482a546333f032eff5c36d1b3383a00b8286d128cca24451254c13680f81ebd1c04b8b6e1aa1933ee4b31789
6
+ metadata.gz: d44e9c969c40cdcbabcfd0442aa7577b54c31865910dc4cf51a268545f8fd1c76e705c64540e6e678284e48782227cf17dd048ccffd7793d17171b5222ea9f84
7
+ data.tar.gz: 6269bf536477e430f23912f0cc23e1b5a4a4eeb184e64afb38a918efbd602eb678b0d5776dbb383e960cd42f8d607f11caf703a76be26e62ea253c0fb323d423
data/bin/huno CHANGED
@@ -15,7 +15,7 @@ end
15
15
  notion_page_url = ARGV[0]
16
16
  notion_page_id = URI(notion_page_url).path.match(/-(?<page_id>.*)\z/)['page_id']
17
17
 
18
- destination_dir = Dir.pwd
18
+ destination_dir = File.join(Dir.pwd, 'content')
19
19
  if ARGV[1]
20
20
  if Pathname.new(ARGV[1]).absolute?
21
21
  destination_dir = ARGV[1]
@@ -24,12 +24,9 @@ if ARGV[1]
24
24
  end
25
25
  end
26
26
 
27
- loop do
28
- puts "Syncing posts from Notion..."
29
- Synchronizer.run(
30
- notion_page_id: notion_page_id,
31
- destination_dir: destination_dir
32
- )
33
- puts "Done."
34
- sleep 10
35
- end
27
+ puts "Syncing posts from Notion..."
28
+ Synchronizer.run(
29
+ notion_page_id: notion_page_id,
30
+ destination_dir: destination_dir
31
+ )
32
+ puts "Done."
@@ -1,4 +1,4 @@
1
- env_file_path = File.expand_path('../../.env', File.dirname(__FILE__))
1
+ env_file_path = File.join(Dir.pwd, '.env')
2
2
  if File.exist?(env_file_path)
3
3
  require 'dotenv'
4
4
  Dotenv.load(env_file_path)
@@ -62,7 +62,7 @@ class Synchronizer
62
62
  existing_page_file_names = Dir.entries(destination_dir).select { |f| !File.directory? f }
63
63
  page_file_names = []
64
64
  notion_blocks.each do |notion_block|
65
- notion_block_id = notion_notion_block['id']
65
+ notion_block_id = notion_block['id']
66
66
 
67
67
  if notion_block['type'] == 'child_database'
68
68
  notion_child_database_title = notion_block['child_database']['title']
@@ -79,11 +79,11 @@ class Synchronizer
79
79
  'date' => Time.parse(notion_block['created_time'])
80
80
  }
81
81
  if notion_block['properties']
82
- if block.dig('properties', 'date', 'date', 'start')
82
+ if notion_block.dig('properties', 'date', 'date', 'start')
83
83
  page_front_matter['date'] = Time.parse(notion_block['properties']['date']['date']['start'])
84
84
  end
85
85
 
86
- if block.dig('properties', 'Name', 'title', 0, 'plain_text')
86
+ if notion_block.dig('properties', 'Name', 'title', 0, 'plain_text')
87
87
  page_front_matter['title'] = notion_block['properties']['Name']['title'][0]['plain_text']
88
88
  end
89
89
  end
@@ -107,7 +107,7 @@ class Synchronizer
107
107
  end
108
108
 
109
109
  page_front_matter_yaml = page_front_matter.to_yaml.chomp
110
- page_markdown = NotionToMd.convert(notion_page_id: notion_block_id, token: NOTION_TOKEN)
110
+ page_markdown = NotionToMd.convert(page_id: notion_block_id, token: NOTION_TOKEN)
111
111
  page_content = <<-page_CONTENT
112
112
  #{page_front_matter_yaml}
113
113
  ---
@@ -1,3 +1,3 @@
1
1
  class HugoNotion
2
- VERSION = '0.1.0-alpha.2'
2
+ VERSION = '0.1.0-alpha.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hugo-notion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre.alpha.2
4
+ version: 0.1.0.pre.alpha.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nisanth Chunduru
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-15 00:00:00.000000000 Z
11
+ date: 2024-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty