{"id":25825,"date":"2014-12-10T21:04:10","date_gmt":"2014-12-10T12:04:10","guid":{"rendered":"http:\/\/www.softantenna.com\/wp\/?p=25825"},"modified":"2014-12-10T21:06:28","modified_gmt":"2014-12-10T12:06:28","slug":"traveling-ruby","status":"publish","type":"post","link":"https:\/\/softantenna.com\/blog\/traveling-ruby\/","title":{"rendered":"Traveling Ruby - \u5358\u72ec\u5b9f\u884c\u53ef\u80fd\u306aRuby\u30a2\u30d7\u30ea\u3092\u4f5c\u6210"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2014\/12\/ITravelingRuby.png\" alt=\"TravelingRuby\" title=\"TravelingRuby.png\" border=\"0\" width=\"546\" height=\"225\" \/><\/p>\n<p>Ruby\u30a2\u30d7\u30ea\u306e\u958b\u767a\u8005\u306b\u3068\u3063\u3066\u60a9\u307e\u3057\u3044\u554f\u984c\u306e\u4e00\u3064\u306b\u3001\u30a8\u30f3\u30c9\u30e6\u30fc\u30b6\u30fc\u306e\u74b0\u5883\u306b\u3069\u3046\u3084\u3063\u3066Ruby\u306e\u5b9f\u884c\u74b0\u5883\u3092\u5c0e\u5165\u3059\u308b\u304b\u3068\u3044\u3046\u554f\u984c\u304c\u3042\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002Ruby\u30a2\u30d7\u30ea\u306e\u5b9f\u884c\u306b\u306f\u3001Ruby\u306e\u30a4\u30f3\u30bf\u30d7\u30ea\u30bf\u3084RubyGems\u304c\u5fc5\u8981\u306a\u306e\u306b\u3001\u30a8\u30f3\u30c9\u30e6\u30fc\u30b6\u30fc\u306e\u74b0\u5883\u3067\u306f\u3053\u308c\u3089\u306e\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u306a\u3044\u4e8b\u304c\u591a\u3044\u304b\u3089\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u554f\u984c\u3092\u89e3\u6c7a\u3059\u308b\u305f\u3081\u306b\u958b\u767a\u3055\u308c\u305f\u30c4\u30fc\u30eb\u304c\u300c<a href=\"http:\/\/phusion.github.io\/traveling-ruby\/\">Traveling Ruby<\/a>\u300d\u3067\u3059\u3002Ruby\u30a4\u30f3\u30bf\u30d7\u30ea\u30bf\u3084RubyGems\u300c\u5168\u90e8\u8fbc\u307f\u300d\u306eRuby\u30a2\u30d7\u30ea\u306e\u4f5c\u6210\u3092\u52a9\u3051\u3066\u304f\u308c\u308b\u30c4\u30fc\u30eb\u3067\u3059\u3002<!--more--><\/p>\n<h3>\u30b5\u30f3\u30d7\u30eb\u30a2\u30d7\u30ea\u306e\u4f5c\u6210<\/h3>\n<p>\u3069\u306e\u3088\u3046\u306a\u3082\u306e\u304b\u7406\u89e3\u3059\u308b\u305f\u3081\u306b\u3001<a href=\"https:\/\/github.com\/phusion\/traveling-ruby\/blob\/master\/TUTORIAL-1.md\">Tutorial 1: hello world<\/a>\u3092\u5b9f\u884c\u3057\u3066\u307f\u308b\u306e\u304c\u5206\u304b\u308a\u3084\u3059\u3044\u3067\u3059\u3002<\/p>\n<p>\u73fe\u5728\u306e\u3068\u3053\u308dTraveling Ruby\u306fMac\/Linux\u306b\u3057\u304b\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u305b\u3093\u3002\u4ee5\u4e0bMac\u3067\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<h4>\u524d\u6e96\u5099<\/h4>\n<p>hello_app\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u3001\u305d\u306e\u4e2d\u306bhello.rb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre>\n$ mkdir hello_app\n$ cd hello_app\n$ echo '#!\/usr\/bin\/env ruby' > hello.rb\n$ echo 'puts \"hello world\"' >> hello.rb\n$ ruby hello.rb\nhello world\n<\/pre>\n<h4>package\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u4f5c\u6210<\/h4>\n<p>package\u4f5c\u6210\u306e\u6e96\u5099\u3092\u884c\u3044\u307e\u3059\u3002\u307e\u305ahello.rb\u3092\u4ee5\u4e0b\u306e\u30d5\u30a9\u30eb\u30c0\u306b\u30b3\u30d4\u30fc\u3002<\/p>\n<pre>\n$ mkdir -p hello-1.0.0-osx\/lib\/app\/\n$ cp hello.rb hello-1.0.0-osx\/lib\/app\/\n<\/pre>\n<p>packaging\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3057\u3001\u5c02\u7528\u306eRuby\u5b9f\u884c\u74b0\u5883\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002\u305d\u306e\u5f8chello-1.0.0-osx\u4ee5\u4e0b\u306b\u5c55\u958b\u3057\u307e\u3059\u3002<\/p>\n<pre>\n$ mkdir packaging\n$ cd packaging\n$ curl -L -O --fail http:\/\/d6r77u77i8pq3.cloudfront.net\/releases\/traveling-ruby-20141209-2.1.5-osx.tar.gz\n$ cd ..\n$ mkdir hello-1.0.0-osx\/lib\/ruby && tar -xzf packaging\/traveling-ruby-20141209-2.1.5-osx.tar.gz -C hello-1.0.0-osx\/lib\/ruby\n<\/pre>\n<p>\u3053\u308c\u306f\u8981\u3059\u308b\u306b\u3001hello-1.0.0-osx\u4ee5\u4e0b\u306b\u81ea\u4f5c\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3068Ruby\u5b9f\u884c\u74b0\u5883\u3092\u914d\u7f6e\u3057\u305f\u3060\u3051\u3067\u3059\u3002\u73fe\u6bb5\u968e\u3067hello_app\u4ee5\u4e0b\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u968e\u5c64\u306f\u6b21\u306e\u3088\u3046\u306a\u69cb\u9020\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2014\/12\/Ihello_app.png\" alt=\"Hello app\" title=\"hello_app.png\" border=\"0\" width=\"546\" height=\"336\" \/><\/p>\n<h4>\u30c6\u30b9\u30c8<\/h4>\n<p>\u73fe\u6bb5\u968e\u3067\u30b9\u30af\u30ea\u30d7\u30c8\u304c\u5b9f\u884c\u3067\u304d\u308b\u304b\u30c6\u30b9\u30c8\u3057\u307e\u3059\u3002<\/p>\n<pre>\n$ cd hello-1.0.0-osx\n$ .\/lib\/ruby\/bin\/ruby lib\/app\/hello.rb\nhello world\n$ cd ..\n<\/pre>\n<h4>wrapper script\u306e\u4f5c\u6210<\/h4>\n<p>hello.rb\u3092\u7c21\u5358\u306b\u547c\u3073\u51fa\u305b\u308b\u3088\u3046\u30e9\u30c3\u30d1\u30fc\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p>packaging\/wrapper.sh\u3092\u4ee5\u4e0b\u306e\u5185\u5bb9\u3067\u4f5c\u6210\u3002<\/p>\n<pre>\n#!\/bin\/bash\nset -e\n\n# Figure out where this script is located.\nSELFDIR=\"`dirname \\\"$0\\\"`\"\nSELFDIR=\"`cd \\\"$SELFDIR\\\" && pwd`\"\n\n# Run the actual app using the bundled Ruby interpreter.\nexec \"$SELFDIR\/lib\/ruby\/bin\/ruby\" \"$SELFDIR\/lib\/app\/hello.rb\"\n<\/pre>\n<p>\u5b9f\u884c\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3\u3092\u3064\u3051\u3001hello-1.0.0-osx\/hello\u3068\u3057\u3066\u30b3\u30d4\u30fc\u3057\u307e\u3059\u3002<\/p>\n<pre>\n$ chmod +x packaging\/wrapper.sh\ncp packaging\/wrapper.sh hello-1.0.0-osx\/hello\n<\/pre>\n<h4>\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u5b8c\u6210<\/h4>\n<p>\u3053\u3053\u307e\u3067\u304d\u305f\u3089\u307b\u307c\u5b8c\u6210\u3002\u3042\u3068\u306ftar\u3067\u56fa\u3081\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<pre>\n$ tar -czf hello-1.0.0-osx.tar.gz hello-1.0.0-osx\n$ rm -rf hello-1.0.0-osx\n<\/pre>\n<p>hello-1.0.0-linux-x86.tar.gz\u304c\u5b8c\u6210\u3057\u305f\u30d1\u30c3\u30b1\u30fc\u30b8\u3067\u3059\u3002\u30a8\u30f3\u30c9\u30e6\u30fc\u30b6\u30fc\u306f\u3053\u308c\u3092\u89e3\u51cd\u3057\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5b9f\u884c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre>\n$ \/path-to\/hello-1.0.0-linux-x86\/hello\n hello world\n<\/pre>\n<p>\u3055\u3089\u306bRake\u3067\u4ee5\u4e0a\u306e\u30d7\u30ed\u30bb\u30b9\u3092\u81ea\u52d5\u5316\u3059\u308b\u65b9\u6cd5\u3082\u63b2\u8f09\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u6c17\u306b\u306a\u308b\u65b9\u306f\u78ba\u8a8d\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h3>\u307e\u3068\u3081<\/h3>\n<p>Ruby\u306e\u5b9f\u884c\u74b0\u5883\u3068\u81ea\u4f5c\u30b9\u30af\u30ea\u30d7\u30c8\u3092tar\u3067\u56fa\u3081\u3066\u914d\u5e03\u3059\u308c\u3070\u3069\u3093\u306a\u74b0\u5883\u3067\u3082\u5b9f\u884c\u53ef\u80fd\u306aRuby\u30a2\u30d7\u30ea\u304c\u914d\u5e03\u3067\u304d\u308b\u2026\u3068\u3044\u3046\u8003\u3048\u3066\u307f\u308c\u3070\u5f53\u305f\u308a\u524d\u306e\u767a\u60f3\u3067\u3059\u304c\u3001\u624b\u9806\u5316\u3055\u308c\u305f\u3053\u3068\u3067\u4f7f\u3044\u3084\u3059\u304f\u306a\u3063\u3066\u3044\u3066\u3001\u305d\u3053\u306b\u5229\u7528\u4fa1\u5024\u304c\u3042\u308b\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>Ruby\u30a2\u30d7\u30ea\u306e\u914d\u5e03\u306b\u982d\u3092\u60a9\u307e\u3057\u3066\u3044\u308b\u958b\u767a\u8005\u306e\u65b9\u306f\u30c1\u30a7\u30c3\u30af\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ruby\u30a2\u30d7\u30ea\u306e\u958b\u767a\u8005\u306b\u3068\u3063\u3066\u60a9\u307e\u3057\u3044\u554f\u984c\u306e\u4e00\u3064\u306b\u3001\u30a8\u30f3\u30c9\u30e6\u30fc\u30b6\u30fc\u306e\u74b0\u5883\u306b\u3069\u3046\u3084\u3063\u3066Ruby\u306e\u5b9f\u884c\u74b0\u5883\u3092\u5c0e\u5165\u3059\u308b\u304b\u3068\u3044\u3046\u554f\u984c\u304c\u3042\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002Ruby\u30a2\u30d7\u30ea\u306e\u5b9f\u884c\u306b\u306f\u3001Ruby\u306e\u30a4\u30f3\u30bf\u30d7\u30ea\u30bf\u3084RubyGems\u304c\u5fc5\u8981\u306a [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":25823,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[75],"tags":[264,154],"class_list":["post-25825","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software","tag-app","tag-ruby"],"_links":{"self":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/25825","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/comments?post=25825"}],"version-history":[{"count":0,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/25825\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media\/25823"}],"wp:attachment":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media?parent=25825"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/categories?post=25825"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/tags?post=25825"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}