Practical Ruby for System Administration (Expert's Voice in Open Source)

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Ruby has set the world on fire, proving itself a serious challenger to Perl and Python in all spheres. In particular, more and more people are discovering that Rubys flexibility, superb feature set, and gentle learning curve make it a natural choice for system administration tasks, from the humblest server to the largest enterprise deployment. Within the pages of Practical Ruby for System Administration, youll learn the Ruby way to construct files, tap into clouds of data, build domain-specific languages, perform network traffic analysis, and more. Based on author Andr Ben Hamous own experiences working as a system administrator, this book will help you pick up practical tips on Ruby coding style, learn how to analyze and improve script performance, and make use of no-nonsense advice on scripting workflow, including testing and documentation. Above all, youll come to appreciate the sheer power of Ruby and the hundreds of benefits it offers for system administration. This book places equal emphasis on fundamental Ruby concepts as well as practical how-tos. It uses examples from other languages to ease the transition to Ruby. The book is concise, entertaining, and informativeunlike many books aimed at system administrators, which can be overly long and stodgy.

Author(s): Andre Ben Hamou
Edition: 1
Year: 2007

Language: English
Pages: 247

Contents......Page 6
About the Author......Page 11
About the Technical Reviewer......Page 12
Acknowledgments......Page 13
Introduction......Page 14
Hello World......Page 17
Objects at Rest: The Theory of Object Orientation......Page 19
Objects in Motion: The Ruby View of OO......Page 21
By Invitation Only: Accessors Made Easy......Page 24
Blocks and the Magic of yield......Page 25
It Takes All Sorts: A Sensible Approach to Types......Page 28
Ointment for the Administrator......Page 30
Grepping with Ruby......Page 31
Working with Comments......Page 32
Playing with Fields......Page 33
Creating a Customized Directory Listing......Page 34
Rolling Logs: A Scheduled One-liner......Page 35
A Ruby Springboard......Page 36
Quick to Write Meets Quick to Run......Page 37
Scripts Can Be Faster......Page 38
The Numbers Game......Page 39
A Script vs. Standard Binaries......Page 40
The Benchmark Library......Page 42
The Profiler Library......Page 45
Algorithmic Optimization......Page 47
Linguistic Optimization......Page 48
Side Effect Reduction......Page 51
Dropping the C Bomb......Page 54
Ramming Speed......Page 56
CHAPTER 4: The Power of Metaprogramming......Page 57
Default Values......Page 58
Parameter Hashes......Page 60
Missing Method Dynamic Dispatch......Page 61
Module Inclusion......Page 62
Object Extension......Page 64
Domain-Specific Languages (DSLs)......Page 66
Plug-in API: Macros for Adding Macros......Page 68
Heavy Meta......Page 69
Safety First......Page 70
File Locking......Page 72
Safe File Operations......Page 76
Mob the Builder: Program-Driven File Creation......Page 79
ThundERbolts and Lightning: Template-Driven File Creation......Page 83
When Flat Files Fall Flat......Page 84
Local Disk Storage......Page 86
Inspection Time......Page 87
Marshaling Your Thoughts......Page 89
YAML Ain't Markup Language......Page 91
Benchmarking the Alternatives......Page 93
General Design Principals......Page 94
memcached: A Great Big Hash in the Sky......Page 96
Databases......Page 100
Object-Relational Mapping with ActiveRecord......Page 102
Playing with the Big Boys......Page 110
Parsing Data......Page 111
Separation Is Such Sweet Sorrow: Delimited Values......Page 112
XML......Page 116
Lightweight Directory Access Protocol......Page 128
XML Remote Procedure Call......Page 134
Simple Object Access Protocol......Page 137
Representational State Transfer......Page 140
Back to Basics......Page 144
Socket to Me......Page 145
Clockwatching: Timing Out on Purpose......Page 147
Socket-Based Monitoring......Page 150
An Embarrassment of Protocols......Page 151
Building a Web Robot......Page 152
Throwing Together a Server......Page 156
Taking Command with SSH......Page 160
Packet Monitoring......Page 162
End of Line......Page 165
Simple Network Management Protocol......Page 166
Secure Shell......Page 171
Marshalling the Data......Page 174
Parsing Events......Page 175
Filtering and Assigning Events......Page 176
Putting It All Together......Page 177
Aggregate Analysis......Page 178
Presenting Data......Page 179
Charts......Page 180
Graphs......Page 185
All That Glitters......Page 187
Managing and Using Gems......Page 188
Installing RubyGems......Page 189
The gem Command......Page 190
Using Gems in Your Code......Page 194
What Is a Gem, Anyway?......Page 196
Gathering the Files......Page 198
Writing the Gemspec......Page 199
Building the Gem......Page 201
A Mouthful of Jewels......Page 202
The Basic Task......Page 203
File Tasks......Page 204
Generalizing with Rules......Page 205
Synthesizing Tasks......Page 206
Testing......Page 208
Ruby's Test Library......Page 209
Performing Tests......Page 210
Fixtures......Page 211
Testing from Rake......Page 212
Automatic Documentation......Page 213
Basic Comments......Page 215
Lists......Page 217
Documenting from Rake......Page 218
Mission Accomplished......Page 219
YARV......Page 220
Language Changes......Page 221
I/O Operations......Page 222
Multisplatting......Page 223
Enumerable Upgrades......Page 224
begin......Page 225
APPENDIX: Ruby Execution......Page 227
A......Page 233
C......Page 234
D......Page 235
F......Page 236
G......Page 237
I......Page 238
M......Page 239
N......Page 240
O......Page 241
P......Page 242
R......Page 243
S......Page 244
U......Page 246
Z......Page 247