Summarized using AI

MVC Ruby in Less Than 5K. The Wonder of Camping

Karl Weber • November 15, 2024 • Chicago, IL • Talk

In this presentation titled "MVC Ruby in Less Than 5K: The Wonder of Camping," Karl Weber delves into the resurrection of Camping, a nearly 20-year-old Ruby micro web framework. He highlights how the simplicity and elegance of Ruby allow for the creation of a fully-featured MVC framework with very little code. Weber emphasizes the original creator, why the lucky stiff, who developed Camping with a unique and compact approach to web application development.

Key Points Discussed:

* Introduction to Camping:

- Camping is described as a model-view-controller (MVC) micro framework designed for web development.

- It embodies simplicity, allowing developers to write web applications in minimal code—approximately 5,181 bytes for the entire framework.

  • Ruby's Flexibility:

    • Ruby's object-oriented nature and expressive syntax enables powerful yet compact code.
    • Key features include writing an entire app in a single file, utilizing Rack for compatibility, and leveraging Ruby’s dynamic capabilities for file lookups and templating.
  • MVC Concept:

    • Weber explains the MVC architecture, highlighting how Camping separates data, interface, and application logic, facilitating cleaner code organization.
  • Core Features of Camping:

    • Attributes like routing, model definition, and plugin support are accessible with minimal code, including filters for common actions.
    • Examples show how Camping integrates models directly with the SQL gem, enhancing support for active record.
  • Plugins and Extensibility:

    • Camping supports extensions or plugins, called "Camping Gear," that can modify existing functionalities and introduce new features easily, echoing the design approach of Sinatra.
  • Community and Philosophical Insights:

    • Weber shares his motivations for enhancing Camping, focusing on creating an inclusive and resilient community around Ruby development. He reflects on the importance of diversity and the strength of community in programming.
  • Practical Applications:

    • The talk also demonstrates quick implementations, such as building a blog in three minutes, showcasing the framework’s usability for both beginners and seasoned developers.
  • Final Thoughts and Vision for the Future:

    • Weber emphasizes the value of simplicity and creativity in web development, urging the audience to embrace Ruby's unique capabilities in their projects.
    • He aims to continue improving Camping to ensure it remains accessible and functional for new developers while supporting an inclusive community.

Overall, the presentation argues for the effectiveness of using Ruby with Camping as an ideal solution for building micro web frameworks fitting within small projects and for learning web development basics.

MVC Ruby in Less Than 5K. The Wonder of Camping
Karl Weber • November 15, 2024 • Chicago, IL • Talk

Learn about the journey to resurrect an almost 20 year old ruby library, And all the amazing Ruby tricks it uses to be a fully featured MVC Web Framework.

Ruby's semantics allow remarkable flexibility, and robustness. Let's walk through how Camping uses Ruby's best & hidden features to make a fully featured MVC Micro Web Framework, in a ridiculously small amount of code.

Ruby's maturity promotes innovation and stability. Camping is almost 20 years old, and sat derelict unchanged for almost 8 years. To get it running with the latest versions of Ruby and its dependencies took only a couple of code changes.

Camping isn't just another small micro framework written by a mad genius. It's the BEST ONE. Its small size and compact architecture makes it ideal for beginners, side projects, and small apps.

# Key Takeaways.
* Ruby is OP (Over Powered) and makes everything possible.
* Framework Plugins in Ruby in a couple of lines of code.
* Full Featured web server in like 100 bytes.
* Put your whole app in one file.
* Dynamic file lookups for views in a single line of Ruby.
* Templating in 4 lines of Ruby? Yes!
* HTML, CSS, Javascript... In your RUBY!
* Rack conventions make ruby incredibly reliable, extensible, and extremely badass.
* And more

* Steps to ressurect Camping.
* It doesn't run.
* It Runs.
* What does it do? Times ten. (Lots of small examples of interesting Ruby code that does interesting things in Camping)
* Writing more tests.
* Ok so it's actually broken and I didn't know and now it's fixed again.
* Am I a Ruby Expert now?
* No.

# Session Highlights
Ruby is great
You can do so much with so little in Ruby
How to make a Blog in 3 minutes
Yes it's less than 5k
Stickers

Bonus I have physical boxed copies of Ruby Camping that you can win or buy.

