ironruby - a brave new world for .net (ndc2010)

31
IronRuby – A brave new world! @Ben_Hall [email protected] Blog.BenHall.me.uk CodeBetter.com/blogs/BenHall Meerkatalyst

Upload: ben-hall

Post on 15-May-2015

1.396 views

Category:

Technology


0 download

DESCRIPTION

Session given at NDC2010, Oslo, Norway on IronRuby.

TRANSCRIPT

Page 1: IronRuby - A brave new world for .Net (NDC2010)

IronRuby – A brave new world!

@[email protected]/blogs/BenHall

Meerkatalyst

Page 2: IronRuby - A brave new world for .Net (NDC2010)

London (UK) based C# MVPWeb Developer @ 7digital.com

Working on a number of Open Source Projects

Co-Author of Testing ASP.net Web Applicationshttp://www.testingaspnet.com

Page 3: IronRuby - A brave new world for .Net (NDC2010)

Today...

• Intro to Ruby \ IronRuby • Taking advantage with existing frameworks• 7digital, scripting, DSLs and the real world• Embedding IronRuby into C#

Page 4: IronRuby - A brave new world for .Net (NDC2010)

Tomorrow...

• Testing C# and ASP.net Applications using Ruby• Track 6 (Here)• 13:40

• Lunch-time Ruby meet-up

Page 5: IronRuby - A brave new world for .Net (NDC2010)

Why are we here?

http://www.flickr.com/photos/wwworks/2222523486/sizes/l/

Page 6: IronRuby - A brave new world for .Net (NDC2010)

Ruby implementation on top of .NET

Page 7: IronRuby - A brave new world for .Net (NDC2010)

The right language for the right job

Page 8: IronRuby - A brave new world for .Net (NDC2010)

Don’t think of this as a replacement

Page 9: IronRuby - A brave new world for .Net (NDC2010)

DEMORUBY RUBY RUBY => IRONRUBY

Page 10: IronRuby - A brave new world for .Net (NDC2010)

http://www.flickr.com/photos/vhanes/3053401272/

Page 11: IronRuby - A brave new world for .Net (NDC2010)

Community

http://www.flickr.com/photos/tjflex/233574885/

Page 12: IronRuby - A brave new world for .Net (NDC2010)

Invest Regularly in Your Knowledge Portfolio

Learn at least one new language every year

The Pragmatic ProgrammerAndrew Hunt \ David Thomas

Page 13: IronRuby - A brave new world for .Net (NDC2010)

Continuous Improvement

via @danrough

Page 14: IronRuby - A brave new world for .Net (NDC2010)

Programming Dinosaur

http://nickolai.tumblr.com/post/159823820/dilbert-cobol-programming-dinosaur

Page 15: IronRuby - A brave new world for .Net (NDC2010)

Real world example

Remote server setup and configuration

Page 16: IronRuby - A brave new world for .Net (NDC2010)

consts = “dns = 'ec2-127.0.0.1.amazon.com‘; file = ‘app.config’” command = “contents = System::IO::File.read_all_text(file); " + "contents = contents.replace(‘$(MACHINE_DNS)', dns); " + "System::IO::File.write_all_text(file, contents)"

ir.exe -e ”#{consts}” -e ”#{command}”

ir.exe installed onto every server via svn+teamcity

Page 17: IronRuby - A brave new world for .Net (NDC2010)

Ruby as a scripting language

Page 18: IronRuby - A brave new world for .Net (NDC2010)

require 'win32ole'excel = WIN32OLE.new("excel.application")excel['Visible'] = true

#Create a new sheetworkbook = excel.Workbooks.Addexcel.Range("a1")['Value'] = 3excel.Range("a2")['Value'] = 2excel.Range("a3")['Value'] = 1excel.Range("a1:a3").Select

# Add a chartexcelchart = workbook.Charts.AddXL3D_COLUMN_CHART_TYPE = -4100excelchart['Type'] = XL3D_COLUMN_CHART_TYPE

Built-in to IronRuby & Excel

Page 19: IronRuby - A brave new world for .Net (NDC2010)

DEMOADVANCED RUBY\IRONRUBY

