[logaling-commit] logaling/logalimacs [master] refactor Rakefile for suto

Back to archive index

null+****@clear***** null+****@clear*****
Thu Jan 19 18:39:42 JST 2012


yuta yamada	2012-01-19 18:39:42 +0900 (Thu, 19 Jan 2012)

  New Revision: d93dd91e6bd38f68c0a014211dbbf4df5a4d8242

  Log:
    refactor Rakefile for suto

  Modified files:
    Rakefile

  Modified: Rakefile (+23 -29)
===================================================================
--- Rakefile    2012-01-19 18:04:05 +0900 (55ec900)
+++ Rakefile    2012-01-19 18:39:42 +0900 (57609ef)
@@ -1,48 +1,42 @@
-# -*- coding: utf-8 -*-
+# -*- mode: ruby; coding: utf-8 -*-
 
-# this program is Rakefile for marmalade(Repository site for Emacs lisp). 
-# you can possible to create package-directory for marmalade
+# This program is Rakefile for marmalade(Repository site for Emacs lisp). 
+# You can possible to create package-directory for marmalade.
 
 # Input your configuration
 PACKAGE_NAME = "logalimacs"
-VERSION = "0.0.2"
+PACKAGE_VERSION = "0.0.2"
 REQUIREMENTS = ["logalimacs.el", "logalimacs-config.el",
                 "logalimacs-rurema.el"]
 DESCRIPTION = "Front-end of logaling-command for ruby gem"
 
-# require list structure for Emacs lisp
+# Require list structure for Emacs lisp
 # @todo refactor to support against multiple list
-DEPENDING_ON = '\'((popwin "0.4"))'
-
+DEPENDENCIES = '\'((popwin "0.4"))'
 
 # Decided at automatic
-NAME_OF_PKG_EL = PACKAGE_NAME.to_s + "-pkg.el"
-CONTENT_OF_PKG_EL = "(define-package \"#{PACKAGE_NAME}\" \"#{VERSION}\"
-\"#{DESCRIPTION}\" #{DEPENDING_ON})"
-MARMALADE_PKG_NAME = PACKAGE_NAME + "-" + VERSION
+PKG_EL = "#{PACKAGE_NAME}-pkg.el"
+PKG_EL_CONTENT = <<-ELISP
+(define-package "#{PACKAGE_NAME}" "#{PACKAGE_VERSION}" "#{DESCRIPTION}" #{DEPENDENCIES})
+ELISP
+MARMALADE_PACKAGE_NAME = "#{PACKAGE_NAME}-#{PACKAGE_VERSION}"
 
 #--rakefile--
-task :default => :packaging_for_marmalade
-
-task :packaging_for_marmalade => :create_tar do
-end
+task :default => :package
 
-task :make_pkg_el do
-  `rm -fr #{file_name = NAME_OF_PKG_EL}`
-  open(NAME_OF_PKG_EL, "w") do |content|
-    content.print(CONTENT_OF_PKG_EL)
-  end
+desc "Package #{PACKAGE_NAME}"
+task :package => :bundle do
+  sh("tar", "cvf", "#{MARMALADE_PACKAGE_NAME}.tar", MARMALADE_PACKAGE_NAME)
 end
 
-task :file_handler => :make_pkg_el do
-  `rm -fr #{MARMALADE_PKG_NAME}`
-  `mkdir #{MARMALADE_PKG_NAME}`
+desc "Bundle #{PACKAGE_NAME}"
+task :bundle => "Rakefile" do
+  rm_rf(MARMALADE_PACKAGE_NAME)
+  mkdir(MARMALADE_PACKAGE_NAME)
   REQUIREMENTS.each do |file|
-    `cp #{file} #{MARMALADE_PKG_NAME}`
+    cp(file, MARMALADE_PACKAGE_NAME)
+  end
+  open("#{MARMALADE_PACKAGE_NAME}/#{PKG_EL}", "w") do |content|
+    content.print(PKG_EL_CONTENT)
   end
-  `cp #{NAME_OF_PKG_EL} #{MARMALADE_PKG_NAME}`
-end
-
-task :create_tar => :file_handler do
-  `tar cvf #{MARMALADE_PKG_NAME}.tar #{MARMALADE_PKG_NAME}`
 end




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