RubyConf 2024

00:00:15.599 I'm very nervous today um uh and I
00:00:18.640 didn't put in my talk for some reason
00:00:20.840 but uh a few months ago I was at one of
00:00:23.560 these conferences with a friend of mine
00:00:24.880 and we were joking that I would bring
00:00:26.920 boxed copies of camping to sell at ruon
00:00:30.800 and I
00:00:33.200 did so you can support camping by buying
00:00:37.360 it even though you can get it for free
00:00:40.840 we've got uh an SD card with a custom
00:00:44.280 sticker and a coloring book and crayons
00:00:49.920 so well hello how is
00:00:54.239 everybody my name is Carl Oscar Weber
00:00:57.000 the
00:00:58.480 first uh but you can call me
00:01:01.920 cow um I'm here to talk about camping it
00:01:05.360 is the best MVC style microw web
00:01:08.000 framework written in
00:01:09.920 Ruby
00:01:11.600 officially yes it's
00:01:14.200 true it is the
00:01:17.159 bestest um but first all I want to tell
00:01:19.960 you a little bit about me um this is
00:01:24.200 me um I am a dad I love the graffiti
00:01:30.759 I love art design and programming
00:01:33.320 graphic design is my
00:01:34.799 passion uh I love my bike I write it
00:01:38.200 every day you know when I'm I'm not like
00:01:41.000 hurting in the back or
00:01:42.439 something I also run a small design and
00:01:44.960 development Studio named capsule which
00:01:46.920 is mildly
00:01:49.759 successful and I have been programming
00:01:52.079 for about 13 years uh doing a lot of
00:01:55.000 different things front end back end iOS
00:01:58.520 stuff I've worked worked with a lot of
00:02:00.759 different languages which has given me
00:02:03.399 kind of a unique
00:02:04.799 perspective um definitely if you want to
00:02:07.560 be successful Focus that's one
00:02:11.400 thing but that has also provided a
00:02:15.000 perspective on a lot of different ways
00:02:18.440 of
00:02:19.560 organizing building and interpreting
00:02:22.319 your
00:02:23.800 programs I've also been working on a
00:02:25.720 programming language named Kona which is
00:02:28.360 meant to be replacement for JavaScript
00:02:30.640 very small projects very small and I
00:02:33.840 won't talk about it
00:02:35.280 today
00:02:37.519 but I love Ruby the
00:02:41.560 most so anyways what is
00:02:47.200 camping camping is
00:02:56.120 intense some of you all have heard this
00:02:58.159 joke before I I won't stop saying
00:03:02.360 it it is a model view controller based
00:03:06.040 micro
00:03:07.120 framework which uh is very
00:03:10.760 small it's written by the illustrious
00:03:13.480 and mysterious why the lucky stiff is
00:03:15.599 anyone here familiar with
00:03:18.319 why yes we all we all live in the shadow
00:03:21.200 of the greatness of
00:03:22.879 why he wrote some great stuff uh lots
00:03:26.879 and lots of very I think formative and
00:03:31.280 important open source projects that
00:03:33.480 really shaped the early days of Ruby and
00:03:36.159 the culture and Community around it I
00:03:38.439 never met him personally I had to learn
00:03:41.439 about him
00:03:42.959 through uh archived websites and hidden
00:03:46.879 jpegs and uh PDFs that are you know lost
00:03:51.239 to time but he's
00:03:54.879 fantastic and he made us all thirsty for
00:03:57.360 some chunky bacon
00:04:01.200 it is written in legend that why wrote
00:04:03.400 the first version of camping with one
00:04:05.879 hand while staying up late typing with
00:04:08.840 his right hand and playing a laser thein
00:04:10.840 with his left the music and code was
00:04:15.359 elegent he vanished from the internet
00:04:17.759 and the world leaving behind nothing but
00:04:19.440 mystery and
00:04:21.800 suspense and wise projects were adopted
00:04:25.720 many of his projects were adopted by
00:04:27.120 people in the community there was a a
00:04:30.199 great Outreach and and effort to make
00:04:33.000 sure everything he left behind was
00:04:36.199 maintained over time many of these fell
00:04:38.639 into disrepair some of them were
00:04:42.039 continued camping was one of those
00:04:44.680 projects it received a little bit of
00:04:48.080 interest and and work over time and uh
00:04:52.759 improvements and now I can say that
00:04:55.160 camping has 33 contributors in counting
00:04:58.280 which is fantastic
00:05:00.479 uh yesterday we added a new contributor
00:05:02.600 Mike Dalton I don't know if you're here
00:05:05.039 Mike he's
00:05:09.680 not but he he's the latest contributor
00:05:12.639 so he's he's here in my
00:05:16.840 heart the last major changes to Camping
00:05:19.880 before I you know discovered it and
00:05:21.680 tried to bring it back uh was in 2014
00:05:24.160 over 10 years
00:05:27.680 ago and uh it there until I had the
00:05:32.600 nurge and desire to look for something a
00:05:34.680 little bit
00:05:35.520 new something small and
00:05:38.720 simple uh all-in-one
00:05:41.479 file I wanted to make
00:05:43.800 something I wanted I wanted something to
00:05:46.440 to use to make my websites that was the
00:05:48.360 simpler you know easier to to parse and
00:05:51.600 to understand I had a lot of difficulty
00:05:53.520 well not a lot of difficulty but it
00:05:56.280 grats on you to have to jump between too
00:05:58.039 many files sometimes when you just want
00:05:59.440 to like throw something small out there
00:06:01.680 so I wanted something that I could
00:06:03.080 clearly review quickly and and
00:06:07.919 accurately so I found
00:06:10.280 camping I didn't find much until I found
00:06:13.520 it so let's talk about MVC really quick
00:06:17.039 camping is an MVC framework but what
00:06:19.840 does that
00:06:20.960 mean we know
00:06:22.880 that well I'm hope that we're all kind
00:06:25.800 of familiar with the differences between
00:06:27.800 data interface and logic and that's more
00:06:29.960 or less what MVC does it SE separates a
00:06:33.720 an application into distinct Parts but
00:06:36.800 when we talk about MVC Frameworks it's
00:06:38.800 not really the original
00:06:40.840 MVC that we talk about please see
00:06:44.639 Collins excellent blog post about
00:06:47.400 this colin. donald.com
00:06:50.479 MVC is an MVC it's more like in our
00:06:54.319 context website
00:06:56.400 orchestration what we're really doing is
00:06:58.199 sending HTML and CSS and other files to
00:07:01.440 the browser but
00:07:05.919 fancy and we call this model view
00:07:10.000 controller our models handle our data
00:07:13.240 our views present a user interface and
00:07:16.199 our controllers orchestrate the effects
00:07:18.680 of our
00:07:20.199 actions
00:07:22.840 so this is
00:07:25.800 camping it is a bit silly which mirrors
00:07:29.879 the sentiments of its greater why it's
00:07:32.960 mostly a single
00:07:35.639 file this file is a minified sort of
00:07:38.919 Ruby that we put into a little file
00:07:41.000 called camping. RB and it there's no
00:07:44.159 script to Minify this it's all done by
00:07:47.319 hand as uh as Mike can attest it's a
00:07:50.280 little bit
00:07:52.120 silly it's about uh 5,181 bytes although
00:07:57.360 Mike yesterday was able to shave off 20
00:07:59.280 of those bites was very important
00:08:02.360 engineering
00:08:03.680 work it's incredibly compact code that
00:08:07.199 gives you a full
00:08:09.120 framework and runs on
00:08:13.520 Madness to get camping running you
00:08:16.560 should go camping so you give camping a
00:08:21.840 a name space like blog and camping goes
00:08:26.199 blog this campy this copies camping
00:08:29.000 source code renaming its name space to
00:08:32.320 your app app's name then evals it in
00:08:36.120 line which is
00:08:38.560 awesome this is the best
00:08:41.880 way
00:08:44.480 officially so what does camping look
00:08:50.080 like this is a camping app and I I I
00:08:53.120 hope you can read this in like 20
00:08:55.120 seconds as you can see it's all one file
00:08:58.160 which is fantastic and funny you have
00:08:59.560 models views controllers you even have
00:09:01.959 CSS in
00:09:04.160 here capping apps are usually small and
00:09:07.279 create a locality that makes finding all
00:09:09.600 the bits and Bobs of your application
00:09:11.160 easy it's all right
00:09:13.959 there camping's view components are
00:09:16.440 built around a small language called
00:09:18.440 marab or
00:09:21.480 mab mab lets you write your tags and
00:09:24.120 your markup like it's Ruby which is
00:09:27.440 fantastic a modern version of would be
00:09:30.959 Flex which is uh made by jel rapper and
00:09:34.839 it's fantastic we hope to add Flex to
00:09:38.000 Camping
00:09:39.200 soon or you can use Erb which is
00:09:45.200 familiar camping also lets you use
00:09:47.040 regular Erb HTML or other templates
00:09:49.399 through a an interface called tilt tilt
00:09:53.279 is of like a light wrapper around
00:09:56.320 basically every templ language Ruby has
00:10:00.000 and in order to add your Erb to Camping
00:10:02.560 you just add the
00:10:04.720 file camping will automatically par it
00:10:07.480 and add it to the list of files that are
00:10:11.240 used camping also lets you add inline
00:10:14.200 files who here is familiar with the uh
00:10:16.920 underscore uncore
00:10:19.360 andore so a few of you when I saw this I
00:10:22.360 thought it was
00:10:24.399 crazy Ruby has this facility that lets
00:10:26.880 you add data to the end of files once
00:10:29.920 it's parsed everything after end becomes
00:10:32.760 data and you reference it with data
00:10:35.360 camping doesn't do that camping will
00:10:38.160 read the file until end then read
00:10:40.440 everything after that it will split it
00:10:42.639 based on the file names preceded by
00:10:45.279 double at symbol and then serve those as
00:10:48.639 rack
00:10:51.040 files these files are cached by camping
00:10:53.639 as they're accessed just like normal
00:10:55.880 views or
00:10:58.240 files so what about uh
00:11:01.000 routes well in camping the controllers
00:11:03.639 are the
00:11:05.000 routes camping's controller class
00:11:07.360 introduces a method named r that accepts
00:11:10.120 a route or series of routes then
00:11:12.639 generates a controller class that
00:11:13.920 responds to those routes which is very
00:11:18.880 cool camping also lets you use a camel
00:11:21.760 case syntax to name your route classes
00:11:25.160 or your controllers and then it kind of
00:11:27.519 guesses what your route should be
00:11:30.160 in this case welcome to my
00:11:32.560 site will let you see that page by going
00:11:35.600 to welcome SL2
00:11:39.600 mysite it's also clever where if you add
00:11:42.880 like like a capital N or capital x it
00:11:45.279 will add those as parameter pieces in
00:11:48.760 your
00:11:53.240 route when you reach a camping route it
00:11:56.560 references or responds to your action
00:12:00.200 through methods now usually uh in other
00:12:03.120 Frameworks those methods would be the
00:12:05.480 actual routes or you would have some
00:12:06.639 sort of routing table but in camping
00:12:08.760 it's the actual HTT meth HTTP methods
00:12:11.839 they're referenced so HTTP get is sent
00:12:15.480 to get HTTP post is sent to your post
00:12:19.360 method and uh
00:12:23.000 Etc camping also has a small facility
00:12:25.839 called
00:12:26.760 filters it lets you have before and
00:12:28.920 after filters for common actions and uh
00:12:32.680 controllers in your camping app it's
00:12:36.680 incredibly incredibly small camping gear
00:12:39.920 that was written by a few uh camping
00:12:41.760 contributors early
00:12:45.959 on camping setup of its components
00:12:48.839 mirrors Ruby's
00:12:50.399 own name spacing
00:12:53.360 practices so things kind of appear and
00:12:56.560 and are placed where you expect them to
00:12:58.480 be
00:13:00.480 sometimes folks want to have you know
00:13:02.600 more lightweight type of uh uh routes
00:13:06.519 similar to Sinatra so we created a
00:13:08.880 camping gear called
00:13:10.560 Nancy uh to achieve this if anyone hears
00:13:14.800 in on the joke Nancy Sinatra is Frank
00:13:17.760 Sinatra's
00:13:21.120 daughter so what about
00:13:24.199 models camping also has
00:13:26.839 models camping wraps the omm build built
00:13:29.480 into the SQL gem it's used to have
00:13:32.279 direct support for active record but I
00:13:34.760 uh I thought that uh we could do a
00:13:38.000 little bit better um active record in
00:13:41.160 the way that it was implemented whenever
00:13:43.199 you booted camping it would
00:13:44.680 automatically run every
00:13:46.720 migration and
00:13:48.959 uh I thought it would be a little better
00:13:51.040 have something a little bit more robust
00:13:53.199 less
00:13:55.120 automatic and this is what it looks like
00:13:58.240 I ripped out the default code to replace
00:13:59.959 it with something some other camping
00:14:02.000 gear named Van which is a camping
00:14:06.759 van this is what it looks like it's not
00:14:09.279 ready yet it's
00:14:11.600 close um but for reals it's some camping
00:14:14.120 gear that adds command line helpers to
00:14:16.040 make migrations execute migrations
00:14:19.120 connect various types of databas Etc all
00:14:21.199 through the SQL
00:14:24.759 gy it's not ready yet but these are the
00:14:27.040 planned features
00:14:29.880 and uh the sequel gem is fantastic and
00:14:32.880 primarily the work of Jeremy Evans who's
00:14:36.480 here he also works on the fastest Ruby
00:14:38.920 web framework which is Roa and is
00:14:40.600 speaking next and I recommend everyone
00:14:42.720 stay to listen to
00:14:45.680 him
00:14:47.800 so the models are just it's just a
00:14:50.480 namespace you can put anything there
00:14:52.720 it's an empty vessel for adding your own
00:14:57.240 logic because it's just a name space you
00:14:59.320 can add whatever you want but what about
00:15:01.880 plugins let's say you wanted to do more
00:15:04.800 camping also has support for plugins the
00:15:06.720 modify the methods the campings has we
00:15:09.680 call this camping
00:15:12.440 gear to add camping gear to your app you
00:15:16.240 pack
00:15:18.320 it it's as easy as adding a rack app to
00:15:21.480 your
00:15:23.480 app this is the simple implementation of
00:15:25.800 it it's just include with a little bit
00:15:28.440 of Plumbing shaped around it we also
00:15:31.160 assume that your camping gear has a
00:15:32.279 setup method that passes additional
00:15:34.079 parameters and any block pass to the
00:15:36.319 pack
00:15:37.839 method in your camping gear there is a
00:15:42.120 you could optionally add a ruby method
00:15:44.639 called included which is a hook this
00:15:47.000 allows you to extend camping with uh
00:15:49.880 class
00:15:50.920 methods or any other part of camping
00:15:53.600 that internally can be
00:15:56.680 overridden this is based off of Cuba's
00:16:00.040 way Cuba is another web framework way of
00:16:02.440 adding plugins which fun fact Roda is
00:16:06.040 based off of
00:16:08.160 Cuba these are all Camp's features you
00:16:11.480 you got to read it in like five
00:16:13.360 seconds it offers everything you would
00:16:15.279 expect from an NBC framework along with
00:16:17.480 some extras like settings and data
00:16:19.519 coming from KDL and Cascade
00:16:22.480 reopening Cascade reopening is this idea
00:16:25.199 where you can redefine controllers
00:16:27.040 deeper on in your app hierarchy by
00:16:30.440 placing in the apps directory eventually
00:16:32.759 you'll be able to include a gem with
00:16:34.680 your a camping app directly and that
00:16:38.399 will you'll be able to overwrite those
00:16:40.759 parts in your own app and make it you
00:16:44.000 nice and nice and
00:16:45.920 clean okay so how does camping
00:16:50.199 work with
00:16:52.240 Madness and
00:16:54.480 cheating so camping core is one minified
00:16:57.040 file but to be Smarsh we keep another
00:17:01.079 file around camping on a bridge it's
00:17:03.240 like I don't know like 10 times bigger
00:17:05.199 it's pretty big has a lot of comments
00:17:07.520 and it gives context to all the code in
00:17:10.039 camping so camping and camping under
00:17:12.839 bridged have to be in sync synchronized
00:17:15.640 at all time uh camping is only 5,000
00:17:19.760 bytes but it's uh it's a lot of
00:17:22.679 magic but but anyways let's dive into
00:17:25.039 how camping Works which is fantastic to
00:17:28.199 start camping reopens object to define a
00:17:31.120 new method metad a shortcut to add class
00:17:34.440 methods which is used in camping a few
00:17:36.640 times this saves a few bites over
00:17:39.720 time fun fact putting a backslash that
00:17:42.200 doesn't escape anything into a string
00:17:43.799 causes it to be
00:17:46.520 ignored when we start camping we start
00:17:48.919 by cheating a little to keep our
00:17:50.200 character countdown and to find some
00:17:52.480 constants C refers to Camping itself s
00:17:56.559 refers to this file it's it's read and
00:17:59.280 stored here for use
00:18:02.000 Slater we then redefine hash with some
00:18:05.520 more shortcuts as H which saves a lot of
00:18:11.280 bites we immediately use this in our
00:18:13.960 cookies
00:18:16.080 class to keep character count down we
00:18:18.240 assign reused variables while they are
00:18:20.280 being passed to methods like here in the
00:18:21.919 set method J the attribute key is being
00:18:24.400 set then reuse on the next line to set
00:18:26.720 the key the next method def find
00:18:29.000 shortcut and some area checking for set
00:18:31.679 we then Alias this on above to save
00:18:34.480 character count
00:18:36.840 later camping has helpers they are in
00:18:39.760 the helpers
00:18:40.840 class predictably it's pretty slick the
00:18:44.559 first helper is the r method it lets you
00:18:47.280 build a URL from a controller constant
00:18:49.559 and some
00:18:50.919 parameters here y assigns two variables
00:18:53.679 on the same line saving characters and
00:18:56.400 using the Fantastic grep method to find
00:18:58.480 the hashes from the GS
00:19:00.679 Splat on the next line we subtract H
00:19:03.400 from g h is any hash we found and G is
00:19:07.400 everything else all in four characters
00:19:10.760 Ruby is great on the next line we start
00:19:13.760 wrapping some route making operations
00:19:15.799 first by hunting for a matching route in
00:19:17.559 this controller it's in the find block
00:19:19.799 that we do our work find is aply named
00:19:22.960 as we want to find a route we have two
00:19:24.960 checks first to match the size of a
00:19:26.799 route to what we're searching for
00:19:29.520 next we match this regular expression
00:19:32.240 the carrot is the beginning of the line
00:19:34.600 and is the end of the line the uh pound
00:19:38.559 curly brace X inserts the route we're
00:19:40.480 looking for and the uh the back slash
00:19:44.280 forward slash question mark is a bit of
00:19:46.080 error prevention to match a trailing
00:19:47.679 slash or
00:19:49.120 not to re then we reassign X and it's
00:19:52.799 evaluated in this
00:19:54.880 grouping which scans X our URL path with
00:19:58.799 an escaped version of a parameter passed
00:20:01.240 to
00:20:02.039 G notice the use of uh Capital u. Escape
00:20:06.000 that's from rack earlier we copied rack
00:20:09.960 utils into U to save some
00:20:13.840 characters inject provides a variable at
00:20:16.200 each iteration or a block in our case X
00:20:19.559 letting us modify it as we go
00:20:22.080 along in this case we're replacing x
00:20:24.440 with the parameters we supplied to the r
00:20:27.200 method escaping them and then unescaping
00:20:30.039 them at the end we wrap our logic with a
00:20:32.559 Turner any question mark ensures that
00:20:36.320 anything truthy is there if so then we
00:20:38.720 add an HTML query parameter to the end
00:20:40.400 of our route otherwise we just return
00:20:42.400 the route we
00:20:43.960 made if we look back a few lines U was
00:20:46.640 assigned from refine block and then
00:20:48.080 immediately used in the if statement to
00:20:50.000 possibly break I love trailing
00:20:52.919 ifs there you now made a route in a
00:20:55.400 controller using the r method with aor
00:20:58.080 tracking and query strings supplied by
00:20:59.440 an optional hash you want to see the URL
00:21:02.080 method it doesn't have any
00:21:04.480 parents first we use R it does a lot of
00:21:07.120 work for us in this case then we reuse
00:21:10.000 the very descriptive slash
00:21:14.880 method which somehow works here online
00:21:17.400 251 uh but I do not know
00:21:20.799 why okay but just look at it
00:21:24.400 just finally we return a UI object built
00:21:26.919 from our path C
00:21:29.520 how do we make a camping how do we make
00:21:31.440 a camping app it goes camping and this
00:21:35.279 is camping goes it accepts a constant
00:21:38.120 name the name of your app we do some
00:21:41.080 bookkeeping to keep track of where this
00:21:42.480 app is going from and then we replace
00:21:45.039 the name camping in the contents of this
00:21:46.760 file camping. RB as sword in the S
00:21:49.400 variable and evalid in the context of G
00:21:52.120 which is the top level binding by
00:21:53.520 default on the same line we add this to
00:21:55.520 our apps array and have it in a variable
00:21:57.120 named a
00:21:59.039 next we read the file we win camping in
00:22:01.039 and look for views and pseudo files
00:22:02.960 found after theore uncore end like you
00:22:06.120 do um colore T is the key for views and
00:22:09.039 files and camping app we set this to
00:22:10.640 whatever we get in the above
00:22:12.000 line and next we do some parental setup
00:22:15.360 this is used by camping internally and
00:22:17.080 is important we call the configure
00:22:19.480 method provided by the default camping
00:22:20.760 gear this sets settings
00:22:24.400 sequentially and uh we have a special
00:22:27.080 configure method that isn't actually in
00:22:29.559 camping it's provided by camping gear
00:22:31.640 named cuddley which adds KDL setting
00:22:34.279 support to camping next we're going to
00:22:36.360 briefly look at the camping
00:22:38.080 server camping server inherits from rack
00:22:40.279 up server which means we're cheating
00:22:41.919 some more work that was done like 14
00:22:44.279 years ago mostly and continued into
00:22:46.559 today and I swear the Upstream
00:22:48.600 dependency has barely changed in 14
00:22:50.000 years but only got better mle minimal
00:22:52.799 changes were required to get it running
00:22:53.960 with the latest version because Ruby and
00:22:56.200 its libraries are incredibly stable
00:22:58.120 which is
00:22:59.480 awesome camping service has a middleware
00:23:01.720 and then and the reloader which one zit
00:23:03.960 work zit
00:23:05.520 work the loader can't just straight up
00:23:07.520 use Zork without managing some of what's
00:23:09.960 loaded because of some of the other
00:23:11.480 features that we have it loads kindling
00:23:14.720 which are like
00:23:16.120 initializers then triggers the reloader
00:23:18.000 and saves it to a little helper variable
00:23:20.159 there's more going on in camping server
00:23:22.000 that is kind of normal and regular it
00:23:24.159 inherits from recup server so it's
00:23:25.400 pretty standard stuff and saves me a lot
00:23:27.360 of time
00:23:29.320 uh the core of the dispatcher is the
00:23:31.760 call method it does more than this but
00:23:34.080 essentially we check each camping app
00:23:36.000 loaded for a path that matches the
00:23:37.279 requested path and just call it very
00:23:40.480 simple and all this is possible because
00:23:43.760 Ruby is
00:23:45.000 op it enables a greater class of
00:23:47.480 productivity and flexibility without it
00:23:50.240 camping could not be possible or be so
00:23:52.600 compact while still being
00:23:54.919 legible parents at the end of methods
00:23:57.000 calls are optional this makes private
00:23:59.080 method calls feel like built-in language
00:24:00.919 constructs creating a rich API with
00:24:02.960 these methods means hiding
00:24:06.360 complexity rubies include extend and
00:24:08.840 block passing syntax make extensions a
00:24:11.120 first class feature that makes
00:24:13.159 Frameworks easy to build and Powerful
00:24:15.080 through
00:24:16.400 introspection Ruby's power for making
00:24:18.360 Frameworks extends Beyond language
00:24:20.200 semantics but through Community adopted
00:24:22.600 interface contracts like
00:24:25.360 rack that's what I'm talking about and
00:24:28.520 the wonderful people that maintain in
00:24:29.640 Shephard rack including Jeremy whose
00:24:32.080 talks next which you all stay
00:24:34.559 for rack was adopted early in Ruby's
00:24:37.360 rise making a even very old Ruby that
00:24:40.159 adopted the Paradigm compatible with
00:24:41.760 Ruby code today like camping rack
00:24:45.200 interface contract Simplicity Echoes
00:24:47.200 unix's text interface Simplicity and
00:24:50.559 rack API compatibility kicks
00:24:53.080 ass Ruby's built-in library of
00:24:55.200 expressive methods to iterate and
00:24:56.480 enumerate over lists and dictionaries
00:24:59.000 make everything so so nice Global RX
00:25:02.279 helpers are great too and can make for
00:25:04.760 Compact and tight code not that it is a
00:25:08.039 goal but uh it's it's not a goal in
00:25:10.840 camping except in camping to RB because
00:25:13.720 it's
00:25:14.760 funny and
00:25:16.880 more why resurrect
00:25:23.640 camping the answer is resilience against
00:25:26.559 disease Community disease
00:25:30.039 I decided to work on camping in response
00:25:32.000 to my disgust with the actions and
00:25:33.880 political and social views of some very
00:25:36.440 few well-known Ruby Peoples like
00:25:39.279 explicitly that's the
00:25:41.200 reason supporting diversity equity and
00:25:43.720 inclusion is
00:25:46.080 important like explicitly camping
00:25:48.600 supports
00:25:50.159 that every action is political and
00:25:54.440 consequential whether you decide it is
00:25:56.440 or not
00:25:58.640 politics is what happens when people
00:26:00.520 come together and decide how to use
00:26:02.640 their Collective
00:26:06.840 power saying there's no politics here is
00:26:09.360 a political act to explicitly support
00:26:12.279 Whoever has the advantage or privilege
00:26:14.640 in a society or
00:26:17.520 group life is going to get real tough
00:26:19.880 for people soon I don't know if you all
00:26:22.159 have heard but exclusive and hateful
00:26:24.360 rhetoric is on the rise accepting any of
00:26:27.200 that in our communities will allow it to
00:26:30.200 spread every so-called non-standard
00:26:32.880 weird person will be erased from our
00:26:34.720 society if we don't choose to stand up
00:26:36.880 for them our neighbors our friends our
00:26:41.679 spouses in every venue for and Community
00:26:44.399 we find ourselves in if we can't dictate
00:26:47.080 the basic standards of a community to be
00:26:49.279 inclusive then we need to build
00:26:51.279 alternative communities and build
00:26:53.520 alternative power to include and protect
00:26:55.799 the most vulnerable
00:26:59.000 anyways
00:27:00.360 so why work on
00:27:03.480 camping why work on the framework
00:27:06.399 because I love Ruby and the perception
00:27:08.919 that the Ruby Community is not welcome
00:27:10.880 or misogynistic or prejudiced hurts the
00:27:13.480 long-term growth and viability of
00:27:16.320 Ruby perceptions shape reality if people
00:27:20.279 think things are one way even if it's
00:27:23.000 mostly not like that they'll still think
00:27:25.360 it if we're almost all super nice
00:27:28.799 but they think we're jerks that's
00:27:31.000 bad but we're not everyone here is super
00:27:34.520 nice Matt's is nice and so we are nice
00:27:38.440 it's a great
00:27:42.360 motto but there are some
00:27:44.640 complaints and complaints are good this
00:27:46.799 is very
00:27:48.000 important like if you don't like
00:27:49.760 something
00:27:50.679 complain complaints are good because it
00:27:53.000 means you hope with your voice someone
00:27:55.519 will hear your complaint and improve
00:27:57.760 things
00:27:59.200 but
00:28:00.120 also complain and do something make
00:28:04.720 things
00:28:05.760 better build the world you want to live
00:28:09.880 in I decided to build to make something
00:28:13.480 better we should make things
00:28:15.919 better this is I think that what we
00:28:18.039 should do and I want to do
00:28:22.640 that I'm very reg grateful that why
00:28:26.200 Magnus and many others May made
00:28:28.279 something fun and beautiful and useful
00:28:29.679 that I can work
00:28:31.000 on camping is
00:28:33.679 silly and we need more of
00:28:36.480 that thank you mattz I'm very grateful
00:28:39.080 that Matt Matt's Made
00:28:42.640 ruby because it makes me happy and pays
00:28:46.240 my
00:28:47.720 rent thank you
Explore all talks recorded at RubyConf 2024
+64