fronde 0.6.3 → 0.6.4
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/lib/fronde/config/data/org-config.el +1 -1
- data/lib/fronde/index.rb +1 -1
- data/lib/fronde/org/file.rb +1 -1
- data/lib/fronde/org.rb +24 -43
- data/lib/fronde/source.rb +7 -18
- data/lib/fronde/sync/neocities.rb +2 -2
- data/lib/fronde/templater.rb +2 -2
- data/lib/fronde/version.rb +1 -1
- data/lib/tasks/cli.rake +1 -1
- data/lib/tasks/org.rake +15 -14
- metadata +13 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 65f4af03cc2839a3557f78f99d6417b2d92667d5990d925064cbd958a7035085
|
|
4
|
+
data.tar.gz: 0c782594530540f5ef9e900cc41d8d67529baeeaeceeed391e54c4601ba4bb47
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dcf7cd50cf7911edb9cacc7c13c9cff26e666a344c04d6e841c5196623d20648bf6d82a42e429683703a2e58a47a0d50196b86c13148e9291bddb048e1506af7
|
|
7
|
+
data.tar.gz: 3602b6dd333cec5c7b1a072260577c0a291a8e833d0615ae8533a1c43b616560cbe97bf68dc15781979735f8e7d565e331d3346673977596df2142e76bafce9c
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
;; Add org-mode to load path
|
|
2
|
-
(add-to-list 'load-path (expand-file-name "org-{{ org_version }}
|
|
2
|
+
(add-to-list 'load-path (expand-file-name "org-{{ org_version }}" "{{ work_dir }}/lib"))
|
|
3
3
|
;; Load last version of htmlize.el
|
|
4
4
|
(load-file (expand-file-name "htmlize.el" "{{ work_dir }}/lib"))
|
|
5
5
|
|
data/lib/fronde/index.rb
CHANGED
data/lib/fronde/org/file.rb
CHANGED
data/lib/fronde/org.rb
CHANGED
|
@@ -10,7 +10,7 @@ module Fronde
|
|
|
10
10
|
# of the Emacs package. It also serves as a namespace for the class
|
|
11
11
|
# responsible for handling Org files: {Fronde::Org::File}.
|
|
12
12
|
module Org
|
|
13
|
-
|
|
13
|
+
GNU_ELPA_URL = 'https://elpa.gnu.org/packages/org'
|
|
14
14
|
|
|
15
15
|
class << self
|
|
16
16
|
def current_version
|
|
@@ -41,26 +41,27 @@ module Fronde
|
|
|
41
41
|
org_version
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
-
def http_get_client(uri)
|
|
44
|
+
def http_get_client(uri, &)
|
|
45
45
|
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
|
|
46
46
|
request = Net::HTTP::Get.new(uri)
|
|
47
47
|
request['User-Agent'] = Fronde::USER_AGENT
|
|
48
|
-
|
|
48
|
+
http.request request, &
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
def fetch_version_number
|
|
53
|
-
# Retrieve last org version from
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
uri = URI(CGIT_BASE_URL)
|
|
59
|
-
response = http_get_client(uri) { |http, req| http.request req }
|
|
60
|
-
versions = response.body.each_line(chomp: true).filter_map do |line|
|
|
61
|
-
line.match(tag_rx) { |matchdata| matchdata[:number] }
|
|
53
|
+
# Retrieve last org version from GNU ELPA page.
|
|
54
|
+
uri = URI("#{GNU_ELPA_URL}.html")
|
|
55
|
+
response = http_get_client(uri).body
|
|
56
|
+
version_line = response.each_line(chomp: true).find do |line|
|
|
57
|
+
line.start_with? '<dt>Latest</dt> <dd><a href='
|
|
62
58
|
end
|
|
63
|
-
|
|
59
|
+
return unless version_line
|
|
60
|
+
|
|
61
|
+
version_match = version_line.match(/org-(?<version>[0-9.]+)\.tar/)
|
|
62
|
+
return version_match[:version] if version_match
|
|
63
|
+
|
|
64
|
+
nil
|
|
64
65
|
end
|
|
65
66
|
|
|
66
67
|
# Download latest org-mode tarball.
|
|
@@ -69,49 +70,29 @@ module Fronde
|
|
|
69
70
|
# @return [String] the downloaded org-mode version
|
|
70
71
|
def download(destination = 'var/tmp')
|
|
71
72
|
org_last_version = last_version(force: false, cookie_dir: destination)
|
|
72
|
-
|
|
73
|
-
uri = URI("#{CGIT_BASE_URL}snapshot/#{tarball}")
|
|
73
|
+
uri = URI("#{GNU_ELPA_URL}-#{org_last_version}.tar")
|
|
74
74
|
# Will crash on purpose if anything goes wrong
|
|
75
|
-
http_get_client(uri) do |
|
|
76
|
-
fetch_org_tarball
|
|
75
|
+
http_get_client(uri) do |response|
|
|
76
|
+
fetch_org_tarball response, destination
|
|
77
77
|
end
|
|
78
78
|
org_last_version
|
|
79
79
|
end
|
|
80
80
|
|
|
81
|
-
def fetch_org_tarball(
|
|
81
|
+
def fetch_org_tarball(response, destination)
|
|
82
82
|
# Remove version number in dest file to allow easy rake file
|
|
83
83
|
# task naming
|
|
84
|
-
dest_file = ::File.expand_path('org.tar
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
response.read_body { |chunk| io.write chunk }
|
|
88
|
-
end
|
|
84
|
+
dest_file = ::File.expand_path('org.tar', destination)
|
|
85
|
+
::File.open(dest_file, 'w') do |io|
|
|
86
|
+
response.read_body { |chunk| io.write chunk }
|
|
89
87
|
end
|
|
90
88
|
end
|
|
91
89
|
|
|
92
|
-
|
|
93
|
-
make = ['make', '-C', org_dir, target]
|
|
94
|
-
return make.join(' ') if verbose
|
|
95
|
-
|
|
96
|
-
make.insert(3, '-s')
|
|
97
|
-
make << 'EMACSQ="emacs -Q --eval \'(setq inhibit-message t)\'"'
|
|
98
|
-
make.join(' ')
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
# Compile downloaded Org package
|
|
90
|
+
# Extract downloaded Org tarball
|
|
102
91
|
#
|
|
103
92
|
# @param source [String] path to the org-mode tarball to install
|
|
104
|
-
# @param version [String] version of the org package to install
|
|
105
93
|
# @param target [String] path to the final install directory
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
untar_cmd = ['tar', '-xzf', source]
|
|
109
|
-
system(*untar_cmd)
|
|
110
|
-
FileUtils.mv "org-mode-release_#{version}", target
|
|
111
|
-
# Fix a weird unknown package version
|
|
112
|
-
::File.write("#{target}/mk/version.mk", "ORGVERSION ?= #{version}")
|
|
113
|
-
system(*make_org_cmd(target, 'compile', verbose:))
|
|
114
|
-
system(*make_org_cmd(target, 'autoloads', verbose:))
|
|
94
|
+
def extract(source, target)
|
|
95
|
+
system 'tar', '-C', target, '-xf', source
|
|
115
96
|
end
|
|
116
97
|
end
|
|
117
98
|
end
|
data/lib/fronde/source.rb
CHANGED
|
@@ -17,29 +17,19 @@ module Fronde
|
|
|
17
17
|
render_heading
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
def [](key)
|
|
21
|
-
@config[key]
|
|
22
|
-
end
|
|
20
|
+
def [](key) = @config[key]
|
|
23
21
|
|
|
24
22
|
def []=(key, value)
|
|
25
23
|
@config[key] = value
|
|
26
24
|
end
|
|
27
25
|
|
|
28
|
-
def type
|
|
29
|
-
@config['type']
|
|
30
|
-
end
|
|
26
|
+
def type = @config['type']
|
|
31
27
|
|
|
32
|
-
def recursive?
|
|
33
|
-
!!@config['recursive']
|
|
34
|
-
end
|
|
28
|
+
def recursive? = !!@config['recursive']
|
|
35
29
|
|
|
36
|
-
def blog?
|
|
37
|
-
!!@config['is_blog']
|
|
38
|
-
end
|
|
30
|
+
def blog? = !!@config['is_blog']
|
|
39
31
|
|
|
40
|
-
def to_h
|
|
41
|
-
@config
|
|
42
|
-
end
|
|
32
|
+
def to_h = @config
|
|
43
33
|
|
|
44
34
|
def source_for?(file_name)
|
|
45
35
|
relative_file_path = file_name.delete_prefix "#{@config['path']}/"
|
|
@@ -76,10 +66,9 @@ module Fronde
|
|
|
76
66
|
end
|
|
77
67
|
|
|
78
68
|
def target_for(file_name)
|
|
79
|
-
target = File.expand_path
|
|
80
|
-
target.delete_prefix! "#{Dir.pwd}/"
|
|
69
|
+
target = File.expand_path(file_name).delete_prefix "#{Dir.pwd}/"
|
|
81
70
|
target.sub!(/\.org\z/, @config['ext'])
|
|
82
|
-
project_relative_path = @config['path'].delete_prefix
|
|
71
|
+
project_relative_path = @config['path'].delete_prefix "#{Dir.pwd}/"
|
|
83
72
|
target.delete_prefix! "#{project_relative_path}/"
|
|
84
73
|
public_absolute_path + target
|
|
85
74
|
end
|
|
@@ -85,8 +85,8 @@ module Fronde
|
|
|
85
85
|
end
|
|
86
86
|
|
|
87
87
|
def select_orphans(to_apply, current_list, &)
|
|
88
|
-
paths_to_apply = to_apply.map {
|
|
89
|
-
current_paths = current_list.map {
|
|
88
|
+
paths_to_apply = to_apply.map { it['path'] }
|
|
89
|
+
current_paths = current_list.map { it['path'] }
|
|
90
90
|
(current_paths - paths_to_apply).filter_map(&)
|
|
91
91
|
end
|
|
92
92
|
|
data/lib/fronde/templater.rb
CHANGED
|
@@ -58,14 +58,14 @@ module Fronde
|
|
|
58
58
|
|
|
59
59
|
def apply_templates(source)
|
|
60
60
|
public_file = source.pub_file absolute: true
|
|
61
|
-
dom = File.open(public_file, 'r') { Nokogiri::HTML
|
|
61
|
+
dom = File.open(public_file, 'r') { Nokogiri::HTML it }
|
|
62
62
|
changes = Fronde::CONFIG.get('templates', []).map do |config|
|
|
63
63
|
template = Fronde::Templater.new(source, dom, config)
|
|
64
64
|
next if !template.valid? || template.applied?
|
|
65
65
|
|
|
66
66
|
template.apply
|
|
67
67
|
end
|
|
68
|
-
File.open(public_file, 'w') { dom.write_to
|
|
68
|
+
File.open(public_file, 'w') { dom.write_to it } if changes.any?
|
|
69
69
|
end
|
|
70
70
|
end
|
|
71
71
|
|
data/lib/fronde/version.rb
CHANGED
data/lib/tasks/cli.rake
CHANGED
|
@@ -28,7 +28,7 @@ namespace :cli do
|
|
|
28
28
|
data['commands'] = all_commands.filter_map do |command, options|
|
|
29
29
|
next if options[:alias] || command == 'basic'
|
|
30
30
|
|
|
31
|
-
opts = (options[:opts] || []).map { comp_opt_to_liquid(
|
|
31
|
+
opts = (options[:opts] || []).map { comp_opt_to_liquid(it, command) }
|
|
32
32
|
{ 'name' => command,
|
|
33
33
|
'translation' => I18n.t("fronde.bin.commands.#{command}"),
|
|
34
34
|
'options' => opts }
|
data/lib/tasks/org.rake
CHANGED
|
@@ -10,14 +10,16 @@ CLOBBER.push(
|
|
|
10
10
|
)
|
|
11
11
|
|
|
12
12
|
HTMLIZE_TAG = 'release/1.58'
|
|
13
|
+
TMP_ORG_TARBALL = 'var/tmp/org.tar'
|
|
13
14
|
|
|
14
15
|
namespace :org do
|
|
16
|
+
directory 'lib'
|
|
15
17
|
directory 'var/tmp'
|
|
16
18
|
|
|
17
19
|
desc 'Download last version of Org'
|
|
18
|
-
file
|
|
20
|
+
file TMP_ORG_TARBALL => 'var/tmp' do
|
|
19
21
|
# Weird Rake issue, still executing the task even if the file exists
|
|
20
|
-
next if File.exist?
|
|
22
|
+
next if File.exist? TMP_ORG_TARBALL
|
|
21
23
|
|
|
22
24
|
download = Thread.new do
|
|
23
25
|
version = Fronde::Org.download
|
|
@@ -30,18 +32,19 @@ namespace :org do
|
|
|
30
32
|
warn I18n.t('fronde.tasks.org.no_download') if verbose
|
|
31
33
|
end
|
|
32
34
|
|
|
33
|
-
desc '
|
|
34
|
-
multitask
|
|
35
|
+
desc 'Extract Org tarball'
|
|
36
|
+
multitask extract: [TMP_ORG_TARBALL, 'lib'] do |task|
|
|
35
37
|
# No need to force fetch last version as it is only interesting as
|
|
36
38
|
# part of the upgrade task
|
|
37
39
|
version = Fronde::Org.last_version
|
|
38
40
|
|
|
39
41
|
org_dir = "lib/org-#{version}"
|
|
40
|
-
next if
|
|
42
|
+
next if File.exist?("#{org_dir}/org-version.el")
|
|
41
43
|
|
|
42
44
|
build = Thread.new do
|
|
43
|
-
Fronde::Org.
|
|
44
|
-
|
|
45
|
+
Fronde::Org.extract task.prerequisites[0], 'lib'
|
|
46
|
+
# Remove old versions
|
|
47
|
+
Dir.glob('lib/org-[0-9.]*').each { rm_r it unless it == org_dir }
|
|
45
48
|
puts I18n.t('fronde.tasks.org.installed', version:) if verbose
|
|
46
49
|
end
|
|
47
50
|
Fronde::CLI::Throbber.run(
|
|
@@ -51,8 +54,6 @@ namespace :org do
|
|
|
51
54
|
next
|
|
52
55
|
end
|
|
53
56
|
|
|
54
|
-
directory 'lib'
|
|
55
|
-
|
|
56
57
|
file 'lib/htmlize.el' => 'lib' do
|
|
57
58
|
uri = URI(
|
|
58
59
|
"https://raw.githubusercontent.com/hniksic/emacs-htmlize/refs/tags/#{HTMLIZE_TAG}/htmlize.el"
|
|
@@ -79,15 +80,15 @@ namespace :org do
|
|
|
79
80
|
end
|
|
80
81
|
|
|
81
82
|
desc 'Install Org'
|
|
82
|
-
multitask install: ['org:
|
|
83
|
+
multitask install: ['org:extract', '.gitignore'] do
|
|
83
84
|
# lib/htmlize.el cannot be generated in parallel of org:compilation,
|
|
84
85
|
# as it will leads to a weird SSL error. Thus finishing file generation
|
|
85
86
|
# "manually" here.
|
|
86
87
|
Rake::Task['var/lib/org-config.el'].invoke
|
|
87
88
|
sources = Fronde::CONFIG.sources
|
|
88
|
-
sources.each { mkdir_p
|
|
89
|
+
sources.each { mkdir_p it['path'] }
|
|
89
90
|
|
|
90
|
-
outputs = sources.map {
|
|
91
|
+
outputs = sources.map { it['type'] }.uniq
|
|
91
92
|
if outputs.include?('html')
|
|
92
93
|
mkdir_p "#{Fronde::CONFIG.get('html_public_folder')}/assets"
|
|
93
94
|
end
|
|
@@ -99,7 +100,7 @@ namespace :org do
|
|
|
99
100
|
desc 'Upgrade Org'
|
|
100
101
|
task :upgrade do
|
|
101
102
|
Rake::Task['clobber'].execute
|
|
102
|
-
if File.exist?
|
|
103
|
+
if File.exist? TMP_ORG_TARBALL
|
|
103
104
|
# Cleanup cached tarball only if a new version is available.
|
|
104
105
|
# Also cached the new remote org version in the same time.
|
|
105
106
|
org_version = Fronde::Org.current_version
|
|
@@ -108,7 +109,7 @@ namespace :org do
|
|
|
108
109
|
rescue RuntimeError
|
|
109
110
|
last_version = org_version
|
|
110
111
|
end
|
|
111
|
-
File.unlink
|
|
112
|
+
File.unlink TMP_ORG_TARBALL unless org_version == last_version
|
|
112
113
|
end
|
|
113
114
|
Rake::Task['org:install'].invoke
|
|
114
115
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fronde
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Étienne Pflieger
|
|
@@ -15,28 +15,28 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '0.
|
|
18
|
+
version: '0.3'
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: '0.
|
|
25
|
+
version: '0.3'
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: bigdecimal
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
30
|
- - "~>"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '
|
|
32
|
+
version: '4.1'
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '
|
|
39
|
+
version: '4.1'
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: i18n
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -57,28 +57,28 @@ dependencies:
|
|
|
57
57
|
requirements:
|
|
58
58
|
- - "~>"
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: '5.
|
|
60
|
+
version: '5.12'
|
|
61
61
|
type: :runtime
|
|
62
62
|
prerelease: false
|
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
64
64
|
requirements:
|
|
65
65
|
- - "~>"
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: '5.
|
|
67
|
+
version: '5.12'
|
|
68
68
|
- !ruby/object:Gem::Dependency
|
|
69
69
|
name: nokogiri
|
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
|
71
71
|
requirements:
|
|
72
72
|
- - "~>"
|
|
73
73
|
- !ruby/object:Gem::Version
|
|
74
|
-
version: '1.
|
|
74
|
+
version: '1.19'
|
|
75
75
|
type: :runtime
|
|
76
76
|
prerelease: false
|
|
77
77
|
version_requirements: !ruby/object:Gem::Requirement
|
|
78
78
|
requirements:
|
|
79
79
|
- - "~>"
|
|
80
80
|
- !ruby/object:Gem::Version
|
|
81
|
-
version: '1.
|
|
81
|
+
version: '1.19'
|
|
82
82
|
- !ruby/object:Gem::Dependency
|
|
83
83
|
name: rainbow
|
|
84
84
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -99,14 +99,14 @@ dependencies:
|
|
|
99
99
|
requirements:
|
|
100
100
|
- - "~>"
|
|
101
101
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: '13.
|
|
102
|
+
version: '13.4'
|
|
103
103
|
type: :runtime
|
|
104
104
|
prerelease: false
|
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
|
106
106
|
requirements:
|
|
107
107
|
- - "~>"
|
|
108
108
|
- !ruby/object:Gem::Version
|
|
109
|
-
version: '13.
|
|
109
|
+
version: '13.4'
|
|
110
110
|
- !ruby/object:Gem::Dependency
|
|
111
111
|
name: webrick
|
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -209,7 +209,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
209
209
|
requirements:
|
|
210
210
|
- - ">="
|
|
211
211
|
- !ruby/object:Gem::Version
|
|
212
|
-
version: '3.
|
|
212
|
+
version: '3.4'
|
|
213
213
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
214
|
requirements:
|
|
215
215
|
- - ">="
|
|
@@ -217,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
217
217
|
version: '0'
|
|
218
218
|
requirements:
|
|
219
219
|
- emacs
|
|
220
|
-
rubygems_version: 3.
|
|
220
|
+
rubygems_version: 3.6.9
|
|
221
221
|
specification_version: 4
|
|
222
222
|
summary: An opinionated static website generator for Org
|
|
223
223
|
test_files: []
|