aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar √Čtienne Deparis 2020-03-22 13:14:41 +0100
committerGravatar √Čtienne Deparis 2020-03-22 13:14:41 +0100
commit82ed0fdeb3bbbdb5a5004538f633ad3eef8c484d (patch)
tree16ebf0d2733982d7129bc177bd53e8681314e586
parentd383ac66f5b7703760a483092754f684d301ae98 (diff)
downloadneruda-82ed0fdeb3bbbdb5a5004538f633ad3eef8c484d.zip
neruda-82ed0fdeb3bbbdb5a5004538f633ad3eef8c484d.tar.gz
neruda-82ed0fdeb3bbbdb5a5004538f633ad3eef8c484d.tar.xz
Put tags related tasks in a dedicated rake file
-rw-r--r--lib/tasks/site.rake20
-rw-r--r--lib/tasks/tags.rake23
-rw-r--r--neruda.gemspec1
3 files changed, 24 insertions, 20 deletions
diff --git a/lib/tasks/site.rake b/lib/tasks/site.rake
index b270f74..f77c27f 100644
--- a/lib/tasks/site.rake
+++ b/lib/tasks/site.rake
@@ -62,23 +62,3 @@ namespace :site do
end
# :nocov:
end
-
-namespace :tags do
- desc 'List all tags by name'
- task :name do
- blog_path = Neruda::Config.settings['blog_path']
- next if blog_path.nil?
- next unless Dir.exist?("src/#{blog_path}")
- index = Neruda::Index.new
- puts index.sort_by(:name).join("\n")
- end
-
- desc 'List all tags by weight'
- task :weight do
- blog_path = Neruda::Config.settings['blog_path']
- next if blog_path.nil?
- next unless Dir.exist?("src/#{blog_path}")
- index = Neruda::Index.new
- puts index.sort_by(:weight).join("\n")
- end
-end
diff --git a/lib/tasks/tags.rake b/lib/tasks/tags.rake
new file mode 100644
index 0000000..02982e1
--- /dev/null
+++ b/lib/tasks/tags.rake
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+require 'neruda/index'
+
+namespace :tags do
+ desc 'List all tags by name'
+ task :name do
+ blog_path = Neruda::Config.settings['blog_path']
+ next if blog_path.nil?
+ next unless Dir.exist?("src/#{blog_path}")
+ index = Neruda::Index.new
+ puts index.sort_by(:name).join("\n")
+ end
+
+ desc 'List all tags by weight'
+ task :weight do
+ blog_path = Neruda::Config.settings['blog_path']
+ next if blog_path.nil?
+ next unless Dir.exist?("src/#{blog_path}")
+ index = Neruda::Index.new
+ puts index.sort_by(:weight).join("\n")
+ end
+end
diff --git a/neruda.gemspec b/neruda.gemspec
index 5252108..dc041be 100644
--- a/neruda.gemspec
+++ b/neruda.gemspec
@@ -31,6 +31,7 @@ Gem::Specification.new do |s|
'lib/tasks/org.rake',
'lib/tasks/site.rake',
'lib/tasks/sync.rake',
+ 'lib/tasks/tags.rake',
# Translations
'locales/en.yml',
'locales/fr.yml',