fronde 0.6.2 → 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 +2 -2
- data/lib/fronde/config/data/ox-fronde.el +1 -1
- data/lib/fronde/config/data/ox-gmi.el +654 -0
- data/lib/fronde/config/helpers.rb +1 -1
- data/lib/fronde/config/lisp.rb +14 -13
- data/lib/fronde/index/atom_generator.rb +21 -19
- data/lib/fronde/index/data/template.xml +9 -4
- data/lib/fronde/index.rb +1 -1
- data/lib/fronde/org/file.rb +2 -2
- data/lib/fronde/org.rb +34 -40
- 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 +5 -1
- data/lib/tasks/cli.rake +1 -1
- data/lib/tasks/org.rake +27 -31
- metadata +20 -21
data/lib/fronde/config/lisp.rb
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'json'
|
|
4
|
-
require 'open-uri'
|
|
5
4
|
require_relative '../version'
|
|
6
5
|
require_relative '../org'
|
|
7
6
|
require_relative 'helpers'
|
|
@@ -11,6 +10,19 @@ module Fronde
|
|
|
11
10
|
# This module contains utilitary methods to ease ~org-config.el~
|
|
12
11
|
# file generation
|
|
13
12
|
module Lisp
|
|
13
|
+
class << self
|
|
14
|
+
def theme_directory(theme)
|
|
15
|
+
# User theme first to allow overwriting
|
|
16
|
+
directory = File.expand_path("themes/#{theme}")
|
|
17
|
+
return directory if Dir.exist? directory
|
|
18
|
+
|
|
19
|
+
directory = File.expand_path("data/themes/#{theme}", __dir__)
|
|
20
|
+
return directory if Dir.exist? directory
|
|
21
|
+
|
|
22
|
+
raise Errno::ENOENT, "Theme #{theme} not found"
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
14
26
|
# Generate emacs lisp configuration file for Org and write it.
|
|
15
27
|
#
|
|
16
28
|
# This method saves the generated configuration in the file
|
|
@@ -41,19 +53,8 @@ module Fronde
|
|
|
41
53
|
|
|
42
54
|
private
|
|
43
55
|
|
|
44
|
-
def theme_directory(theme)
|
|
45
|
-
# User theme first to allow overwriting
|
|
46
|
-
directory = File.expand_path("themes/#{theme}")
|
|
47
|
-
return directory if Dir.exist? directory
|
|
48
|
-
|
|
49
|
-
directory = File.expand_path("data/themes/#{theme}", __dir__)
|
|
50
|
-
return directory if Dir.exist? directory
|
|
51
|
-
|
|
52
|
-
raise Errno::ENOENT, "Theme #{theme} not found"
|
|
53
|
-
end
|
|
54
|
-
|
|
55
56
|
def org_theme_config(theme)
|
|
56
|
-
{ 'base-directory' => theme_directory(theme),
|
|
57
|
+
{ 'base-directory' => Lisp.theme_directory(theme),
|
|
57
58
|
# rubocop:disable Layout/LineLength
|
|
58
59
|
'base-extension' => %w[css js gif jpg png svg otf ttf woff2?].join('\\\\|'),
|
|
59
60
|
'publishing-directory' => "#{get('html_public_folder')}/assets/#{theme}",
|
|
@@ -34,21 +34,16 @@ module Fronde
|
|
|
34
34
|
# @param entries [Array] the article to list in this file
|
|
35
35
|
# @return [String] the Atom feed as a String
|
|
36
36
|
def atom_file(tag_name, entries)
|
|
37
|
-
domain = Fronde::CONFIG.get('domain')
|
|
38
37
|
slug = Slug.slug(tag_name)
|
|
39
|
-
|
|
40
|
-
Config::Helpers.render_liquid_template(
|
|
41
|
-
File.read(File.expand_path('./data/template.xml', __dir__)),
|
|
38
|
+
variables = atom_templating_basics.merge(
|
|
42
39
|
'title' => @tags_names[tag_name],
|
|
43
|
-
'lang' => Fronde::CONFIG.get('lang'),
|
|
44
|
-
'domain' => domain,
|
|
45
40
|
'slug' => slug,
|
|
46
|
-
'tagurl' => tagurl,
|
|
47
|
-
'upddate' => @date.xmlschema,
|
|
48
|
-
'author' => Fronde::CONFIG.get('author'),
|
|
49
|
-
'publication_format' => @project['mime_type'],
|
|
50
41
|
'entries' => entries
|
|
51
42
|
)
|
|
43
|
+
Config::Helpers.render_liquid_template(
|
|
44
|
+
File.read(File.expand_path('./data/template.xml', __dir__)),
|
|
45
|
+
variables
|
|
46
|
+
)
|
|
52
47
|
end
|
|
53
48
|
|
|
54
49
|
# Render the main/index Atom feed.
|
|
@@ -56,19 +51,26 @@ module Fronde
|
|
|
56
51
|
# @param entries [Array] the article to list in this file
|
|
57
52
|
# @return [String] the Atom feed as a String
|
|
58
53
|
def atom_index(entries)
|
|
59
|
-
|
|
54
|
+
variables = atom_templating_basics.merge(
|
|
55
|
+
'title' => @project['title'],
|
|
56
|
+
'slug' => '__HOME_PAGE__',
|
|
57
|
+
'entries' => entries
|
|
58
|
+
)
|
|
60
59
|
Config::Helpers.render_liquid_template(
|
|
61
60
|
File.read(File.expand_path('./data/template.xml', __dir__)),
|
|
62
|
-
|
|
61
|
+
variables
|
|
62
|
+
)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def atom_templating_basics
|
|
66
|
+
{
|
|
63
67
|
'lang' => Fronde::CONFIG.get('lang'),
|
|
64
|
-
'domain' => domain,
|
|
65
|
-
'slug' => 'index',
|
|
66
|
-
'tagurl' => domain,
|
|
67
|
-
'upddate' => @date.xmlschema,
|
|
68
68
|
'author' => Fronde::CONFIG.get('author'),
|
|
69
|
-
'
|
|
70
|
-
'
|
|
71
|
-
|
|
69
|
+
'domain' => Fronde::CONFIG.get('domain'),
|
|
70
|
+
'project_path' => @project.public_absolute_path,
|
|
71
|
+
'upddate' => @date.xmlschema,
|
|
72
|
+
'publication_format' => @project['mime_type']
|
|
73
|
+
}
|
|
72
74
|
end
|
|
73
75
|
end
|
|
74
76
|
end
|
|
@@ -4,12 +4,17 @@
|
|
|
4
4
|
xml:lang="{{ lang }}">
|
|
5
5
|
|
|
6
6
|
<title>{{ title | escape }}</title>
|
|
7
|
-
|
|
8
|
-
<link href="{{
|
|
7
|
+
{%- if slug == "__HOME_PAGE__" %}
|
|
8
|
+
<link href="{{ domain }}{{ project_path }}feeds/index.xml" rel="self" type="application/atom+xml"/>
|
|
9
|
+
<link href="{{ domain }}" rel="alternate" type="text/html" title="{{ title | escape }}"/>
|
|
10
|
+
{%- else %}
|
|
11
|
+
<link href="{{ domain }}{{ project_path }}feeds/{{ slug }}.xml" rel="self" type="application/atom+xml"/>
|
|
12
|
+
<link href="{{ domain }}{{ project_path }}tags/{{ slug }}.html" rel="alternate" type="text/html" title="{{ title | escape }}"/>
|
|
13
|
+
{%- endif %}
|
|
9
14
|
<updated>{{ upddate }}</updated>
|
|
10
15
|
<author><name>{{ author }}</name></author>
|
|
11
16
|
<id>urn:md5:{{ domain | md5 }}</id>
|
|
12
|
-
<generator uri="https://git.umaneti.net/fronde
|
|
17
|
+
<generator uri="https://git.umaneti.net/fronde">Fronde</generator>
|
|
13
18
|
|
|
14
19
|
{%- for article in entries %}
|
|
15
20
|
|
|
@@ -17,7 +22,7 @@
|
|
|
17
22
|
<title>{{ article.title | escape }}</title>
|
|
18
23
|
<link href="{{ article.url }}" rel="alternate"
|
|
19
24
|
type="{{ publication_format }}"
|
|
20
|
-
title="{{ article.title }}"/>
|
|
25
|
+
title="{{ article.title | escape }}"/>
|
|
21
26
|
<id>urn:md5:{{ article.timekey | md5 }}</id>
|
|
22
27
|
<published>{{ article.published_xml }}</published>
|
|
23
28
|
<updated>{{ article.updated_xml }}</updated>
|
data/lib/fronde/index.rb
CHANGED
data/lib/fronde/org/file.rb
CHANGED
|
@@ -193,7 +193,7 @@ module Fronde
|
|
|
193
193
|
.gsub('%l', @data[:lang])
|
|
194
194
|
.gsub('%L', Fronde::CONFIG.get('license', '').gsub(/\s+/, ' ').strip)
|
|
195
195
|
.gsub('%n', "Fronde #{Fronde::VERSION}")
|
|
196
|
-
.gsub('%N', "<a href=\"https://git.umaneti.net/fronde
|
|
196
|
+
.gsub('%N', "<a href=\"https://git.umaneti.net/fronde\">Fronde</a> #{Fronde::VERSION}")
|
|
197
197
|
.gsub('%o', project_data['theme'] || '')
|
|
198
198
|
.gsub('%s', @data[:subtitle])
|
|
199
199
|
.gsub('%t', @data[:title])
|
|
@@ -270,7 +270,7 @@ module Fronde
|
|
|
270
270
|
end
|
|
271
271
|
|
|
272
272
|
def find_source_for_org_file
|
|
273
|
-
Fronde::CONFIG.sources.find {
|
|
273
|
+
Fronde::CONFIG.sources.find { it.source_for? @file }
|
|
274
274
|
end
|
|
275
275
|
|
|
276
276
|
def find_source_for_publication_file
|
data/lib/fronde/org.rb
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'net/http'
|
|
4
|
+
require_relative 'version'
|
|
5
|
+
|
|
3
6
|
module Fronde
|
|
4
7
|
# Everything related to Org mode
|
|
5
8
|
#
|
|
@@ -7,6 +10,8 @@ module Fronde
|
|
|
7
10
|
# of the Emacs package. It also serves as a namespace for the class
|
|
8
11
|
# responsible for handling Org files: {Fronde::Org::File}.
|
|
9
12
|
module Org
|
|
13
|
+
GNU_ELPA_URL = 'https://elpa.gnu.org/packages/org'
|
|
14
|
+
|
|
10
15
|
class << self
|
|
11
16
|
def current_version
|
|
12
17
|
# Do not crash if Org is not yet installed (and thus return nil)
|
|
@@ -36,18 +41,27 @@ module Fronde
|
|
|
36
41
|
org_version
|
|
37
42
|
end
|
|
38
43
|
|
|
44
|
+
def http_get_client(uri, &)
|
|
45
|
+
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
|
|
46
|
+
request = Net::HTTP::Get.new(uri)
|
|
47
|
+
request['User-Agent'] = Fronde::USER_AGENT
|
|
48
|
+
http.request request, &
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
39
52
|
def fetch_version_number
|
|
40
|
-
# Retrieve last org version from
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
versions = URI(
|
|
46
|
-
'https://git.savannah.gnu.org/cgit/emacs/org-mode.git/refs/'
|
|
47
|
-
).open.readlines.map do |line|
|
|
48
|
-
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='
|
|
49
58
|
end
|
|
50
|
-
|
|
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
|
|
51
65
|
end
|
|
52
66
|
|
|
53
67
|
# Download latest org-mode tarball.
|
|
@@ -56,49 +70,29 @@ module Fronde
|
|
|
56
70
|
# @return [String] the downloaded org-mode version
|
|
57
71
|
def download(destination = 'var/tmp')
|
|
58
72
|
org_last_version = last_version(force: false, cookie_dir: destination)
|
|
59
|
-
|
|
60
|
-
uri = URI("https://git.savannah.gnu.org/cgit/emacs/org-mode.git/snapshot/#{tarball}")
|
|
73
|
+
uri = URI("#{GNU_ELPA_URL}-#{org_last_version}.tar")
|
|
61
74
|
# Will crash on purpose if anything goes wrong
|
|
62
|
-
|
|
63
|
-
fetch_org_tarball
|
|
75
|
+
http_get_client(uri) do |response|
|
|
76
|
+
fetch_org_tarball response, destination
|
|
64
77
|
end
|
|
65
78
|
org_last_version
|
|
66
79
|
end
|
|
67
80
|
|
|
68
|
-
def fetch_org_tarball(
|
|
81
|
+
def fetch_org_tarball(response, destination)
|
|
69
82
|
# Remove version number in dest file to allow easy rake file
|
|
70
83
|
# task naming
|
|
71
|
-
dest_file = ::File.expand_path('org.tar
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
response.read_body { |chunk| io.write chunk }
|
|
75
|
-
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 }
|
|
76
87
|
end
|
|
77
88
|
end
|
|
78
89
|
|
|
79
|
-
|
|
80
|
-
make = ['make', '-C', org_dir, target]
|
|
81
|
-
return make.join(' ') if verbose
|
|
82
|
-
|
|
83
|
-
make.insert(3, '-s')
|
|
84
|
-
make << 'EMACSQ="emacs -Q --eval \'(setq inhibit-message t)\'"'
|
|
85
|
-
make.join(' ')
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
# Compile downloaded Org package
|
|
90
|
+
# Extract downloaded Org tarball
|
|
89
91
|
#
|
|
90
92
|
# @param source [String] path to the org-mode tarball to install
|
|
91
|
-
# @param version [String] version of the org package to install
|
|
92
93
|
# @param target [String] path to the final install directory
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
untar_cmd = ['tar', '-xzf', source]
|
|
96
|
-
system(*untar_cmd)
|
|
97
|
-
FileUtils.mv "org-mode-release_#{version}", target
|
|
98
|
-
# Fix a weird unknown package version
|
|
99
|
-
::File.write("#{target}/mk/version.mk", "ORGVERSION ?= #{version}")
|
|
100
|
-
system(*make_org_cmd(target, 'compile', verbose:))
|
|
101
|
-
system(*make_org_cmd(target, 'autoloads', verbose:))
|
|
94
|
+
def extract(source, target)
|
|
95
|
+
system 'tar', '-C', target, '-xf', source
|
|
102
96
|
end
|
|
103
97
|
end
|
|
104
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
|
@@ -2,5 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
module Fronde
|
|
4
4
|
# @return [String] the version number of the current Fronde release.
|
|
5
|
-
VERSION = '0.6.
|
|
5
|
+
VERSION = '0.6.4'
|
|
6
|
+
|
|
7
|
+
USER_AGENT = ["Fronde/#{Fronde::VERSION}",
|
|
8
|
+
"(#{RUBY_ENGINE} #{RUBY_VERSION} #{RUBY_PLATFORM})",
|
|
9
|
+
'(+https://etienne.pflieger.bzh/fronde/)'].join(' ').freeze
|
|
6
10
|
end
|
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
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'open-uri'
|
|
4
|
-
|
|
5
3
|
require_relative '../fronde/config'
|
|
6
4
|
require_relative '../fronde/cli/throbber'
|
|
7
5
|
|
|
@@ -12,15 +10,16 @@ CLOBBER.push(
|
|
|
12
10
|
)
|
|
13
11
|
|
|
14
12
|
HTMLIZE_TAG = 'release/1.58'
|
|
15
|
-
|
|
13
|
+
TMP_ORG_TARBALL = 'var/tmp/org.tar'
|
|
16
14
|
|
|
17
15
|
namespace :org do
|
|
16
|
+
directory 'lib'
|
|
18
17
|
directory 'var/tmp'
|
|
19
18
|
|
|
20
19
|
desc 'Download last version of Org'
|
|
21
|
-
file
|
|
20
|
+
file TMP_ORG_TARBALL => 'var/tmp' do
|
|
22
21
|
# Weird Rake issue, still executing the task even if the file exists
|
|
23
|
-
next if File.exist?
|
|
22
|
+
next if File.exist? TMP_ORG_TARBALL
|
|
24
23
|
|
|
25
24
|
download = Thread.new do
|
|
26
25
|
version = Fronde::Org.download
|
|
@@ -33,18 +32,19 @@ namespace :org do
|
|
|
33
32
|
warn I18n.t('fronde.tasks.org.no_download') if verbose
|
|
34
33
|
end
|
|
35
34
|
|
|
36
|
-
desc '
|
|
37
|
-
multitask
|
|
35
|
+
desc 'Extract Org tarball'
|
|
36
|
+
multitask extract: [TMP_ORG_TARBALL, 'lib'] do |task|
|
|
38
37
|
# No need to force fetch last version as it is only interesting as
|
|
39
38
|
# part of the upgrade task
|
|
40
39
|
version = Fronde::Org.last_version
|
|
41
40
|
|
|
42
41
|
org_dir = "lib/org-#{version}"
|
|
43
|
-
next if
|
|
42
|
+
next if File.exist?("#{org_dir}/org-version.el")
|
|
44
43
|
|
|
45
44
|
build = Thread.new do
|
|
46
|
-
Fronde::Org.
|
|
47
|
-
|
|
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 }
|
|
48
48
|
puts I18n.t('fronde.tasks.org.installed', version:) if verbose
|
|
49
49
|
end
|
|
50
50
|
Fronde::CLI::Throbber.run(
|
|
@@ -54,23 +54,19 @@ namespace :org do
|
|
|
54
54
|
next
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
-
directory 'lib'
|
|
58
|
-
|
|
59
57
|
file 'lib/htmlize.el' => 'lib' do
|
|
60
|
-
|
|
58
|
+
uri = URI(
|
|
61
59
|
"https://raw.githubusercontent.com/hniksic/emacs-htmlize/refs/tags/#{HTMLIZE_TAG}/htmlize.el"
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
).open.read
|
|
70
|
-
File.write 'lib/ox-gmi.el', ox_gmi
|
|
60
|
+
)
|
|
61
|
+
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
|
|
62
|
+
request = Net::HTTP::Get.new(uri)
|
|
63
|
+
request['User-Agent'] = Fronde::USER_AGENT
|
|
64
|
+
http.request request
|
|
65
|
+
end
|
|
66
|
+
File.write 'lib/htmlize.el', response.body
|
|
71
67
|
end
|
|
72
68
|
|
|
73
|
-
file 'var/lib/org-config.el' => ['lib/htmlize.el'
|
|
69
|
+
file 'var/lib/org-config.el' => ['lib/htmlize.el'] do
|
|
74
70
|
Fronde::CONFIG.write_org_lisp_config
|
|
75
71
|
end
|
|
76
72
|
|
|
@@ -84,15 +80,15 @@ namespace :org do
|
|
|
84
80
|
end
|
|
85
81
|
|
|
86
82
|
desc 'Install Org'
|
|
87
|
-
multitask install: ['org:
|
|
88
|
-
# lib/htmlize.el
|
|
89
|
-
#
|
|
90
|
-
#
|
|
83
|
+
multitask install: ['org:extract', '.gitignore'] do
|
|
84
|
+
# lib/htmlize.el cannot be generated in parallel of org:compilation,
|
|
85
|
+
# as it will leads to a weird SSL error. Thus finishing file generation
|
|
86
|
+
# "manually" here.
|
|
91
87
|
Rake::Task['var/lib/org-config.el'].invoke
|
|
92
88
|
sources = Fronde::CONFIG.sources
|
|
93
|
-
sources.each { mkdir_p
|
|
89
|
+
sources.each { mkdir_p it['path'] }
|
|
94
90
|
|
|
95
|
-
outputs = sources.map {
|
|
91
|
+
outputs = sources.map { it['type'] }.uniq
|
|
96
92
|
if outputs.include?('html')
|
|
97
93
|
mkdir_p "#{Fronde::CONFIG.get('html_public_folder')}/assets"
|
|
98
94
|
end
|
|
@@ -104,7 +100,7 @@ namespace :org do
|
|
|
104
100
|
desc 'Upgrade Org'
|
|
105
101
|
task :upgrade do
|
|
106
102
|
Rake::Task['clobber'].execute
|
|
107
|
-
if File.exist?
|
|
103
|
+
if File.exist? TMP_ORG_TARBALL
|
|
108
104
|
# Cleanup cached tarball only if a new version is available.
|
|
109
105
|
# Also cached the new remote org version in the same time.
|
|
110
106
|
org_version = Fronde::Org.current_version
|
|
@@ -113,7 +109,7 @@ namespace :org do
|
|
|
113
109
|
rescue RuntimeError
|
|
114
110
|
last_version = org_version
|
|
115
111
|
end
|
|
116
|
-
File.unlink
|
|
112
|
+
File.unlink TMP_ORG_TARBALL unless org_version == last_version
|
|
117
113
|
end
|
|
118
114
|
Rake::Task['org:install'].invoke
|
|
119
115
|
end
|