Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Ruby tools for Infrastructure Engineer (hbstyle...
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
rrreeeyyy
June 13, 2014
Technology
550
0
Share
Ruby tools for Infrastructure Engineer (hbstyle-2014-0612)
rrreeeyyy
June 13, 2014
More Decks by rrreeeyyy
See All by rrreeeyyy
Rethinking Incident Response: Context-Aware AI in Practice - Incident Buddy Edition -
rrreeeyyy
0
230
Rethinking Incident Response: Context-Aware AI in Practice
rrreeeyyy
3
2.5k
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
300
An Efficient Incident Response Training with AI / SRE NEXT 2024 Sponsor Session
rrreeeyyy
1
6.1k
カンファレンスから見る SRE トレンド 2024 / SRE Trends from Conferences in 2024 #SRE_Findy
rrreeeyyy
4
2.6k
信頼性の育て方 / mackerel-meetup-15
rrreeeyyy
10
2.9k
SRE の歩き方・進め方 / sre-walk-through-procedure
rrreeeyyy
0
9k
「信頼性」を保ちつつ大規模サービスをリニューアルする / cookpad-tech-kitchen-service-embedded-sres
rrreeeyyy
11
13k
Cookpad and Prometheus
rrreeeyyy
6
21k
Other Decks in Technology
See All in Technology
R&D 祭 2024 UE5で絵コンテ・作画の制作支援ツールをつくる話
olmdrd
PRO
0
200
"うちにはまだ早い"は本当? ─ 小さく始めるPlatform Engineering入門
harukasakihara
7
650
Claude Code / Codex / Kiro に AWS 権限を 渡すとき、何を設計すべきか
k_adachi_01
6
1.9k
React Compiler導入から21ヶ月、いま始めるならこうやる
astatsuya
2
280
[続・営業向け 誰でも話せるOCI セールストーク] セールストーク総集編(2026年5月15日開催)
oracle4engineer
PRO
1
100
SpeechTranscriber + AIによる文字起こし機能
kazuki1220
0
120
Cortex(Code) を ML モデルの 精度改善サイクルに組み込む.pdf
oimo23
0
250
JTCでRedmine利用者2700人を実現した手法 第二部
nobuonakamura
0
150
最新技術を"今は選ばない"という技術選定
leveragestech
PRO
0
320
AI飲み会幹事エージェントを作っただけなのに
ykimi
0
240
Fラン学生が考える、AI時代のデザインに執着した突破口
husengs7
1
220
TSKaigi 2026 - enumよ、さようなら
teamlab
PRO
1
210
Featured
See All Featured
Marketing to machines
jonoalderson
1
5.3k
AI: The stuff that nobody shows you
jnunemaker
PRO
7
640
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
120
Crafting Experiences
bethany
1
150
Heart Work Chapter 1 - Part 1
lfama
PRO
7
36k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
370
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
520
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
199
73k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.9k
Ruling the World: When Life Gets Gamed
codingconduct
0
230
The Cost Of JavaScript in 2023
addyosmani
55
9.9k
Transcript
Ruby tools for Infrastructure Engineer
RSpec
RSpec 4 RSpec is testing tool for the Ruby programming
language. 4 Ruby ͷςεςΟϯάϑϨʔϜϫʔΫɻ 4 Serverspec Infrataster ͷ࠷ۙͷ Infrastructure testing framework ͰΘΕ͍ͯΔɻ ࠷ۙ 3.0rc1 ͕ग़ͨɻ
Serverspec
Serverspec Infrastructure testing framework cat spec/target.example.jp/http_spec.rb require 'spec_helper' describe package('httpd')
do it { should be_installed } end 4 rspec 4 describe, it, its ... ͰςετΛॻ͍͍ͯ͘ 4 http://serverspec.org/resource_types.html
Serverspec Run test $ rake spec /usr/bin/ruby -S rspec spec/www.example.jp/httpd_spec.rb
...... : 4 rake?
Rake 4 Ruby Ϗϧυπʔϧ 4 Make ͱΑ͘ࣅͨػೳ͕͔ͭ͑Δ 4 "λεΫ" ͱ͍͏جຊ୯ҐͰԿ͔Λ࣮ߦ͢Δ
Rakefile require 'rake' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) do |t| t.pattern =
'spec/*/*_spec.rb' end task :default => :spec 4 spec ͱ͍͏໊લͷλεΫ͕ఆٛ͞Ε͍ͯΔ 4 λεΫҰཡ rake -T ͰݟΕΔ
spec_helper.rb 4 ςετͰ͏ڞ௨ͷઃఆΛॻ͘ 4 serverspec Ͱɺserverspec Ͱ͏ sudo password
ssh ઌ host ͷఆ͕ٛॻ͔Ε͍ͯΔ 4 host = File.basename(Pathname.new(file).dirname) 4 σϑΥϧτͩͱσΟϨΫτϦͷ໊લ͕ϗετ໊ʹͳΔ 8 -rw-r--r-- 1 staff 848 6 12 18:32 spec_helper.rb 0 drwxr-xr-x 3 staff 102 6 12 18:32 target.example.com ← ͜Ε
Tips
Tips Rake ӽ͠ʹ Rspec ͷҾΛ͢ rake spec SPEC_OPTS="--format documentation" ৗʹಉ͡Φϓγϣϯ͕͍͍ͨ
echo "--color" >> .rspec # ৭͕ͭ͘ 4 ੲ spec.opts ͩͬͨ
ग़ྗϑΥʔϚοτ 4 --format 4 documentation 4 progress 4 html
ςετͷϑΟϧλϦϯά 4 ৭ʑͳঢ়ଶʹΑ͍ͬͯͨ͠/ͨ͘͠ͳ͍ςετ͕͋Δ 4 --tag ΦϓγϣϯΛ͏ 4 --tag <tag_name> 4
<tag_name> ͷ͍͍ͭͯΔςετͷΈ࣮ߦ͢Δ 4 --tag ~<tag_name> 4 <tag_name> ͷ͍͍ͭͯΔςετΛআ֎͢Δ 4 ଞʹ৭ʑग़དྷΔ
Usage rake spec SPEC_OPTS="--format documentation --tag ~web" 4 ͜Μͳײ͡Ͱ͏ ࣮ࡍʹҊ݅Ͱ͍ͬͯΔ༷ࢠΛ͝հ
Enjoy test! and reduce mistakes!