Page 20: IronRuby - A brave new world for .Net (NDC2010)

Internal DSLs (Domain Specific Language)

Page 21: IronRuby - A brave new world for .Net (NDC2010)

kill ‘ps aux | grep mongrel_rails | grep -v grep | cut -c 10-20’

Rush.processes.filter(:cmdline => /mongrel_rails/).kill

Created using Rush

Bash

Ruby

Page 22: IronRuby - A brave new world for .Net (NDC2010)

defaults do color true environment :test role :windows zone :'eu-west-1b' bucket 'rudy-ami-eu'end

machines do region :'us-east-1' do ami 'ami-de4daab7' # Amazon Windows Server 2003 (US) size 'm1.small' end region :'eu-west-1' do ami 'ami-8696bef2' # Rudy Windows 2009-08-24 (EU) endend

Created using Rudy

Page 23: IronRuby - A brave new world for .Net (NDC2010)

@hourly cd C:/temp/ && script/runner -e production "SomeModel.ladeeda" >> C:/temp/cron_log.log 2>&1

0 0,3,6,9,12,15,18,21 * * * cd C:/temp/ && script/runner -e production "MyModel.some_process" >> C:/temp/cron_log.log 2>&1

0 0,3,6,9,12,15,18,21 * * * cd C:/temp/ && RAILS_ENV=production /usr/bin/env rake my:rake:task >> C:/temp/cron_log.log 2>&1

0 0,3,6,9,12,15,18,21 * * * /usr/bin/my_great_command >> C:/temp/cron_log.log 2>&1

30 4 * * * cd C:/temp/ && script/runner -e production "MyModel.task_to_run_at_four_thirty_in_the_morning" >> C:/temp/cron_log.log 2>&1

0 12 * * 0 cd C:/temp/ && script/runner -e production "Task.do_something_great" >> C:/temp/cron_log.log 2>&1

Corn job\task

Page 24: IronRuby - A brave new world for .Net (NDC2010)

set :path, 'C:/temp/‘set :output, "C:/temp/cron_log.log"

every 3.hours do runner "MyModel.some_process" rake "my:rake:task" command "/usr/bin/my_great_command“end

every 1.day, :at => '4:30 am' do runner "MyModel.task_to_run_at_four_thirty_in_the_morning“end

every :hour do runner "SomeModel.ladeeda“end

every :sunday, :at => '12pm' do runner "Task.do_something_great“end

Created using Whenever

Page 25: IronRuby - A brave new world for .Net (NDC2010)

desc "Run a sample build using the MSBuildTask" msbuild do |msb| msb.properties :configuration => :Debug msb.targets :Clean, :Build msb.solution = "spec/support/TestSolution/TestSolution.sln" end

desc "NUnit Test Runner Example" nunit do |nunit| nunit.path_to_command = "NUnit/nunit-console.exe" nunit.assemblies "assemblies/TestSolution.Tests.dll" end

Created using Albacorehttp://albacorebuild.net/

Page 26: IronRuby - A brave new world for .Net (NDC2010)

desc "Create Website" create_site :create => :delete do |w| w.name = 'Meerpush_Website' w.home = 'C:\inetpub\wwwroot' end

desc "Start Website" start_site :start do |w| w.name = 'Meerpush_Website' end

Created using Meerpushhttp://www.github.com/benhall/meerpush

Page 27: IronRuby - A brave new world for .Net (NDC2010)

DEMOEMBEDDING IRONRUBY

Page 28: IronRuby - A brave new world for .Net (NDC2010)

Links• http://ironruby.codeplex.com/• http://twitter.com/#/list/casualjim/ironruby-

community• http://blog.benhall.me.uk

Page 29: IronRuby - A brave new world for .Net (NDC2010)

SUMMARY

http://www.bennylingbling.com/2009/04/17/i-see-what-you-did-there/

Page 30: IronRuby - A brave new world for .Net (NDC2010)

change

How will IronRuby

your world?

Page 31: IronRuby - A brave new world for .Net (NDC2010)

@[email protected]

http://lolcatgenerator.com/lolcat/120/