[Groonga-commit] droonga/droonga.org at b6f6cf0 [gh-pages] Add "release" task

Back to archive index

Kouhei Sutou null+****@clear*****
Sun Nov 15 22:16:04 JST 2015


Kouhei Sutou	2015-11-15 22:16:04 +0900 (Sun, 15 Nov 2015)

  New Revision: b6f6cf0a5e3bda385c695b2137d17840bbdbfc22
  https://github.com/droonga/droonga.org/commit/b6f6cf0a5e3bda385c695b2137d17840bbdbfc22

  Message:
    Add "release" task

  Modified files:
    Rakefile

  Modified: Rakefile (+36 -1)
===================================================================
--- Rakefile    2015-11-15 22:02:55 +0900 (719398d)
+++ Rakefile    2015-11-15 22:16:04 +0900 (674a232)
@@ -16,8 +16,20 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 require "bundler/setup"
+
+require "pathname"
+require "yaml"
+
 require "jekyll/task/i18n"
 
+def env_value(name)
+  value = ENV[name]
+  raise "Specify #{name} environment variable" if value.nil?
+  value
+end
+
+task :default => "jekyll:i18n:translate"
+
 Jekyll::Task::I18n.define do |task|
   task.locales = ["ja"]
   task.translator_name = "Droonga Project"
@@ -51,4 +63,27 @@ Jekyll::Task::I18n.define do |task|
   end
 end
 
-task :default => "jekyll:i18n:translate"
+desc "Release a new version"
+task :release do
+  new_version = env_value("NEW_VERSION")
+  config_yaml_path = Pathname.new("_config.yml")
+  config_yaml_data = config_yaml_path.read
+  config = YAML.load(config_yaml_data)
+  current_version = config["droonga_version"]
+
+  targets = []
+  targets.concat(Pathname.glob("_po/*/{tutorial,reference}/"))
+  targets.concat(Pathname.glob("{tutorial,reference}/"))
+  targets.each do |target|
+    new_dir = target + new_version
+    current_dir = target + current_version
+    next unless current_dir.exist?
+    rm_rf(new_dir)
+    cp_r(current_dir, new_dir)
+  end
+
+  new_config = config.merge("droonga_version" => new_version)
+  config_yaml_path.open("w") do |config_yaml|
+    config_yaml.print(new_config.to_yaml)
+  end
+end
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index