このウェブサイトは販売用です! twiwt.org は、あなたがお探しの情報の全ての最新かつ最適なソースです。一般トピックからここから検索できる内容は、twiwt.orgが全てとなります。あなたがお探しの内容が見つかることを願っています!
このウェブサイトは販売用です! twiwt.org は、あなたがお探しの情報の全ての最新かつ最適なソースです。一般トピックからここから検索できる内容は、twiwt.orgが全てとなります。あなたがお探しの内容が見つかることを願っています!
さて、2回目の今回は Thor。北欧神話で言うと最強らしい。 http://ja.wikipedia.org/wiki/%E3%83%88%E3%83%BC%E3%83%AB でも Rails3 で使うのはこっち。 http://github.com/wycats/thor Ruby の Thor は平たく言えばコマンドライン操作に対して、より簡便なオプション解釈の手段を提供してくれるDSLだ。個人的には Sake に似ているなーという印象。オプション解釈と聞いて GNU の getopt とか getopt_long といったライブラリが思い浮かぶ人もいるかもしれないが、Thor ができるのはもうちょっと広範囲に及ぶ。 Thor はgemで簡単にインストールできる。 $ sudo gem install thor渡せるオプションは以下の形式。 :boolean - is parsed a
mitukiii.jp | Rubyでコマンドラインスクリプト書くならThorが便利そう を見て Thorを使ってみました。 gistの中身をコマンドラインで見れたら嬉しいなと思っていたので 作ってみることにしました。 作成中にswdyh/gisty - GitHubというcoolなツールがあるのと 試しにbundle gemでgemの雛形作った辺りでdefunkt/gist - GitHubってのも あると気づいたんだけど。。。 作るもののイメージ 手始めに ・gist listで一覧取得 ・gist show id/number で詳細参照 ・対象gistユーザは、git config --get user.name もしくは ENV['GIST_USER']から取得 機能として不十分な点(とりあえず後回し) ・local cache(http HEADを使う) ・private gi
$ demo Tasks: demo abc # print 'abc' demo efg [option] # print 'efg' demo help [TASK] # Describe available tasks or one specific task $ demo abc abc! $ demo zzz Could not find task "zzz". $ demo efg efg! $ demo efg -u EFG! $ demo help efg Usage: demo efg [option] Options: -u, [--upcase] # disp upcase print 'efg' #! /usr/bin/env ruby require 'rubygems' require 'thor' class Demo < Thor desc "abc", "
『るびま』は、Ruby に関する技術記事はもちろんのこと、Rubyist へのインタビューやエッセイ、その他をお届けするウェブ雑誌です。 Rubyist Magazine について 『Rubyist Magazine』、略して『るびま』は、日本 Ruby の会の有志による Rubyist の Rubyist による、Rubyist とそうでない人のためのウェブ雑誌です。 最新号 Rubyist Magazine 0058 号 バックナンバー Rubyist Magazine 0058 号 RubyKaigi 2018 直前特集号 Rubyist Magazine 0057 号 RubyKaigi 2017 直前特集号 Rubyist Magazine 0056 号 Rubyist Magazine 0055 号 Rubyist Magazine 0054 号 東京 Ruby 会議 11 直
Ruby 開発環境 AdventCalendar 10 日目です。前日は、 aereal さんでした。 さて、皆さんコマンド打ちまくってますか?僕は Ctrl+R で履歴から引っぱり出さないとタイポで撃沈します。 そんなこんなで皆さんいろんな CLI ツールをご利用中だと思います。 vim とか emacs とか、 rails g とか、 guard とか。実に便利なものたちですが、現実の開発現場に即した、素晴らしいニッチなツールというのは、得てしてそんなにないものです。 「こんなに重厚でなくていい」 「もうちょっとざっくりとした……なんというか痒いところに手が届くような……」 などなど、いろいろあると思います。例えば「チームで開発しているのだが、今行ったコミットのレビューを依頼するメールを書くのが面倒なので社内 Twitter 的なものに書こうかと思うのだがそれもめんどくさいのでコミット
もしかしたら、Rubyに慣れてない人には気付いていない人も居るかと思ったので、 カジュアルにRubyGemsを活用する事のメリットについて書いておきます。 普通、Rubyのgemパッケージは、gem installでインストールできるようにrubygems.orgにホスティングしておくのが基本です。 とは言え、世界的に公開されるものなので、ちゃんとgemとしての体裁を整えておかないと何か恥ずかしいし、説明とかも英語でちゃんと書いとかないと、って考えると面倒なレベルのツールとかあると思います。 API叩くための簡易コマンドとか、社内ツールの処理自動化とか。 しかし、Bundlerとgitのおかげで、現在はそういった事を余り気にする必要が無くなっています。 Bundlerは、gitリポジトリから直接コードをクローンして、パッケージ化されたgemと同様に扱う事ができます。 参考: Bundler
仕事でブラウザベースのファイルライブラリ的なものを作ろうかどうしようかって雰囲気なので、どうせなら過去の履歴もコメント付きで追えて、なおかつ過去の変更時点での状態のものをダウンロード出来たら便利じゃね?って思ったらそれってGitじゃんっておもったので調べてみた (ハァハァ 参考にしたのはこのサイト Grit を使って Git リポジトリを Ruby で操作する 紹介されているのはGritとかいうRubyのライブラリ。なんじゃいそれはと思ってたら、かのgithubでも使ってるそうな。おお。信頼性高そう。 インストール gemを検索してみたらあったあった(^◯^) $ gem search grit -r *** REMOTE GEMS *** grit (2.4.1) ではインストール $ sudo gem install grit Successfully installed grit-2
先にRuby2.0の要約と付け足しをやったけど、今度はRails4。Rails4はざっくり見た感じ、導入負担が少なくていいものらしい。ザックリとしか書かないので、詳しくは下の雑誌で。 amazon 表面上の違いは、今までのバージョンアップほどないらしいけど、根本的な内部の変更があるみたい。 それまでとの大きな相違点は ・Ruby2.0対応 ・マイナー機能の削除 ・動作速度アップ(体感できるほどらしい) ・セキュリティの向上 って書いてあるよ。 以下、細かく見ていく。 ん~アメリカで流行った後は、南米で流行っちゃったのかぁ。もう、日本でRuby作ってようと作ってまいとあんまり関係ない感じになっちゃってるな。まぁ元々、Rubyが逆輸入されたような形で、RailsがRubyを盛り立てたところがありましたが、今後も重要な位置を占めるのは間違いない様子です。 マイナー機能の削除ですが、具体的には、
rbenv 環境下で実行された Ruby プログラムの中から他の Ruby プログラムを起動するときに、 rbenv 環境をリセットしたい―要するに別のバージョンの Ruby で外部プログラムを実行したい―という事情があったので rbenv のメカニズムについて調べた。 rbenv 環境下で ruby コマンドを実行するとき、実際にコンパイルされた ruby バイナリが直接実行されているわけではない。 rbenv 環境をお膳立てした上で ruby バイナリを exec するラッパーのシェルスクリプトが実行される。こういうものを binstub と呼ぶ。 binstub である ruby という名前のシェルスクリプトの中身をみてみると、最終的に rbenv exec というサブコマンドを呼び出している。 rbenv のサブコマンドはリポジトリでいうと libexec ディレクトリ以下にある。
Capybara-Webkit+Cucumber+Sinon.JSでJavaScriptのテストはここまで変わる:フレームワークで実践! JavaScriptテスト入門(5)(1/3 ページ) しっかりとJavaScriptをテストするために、今注目のJavaScript用のテストフレームワークをいくつか紹介し、その概要から実践的な使い方まで解説する連載。今回は、RubyでWebKitをヘッドレス化するフレームワーク、受け入れテストの記述が日本語でできるツール、スタブやモック、スパイが使えるライブラリを組み合わせたテスト方法などを紹介。 Capybara-WebkitとCucumberとSinon.JSを利用したJavaScriptのテスト 本連載の最終回となる今回は、これまでの連載のようなJavaScriptのロジックを単体テストするのではなく、Webブラウザ上の操作と、それによって動作
『るびま』は、Ruby に関する技術記事はもちろんのこと、Rubyist へのインタビューやエッセイ、その他をお届けするウェブ雑誌です。 Rubyist Magazine について 『Rubyist Magazine』、略して『るびま』は、日本 Ruby の会の有志による Rubyist の Rubyist による、Rubyist とそうでない人のためのウェブ雑誌です。 最新号 Rubyist Magazine 0058 号 バックナンバー Rubyist Magazine 0058 号 RubyKaigi 2018 直前特集号 Rubyist Magazine 0057 号 RubyKaigi 2017 直前特集号 Rubyist Magazine 0056 号 Rubyist Magazine 0055 号 Rubyist Magazine 0054 号 東京 Ruby 会議 11 直
RubyやRailsで外部APIを利用するソフトウェアを開発しているときに、テストで実際に何度もAPIに問い合わせにをしていたら、遅くて話になりません。ましてや、外部APIがメンテナンスなんてことになったら、開発が止まってしまいます。 そこで、webmockなどを利用して、HTTPリクエストやレスポンスのmockを作成することが望ましいです。 vcrを組み合わせて利用すれば、初回だけ実際にHTTPリクエストとレスポンスを記録して、2回目以降は記録したデータからmockとしてデータを返すように簡単にできます。 webmockとvcrのインストール方法Gemfileに以下のように記述する group :development, :test do gem 'webmock' gem 'vcr' endgemをインストールする $ bundletest/test_helper.rbにVCRに関する
2010年10月27日11:09 Ruby 結局、Rubyの特異メソッドって何なの? 今日は 特異メソッド について理解を深めるために書いてみます。説明の中にメソッドが色々出てきてややこしいですが、このルールで使っています。m(_ _)m c_method # クラスメソッド e_method # 特異メソッド i_method # インスタンスメソッド 特異メソッドっていうのは、オブジェクト固有のメソッドです。あるオブジェクトにはあるけど、同じクラスの別のオブジェクトにはそのメソッドは無い、みたいなメソッドですね。 class MyClass; end obj = MyClass.new obj2 = MyClass.new def obj.e_method puts "e_method called" end obj.e_method # e_method called obj2.e_
クラスの継承リスト: OpenStruct < Object < Kernel 要約 要素を動的に追加・削除できる手軽な構造体を提供するクラスです。 OpenStruct のインスタンスに対して未定義なメソッド x= を呼ぶと、 OpenStruct クラスの Object#method_missing で捕捉され、そのインスタンスに インスタンスメソッド x, x= が定義されます。 この挙動によって要素を動的に変更できる構造体として働きます。 require 'ostruct' ab = OpenStruct.new ab.foo = 25 p ab.foo # => 25 ab.bar = 2 p ab.bar # => 2 p ab # => <OpenStruct foo=25, bar=2> ab.delete_field("foo") p ab.foo # => nil p
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く