!!!name=value
//Set the environment variable name to value during the execution of the rake command. You can access the value by using ENV[’name’].
-rake コマンドに適用する、環境変数を value に指定します。ENV[’name’] を用いて value にアクセスできます。
+rake コマンドに適用する環境変数を、value に指定します。ENV[’name’] を用いて value にアクセスすることができます。
!!!―classic-namespace (-C)
//Put Task and FileTask in the top level namespace
@@ -22,11 +22,11 @@
!!!―dry-run (-n)
//Do a dry run. Print the tasks invoked and executed, but do not actually execute any of the actions.
-実行される内容を表示しますが、何も実行されません。
+何も実施せず、その内容のみを表示します。
!!!―help (-H)
//Display some help text and exit.
-ヘルプメッセージを表示します。
+ヘルプを表示します。
!!!―libdir directory (-I)
//Add directory to the list of directories searched for require.
@@ -34,27 +34,27 @@
!!!―nosearch (-N)
//Do not search for a Rakefile in parent directories.
-親ディレクトリで Rakefile を探さないようにします。
+親ディレクトリにさかのぼって Rakefile を探さないようにします。
!!!―prereqs (-P)
//Display a list of all tasks and their immediate prerequisites.
-すべてのタスクと、それを実施するために必要な条件を表示します。
+すべてのタスクと前提条件を、リストアップします。
!!!―quiet (-q)
//Do not echo commands from FileUtils.
-FileUtils のメッセージを非表示にします。
+詳細なメッセージを表示しないようにします(FileUtils のメッセージを非表示)。
!!!―rakefile filename (-f)
//Use filename as the name of the rakefile. The default rakefile names are rakefile and Rakefile (with rakefile taking precedence). If the rakefile is not found in the current directory, rake will search parent directories for a match. The directory where the Rakefile is found will become the current directory for the actions executed in the Rakefile.
-rakefile 名を指定します。デフォルトでは rakefile か Rakefile が指定されます(rakefile が優先されます)。カレントディレクトリで rakefile が見つからない場合は、親ディレクトリを探します。rakefile が見つかったディレクトリは、実行時のカレントディレクトリとして扱われます。
+明示的に rakefile 名を指定します。デフォルトでは rakefile か Rakefile が選ばれます(rakefile が優先されます)。カレントディレクトリで rakefile が見つからない場合は、親ディレクトリを探します。rakefile が見つかったディレクトリは、実行時にカレントディレクトリとして扱われます。
!!!―require name (-r)
//Require name before executing the Rakefile.
-Rakefile が実行される前に、require されるファイルを指定します。
+Rakefile が実行される前に、require するファイルを指定します。
!!!―tasks (-T)
//Display a list of the major tasks and their comments. Comments are defined using the “desc” command.
-主要タスクとそのコメントを表示します。コメントは desc で定義されます。
+すべてのタスクとそのコメントを、リストアップします。コメントは desc メソッドで定義します。
!!!―trace (-t)
//Turn on invoke/execute tracing. Also enable full backtrace on errors.
@@ -66,7 +66,7 @@
!!!―verbose (-v)
//Echo the Sys commands to standard output.
-標準出力に詳細なメッセージを表示します。
+詳細なメッセージを表示するようにします。
!!!―version (-V)
//Display the program version and exit.]]>FrequentlyAskedQuestions
http://www.kyobashi.org/hf/RakeUserGuide/?FrequentlyAskedQuestions
2017-08-14T02:02:39+00:00@@ -1,36 +1,68 @@
//FrequentlyAskedQuestions
//4. Frequently Asked Questions
+//4. よくある質問と回答
+//!4.1 How can I call one Rake task from inside another task?
+!4.1 あるタスクの中から別のタスクを呼び出すこには、どうすれば良いのでしょうか?
-!4.1 How can I call one Rake task from inside another task?
+//Generally, if you want invoke one task from another task, the proper way to do that is to include the task to be invoked as a prerequisite of the task doing the invoking.
+通常、あるタスク(:secondary と仮定)から、別のタスク(:primary と仮定)を実施するには、:secondary の前提条件として、:primary が実施済みであることを指定するのが、一般的です。
-Generally, if you want invoke one task from another task, the proper way to do that is to include the task to be invoked as a prerequisite of the task doing the invoking.
+//For example:
+*''例''
task :secondary do
- puts "Doing Secondary Task"
+ puts ":secondary の実施。"
end
-However, there are certain rare occasions where you want to invoke a task from within the body of a primary task. You could do it like this:
+//However, there are certain rare occasions where you want to invoke a task from within the body of a primary task. You could do it like this:
+しかし、まれにではありますが、:primary タスクの中で、:secondary タスクを実行したいというケースも存在します。その場合は以下のようにして実現できます。
+// task :primary do
+// Rake::Task[:secondary].invoke
+// end
+//
+// task :secondary do
+// puts "Doing Secondary Task"
+// end
task :primary do
Rake::Task[:secondary].invoke
end
task :secondary do
- puts "Doing Secondary Task"
+ puts ":secondary の実施。"
end
-Keep the following in mind:
+//Keep the following in mind:
+上記の方法を選んだ場合、以下を念頭に置いてください。
-* The secondary task will be invoked when the body of the primary task is executed.
-* All prerequisites of the secondary task will be run before it body of the secondary task.
-* If the secondary task has already been run, it will not be run again, even though it has been explicitly invoked. Rake tasks can only be invoked once per run.
+//* The secondary task will be invoked when the body of the primary task is executed.
+* :primary タスクが実施される際に、その中で :secondary タスクが実施されます。
+//* All prerequisites of the secondary task will be run before it body of the secondary task.
+* :secondary タスクのすべての前提条件は、:primary の前ではなく、:secondary タスクの前に実施されます。
+//* If the secondary task has already been run, it will not be run again, even though it has been explicitly invoked. Rake tasks can only be invoked once per run.
+* もし、一度でも :secondary タスクが実施されれば、例え明示的に指定されても、再度実施されることはありません。Rake のタスクは、実行時に一度だけです
-If the second and third point above are not to your liking, then perhaps you should consider making the secondary task a regular Ruby method and just calling it directly. Something like this:
+//If the second and third point above are not to your liking, then perhaps you should consider making the secondary task a regular Ruby method and just calling it directly. Something like this:
+もし、二つめと三つ目の条件が気に入らない場合は、通常の Ruby のメソッドを使って :secondary タスクと :primary タスクで、そのメソッドを呼び出すことを考慮する必要があるでしょう。以下のようにです。
+// task :primary do
+// secondary_task
+// end
+//
+// task :secondary do
+// secondary_task
+// end
+//
+// def secondary_task
+// puts "Doing Secondary Task"
+// end
task :primary do
secondary_task
end
@@ -40,5 +72,37 @@
end