[RUBY] Special Lecture on Multi-Scale Simulation: I tried to summarize the 8th


Course content

About the rake command

Image of rake → ruby version of make, ant

What is make in the first place ??

If you write the contents of Rakefile in ruby language </ strong>, Rakefile will work.

Rakefile description example

――The following program makes it possible to put the program on GitHub with one operation.

desc 'git push'
task :push do
  #You can leave a comment with p
  #I'm leaving comments for easy understanding
  p comm = "git add -A"
  #You can use external commands with system(However, the operation is slow)
  system comm

  p comm = "git commit -m \'hoge\'"
  system comm
  p comm = "git pull origin main"
  system comm
  p comm = "git push origin main"
  system comm


You can easily put the program on GitHub with the above program, but slow </ strong> because you are using an external command using system call.

So we use built-in functions.

--About built-in functions

However, the problem is that the return value from system is not the output, but whether the command was successful.

So, use command \ _line </ strong> to retrieve standard output (stdout) etc.

--How to install command \ _line

gem install command_line

org to_html, to_platex

The emacs org-mode is a command to output to ** html ** </ font> or ** latex ** </ font> Is prepared (too convenient ...)

--Execution command

c-c c-e ho # export as [h]tml, [o]ut
c-c c-e ll # export [l]atex, [l]atex 

It's super convenient because you can easily convert the format written in org-mode to html or latex !!

However, it is hard to see in the output by default, so it is easier to understand if you set it positive.

  • source ~/Downloads/git/grad_members_20f/members/taiseiyo/memos/class8.org

Recommended Posts