diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..9d42d6766 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,22 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/ruby +{ + "name": "Ruby", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/ruby:1-3.2-bullseye" + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "ruby --version", + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 000000000..58f45c44d --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,24 @@ +name: Deploy to Fly +on: + workflow_dispatch: + workflow_run: + workflows: [rspec] + types: [completed] + branches: + - 'main' +jobs: + deploy: + name: Deploy + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: + - uses: actions/checkout@v3 + - uses: superfly/flyctl-actions/setup-flyctl@1.4 + - run: flyctl deploy --remote-only + env: + FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} + cifail: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'failure' }} + steps: + - run: echo 'CI failed, not deploying.' diff --git a/Gemfile b/Gemfile index 32eb465d5..77d5a3df9 100644 --- a/Gemfile +++ b/Gemfile @@ -27,6 +27,6 @@ group :development do gem "rerun" gem "rake" gem "rack-test" - gem 'files', github: "alexch/files" + gem "files", github: "alexch/files" # https://github.com/alexch/files/commit/4938dd85ed79f421b808e8798764661a71cab5a4#diff-d6558d687a262513e91d710f9c3db7a0e04b4f93f9f94f16374a986d92b8139bL102 gem 'rb-fsevent', :platform => :ruby end diff --git a/Procfile b/Procfile deleted file mode 100644 index e06ad9dc8..000000000 --- a/Procfile +++ /dev/null @@ -1 +0,0 @@ -web: rackup -s thin -p $PORT diff --git a/README.md b/README.md index 6eeccd756..cfb1e6723 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# The RailsBridge Documentation Project +# The RailsBridge Boston Documentation Project -[![Build Status](https://travis-ci.org/railsbridge/docs.png)](https://travis-ci.org/railsbridge/docs) +[![Ruby](https://github.com/railsbridge-boston/new-docs/actions/workflows/ruby.yml/badge.svg)](https://github.com/railsbridge-boston/new-docs/actions/workflows/ruby.yml) ## Overview -This is a Sinatra app, deployed at . The RailsBridge documentation project is home to a few subprojects, including the RailsBridge installfest instructions, which leads students through the various complicated setup instructions for getting Ruby, Rails, Git, etc. installed on their computer (whatever combination of computer, OS, and version they happened to bring to the workshop!), as well as the RailsBridge workshop "Suggestotron" curriculum. +This is a Sinatra app, deployed at . The RailsBridge documentation project is home to a few subprojects, including the RailsBridge installfest instructions, which leads students through the various complicated setup instructions for getting Ruby, Rails, Git, etc. installed on their computer (whatever combination of computer, OS, and version they happened to bring to the workshop!), as well as the RailsBridge workshop "Suggestotron" curriculum. Each subproject (a "site") comprises files stored under the "sites" directory; for instance, the installfest instructions are located at ROOT/sites/en/installfest, while the intro rails curriculum can be found under ROOT/sites/en/intro-to-rails. (The "en" means "English" -- see "Locales" below.) @@ -56,13 +56,13 @@ Just make sure the server responds to a locale subdomain: `http://es.railsbridge ### Temporary Testing -Use a `locale` or `l` parameter: `http://docs.railsbridge.org/?l=es`. +Use a `locale` or `l` parameter: `http://docs.railsbridgeboston.org/?l=es`. Note that in this mode, links are not rewritten, so if they fail you will have to manually add the parameter again. ## Contributing -Check out [CONTRIBUTING.md](CONTRIBUTING.md) to see how to join our [list of contributors](https://github.com/railsbridge/docs/contributors)! +Check out [CONTRIBUTING.md](CONTRIBUTING.md) to see how to join our [list of contributors](https://github.com/railsbridge-boston/docs/contributors)! ## License @@ -73,5 +73,5 @@ The code is licensed under an [MIT license](http://opensource.org/licenses/MIT), ## Other Resources - [StepFile Reference](step_file_reference.md) -- Workshop organizers: See http://docs.railsbridge.org/workshop for example slide decks you can use in your opening/closing presentations. +- Workshop organizers: See http://docs.railsbridgeboston.org/workshop for example slide decks you can use in your opening/closing presentations. diff --git a/fly.toml b/fly.toml new file mode 100644 index 000000000..658111494 --- /dev/null +++ b/fly.toml @@ -0,0 +1,42 @@ +# fly.toml file generated for rbb-docs on 2022-09-11T14:07:43Z + +app = "rbb-docs" +kill_signal = "SIGINT" +kill_timeout = 5 +processes = [] + +[build] + builder = "heroku/buildpacks:20" + +[env] + PORT = "8080" + +[experimental] + allowed_public_ports = [] + auto_rollback = true + +[[services]] + http_checks = [] + internal_port = 8080 + processes = ["app"] + protocol = "tcp" + script_checks = [] + [services.concurrency] + hard_limit = 25 + soft_limit = 20 + type = "connections" + + [[services.ports]] + force_https = true + handlers = ["http"] + port = 80 + + [[services.ports]] + handlers = ["tls", "http"] + port = 443 + + [[services.tcp_checks]] + grace_period = "1s" + interval = "15s" + restart_limit = 0 + timeout = "2s" diff --git a/lib/doc_page.rb b/lib/doc_page.rb index 9f4d9e813..d1e982cc4 100644 --- a/lib/doc_page.rb +++ b/lib/doc_page.rb @@ -41,7 +41,7 @@ def file_name end def git_url - "https://github.com/railsbridge/docs/blob/master/sites/#{site.name}/#{file_name}" + "https://github.com/railsbridge-boston/docs/blob/master/sites/#{@locale}/#{site.name}/#{file_name}" end def src_url @@ -68,8 +68,11 @@ def body_content nav(class: "top cf", role: "navigation") { div(class: "navbar-header cf title") { + a(href: "/") { + span("RailsBridge Boston ", class: "brand") + } + span(" > ") a(href: "/#{site.name}") { - span("RailsBridge ", class: "brand") text site_title } } @@ -120,14 +123,14 @@ def body_content end p do text "If you have a suggestion for improving the docs, please make a " - a "pull request ", href: "https://github.com/railsbridge/docs" + a "pull request ", href: "https://github.com/railsbridge-boston/docs" text "or " - a "drop us a note ", href: "https://github.com/railsbridge/docs/issues/new" + a "drop us a note ", href: "https://github.com/railsbridge-boston/docs/issues/new" text "via GitHub Issues (no technical knowledge required)." end p do text "Source: " - url "https://github.com/railsbridge/docs" + url "https://github.com/railsbridge-boston/docs" end } end diff --git a/lib/flags.rb b/lib/flags.rb index 1e6372d31..c5f38c8b8 100644 --- a/lib/flags.rb +++ b/lib/flags.rb @@ -26,7 +26,7 @@ def content ul class: 'flags dropdown-menu' do @locales.each do |locale| li { - a(href:"http://#{subdomain_for_locale(locale)}.railsbridge.org") { + a(href:"http://#{subdomain_for_locale(locale)}.railsbridgeboston.org") { img src: image_for_locale(locale) } } diff --git a/sites/docs/docs.step b/sites/docs/docs.step index dba228e3a..19a046f75 100644 --- a/sites/docs/docs.step +++ b/sites/docs/docs.step @@ -1,5 +1,5 @@ message <our Discourse forum. (Volunteers to answer questions always needed, too!) MARKDOWN @@ -83,9 +83,9 @@ If you're not doing those two things, you can totally still use the site, we jus ### I want to help, but I don't know how. -First, [make a GitHub account](https://github.com). Then, [create an issue](https://github.com/railsbridge/docs/issues) with the idea you have. We'll help you turn it into reality (assuming it's in line with our lofty goals :D). +First, [make a GitHub account](https://github.com). Then, [create an issue](https://github.com/railsbridge-boston/docs/issues) with the idea you have. We'll help you turn it into reality (assuming it's in line with our lofty goals :D). -Don't know what you could work on? Browse the [issues list](https://github.com/railsbridge/docs/issues) and the [Volunteer Opportunities List](https://github.com/railsbridge/docs/wiki/RailsBridge-Volunteer-Opportunities). Those have lots of ideas. +Don't know what you could work on? Browse the [issues list](https://github.com/railsbridge-boston/docs/issues) and the [Volunteer Opportunities List](https://github.com/railsbridge/docs/wiki/RailsBridge-Volunteer-Opportunities). Those have lots of ideas. ### I have a different question about RailsBridge. diff --git a/sites/intro-to-rails/CRUD_with_scaffolding.step b/sites/intro-to-rails/CRUD_with_scaffolding.step index c4a0fbb6d..72eddf8e0 100644 --- a/sites/intro-to-rails/CRUD_with_scaffolding.step +++ b/sites/intro-to-rails/CRUD_with_scaffolding.step @@ -22,7 +22,7 @@ steps { } step { - message "Point your browser to [http://localhost:3000/topics](http://localhost:3000/topics)" + message "Point your browser to /topics" message "You should see the \"Topics\" page with headers for title and description, and a link to add a new topic:" img src: "img/Seattle_topic_list_page.png", alt: "Screenshot of topic list page" @@ -40,12 +40,12 @@ steps { step { message <<-MARKDOWN - * Click "Back" + * Click "Back to topics" * You should see the topic list again, this time with your new topic listed: ![Screenshot of topic list with new topic](img/Seattle_list_with_topic.png) - * Try the "Show", "Edit", and "Destroy" links to see what they do + * Click on one of the topics by clicking "Show this topic" and try the "Show", "Edit", and "Destroy" links to see what they do * You've created a basic database driven web site, congrats! MARKDOWN } diff --git a/sites/intro-to-rails/_working_effectively_and_efficiently.md b/sites/intro-to-rails/_working_effectively_and_efficiently.md index f37b0dd36..5841a3d29 100644 --- a/sites/intro-to-rails/_working_effectively_and_efficiently.md +++ b/sites/intro-to-rails/_working_effectively_and_efficiently.md @@ -2,9 +2,9 @@ We highly recommend you do the following: -* Bring up your terminal and open 2 tabs: - * One is for regular terminal stuffs - * One will be for IRB (a.k.a. Rails console). We'll explain later. +* In your codespace you will want to open 2 terminal tabs:: + * One will be for executing terminal commands and using the Rails console. + * One will be for running your server, so you can test your app as you code (you can't use the terminal for anything else when the server is running). * Open your browser fresh or hide any windows you already have open. * Bring up one window with two tabs * One for this content diff --git a/sites/intro-to-rails/add_the_project_to_a_git_repo.step b/sites/intro-to-rails/add_the_project_to_a_git_repo.step deleted file mode 100644 index 8b52a6464..000000000 --- a/sites/intro-to-rails/add_the_project_to_a_git_repo.step +++ /dev/null @@ -1,70 +0,0 @@ - -goals do - goal "Create a local git repository" - goal "Add all our files to the git repository" - - message "In order to publish our application, we need to add our application and any changes we make over time to a \"revision control system\". In our case we're going to use *git* because it is (relatively) easy and it is what our app server, *Heroku*, uses." -end - -steps do - - step do - console "git init" - - message "It doesn't look like anything really happened, but `git init` -initialized a new repository in a hidden directory called `.git`." - message "You can see this by typing `ls -a` (**l**i**s**t **a**ll files)." - end - - step do - console "git status" - - message "`git status` tells you everything git sees as modified, new, or missing." - message "You should see a ton of stuff under `Untracked files`." - end - - step do - console "git add ." - message "`git add .` tells git that you want to add the current directory (aka `.`) and everything under it to the repo." - tip "git add" do - message <<-MARKDOWN - With Git, there are usually many ways to do very similar things. - - * `git add foo.txt` adds a file named `foo.txt` - * `git add .` adds all new files and changed files, but *keeps* files that you've deleted - * `git add -A` adds everything, including deletions - - "Adding deletions" may sound weird, but if you think of a version control system as keeping - track of *changes*, it might make more sense. Most people use `git add .` but `git add -A` - can be safer. No matter what, `git status` is your friend. - MARKDOWN - end - end - - step do - console "git status" - - message "Now you should see a bunch of files listed under `Changes to be committed`." - end - - step do - console "git commit -m \"Added all the things\"" - message "`git commit` tells git to actually _do_ all things you've said you wanted to do." - message "This is done in two steps so you can group multiple changes together." - message "`-m \"Added all the things\"` is just a shortcut to say what your commit message is. You can skip that part and git will bring up an editor to fill out a more detailed message." - end - - step do - console "git status" - - message "Now you should see something like `nothing to commit, working directory clean` which means you've committed all of your changes." - end -end - -explanation do - message <<-MARKDOWN -By checking your application into git now, you're creating a record of your starting point. Whenever you make a change during today's workshop, we'll add it to git before moving on. This way, if anything ever breaks, or you make a change you don't like, you can use git as an all-powerful "undo" technique. But that only works when you remember to commit early and often! - MARKDOWN -end - -next_step "running_your_application_locally" diff --git a/sites/intro-to-rails/allow_people_to_vote.step b/sites/intro-to-rails/allow_people_to_vote.step index 851d1dc94..9d67d982f 100644 --- a/sites/intro-to-rails/allow_people_to_vote.step +++ b/sites/intro-to-rails/allow_people_to_vote.step @@ -38,7 +38,7 @@ steps { RUBY message <<-MARKDOWN - Verify that upvote route was added successfully by checking the output of `rails routes` or [http://localhost:3000/rails/info](http://localhost:3000/rails/info). You should see a line that looks like this: + Verify that upvote route was added successfully by checking the output of `rails routes`. You should see a line that looks like this: ``` Prefix Verb URI Pattern Controller#Action @@ -47,22 +47,43 @@ steps { MARKDOWN end - step "Add the button to the view" do + step "Add the button to the view and add a table format" do - message "Edit `app/views/topics/index.html.erb` so that the bottom loop looks like this:" + message "Edit `app/views/topics/index.html.erb` so that it looks like this:" source_code :erb, <<-HTML - <% @topics.each do |topic| %> - - <%= topic.title %> - <%= topic.description %> - <%= pluralize(topic.votes.count, "vote") %> - <%= button_to '+1', upvote_topic_path(topic), method: :post %> - <%= link_to 'Show', topic %> - <%= link_to 'Edit', edit_topic_path(topic) %> - <%= link_to 'Destroy', topic, method: :delete, data: { confirm: 'Are you sure?' } %> - - <% end %> +

<%= notice %>

+ +

Topics

+ +
+ + + + + + + + + + + + <% @topics.each do |topic| %> + + + + + + + + + + <% end %> + +
Topic Description Votes count
<%= topic.title %><%= topic.description %><%= pluralize(topic.votes.count, "vote") %><%= button_to '+1', upvote_topic_path(topic), method: :post %><%= link_to 'Show', topic %><%= link_to 'Edit', edit_topic_path(topic) %><%= link_to 'Destroy', topic, method: :delete, data: { confirm: 'Are you sure?' } %>
+
+ + <%= link_to "New topic", new_topic_path %> HTML message <<-MARKDOWN @@ -75,11 +96,8 @@ steps { end step "Confirm your changes in the browser" do - message "Go back to and play." - message "Revel in the fact that you didn't have to restart the server to see these changes. Hawt, no?" + message "Go back to /topics and play." end } -insert 'consider_deploying_again' - next_step "redirect_to_the_topics_list_after_creating_a_new_topic" diff --git a/sites/intro-to-rails/clean_up_links_on_the_topics_list.step b/sites/intro-to-rails/clean_up_links_on_the_topics_list.step index 811edf3f6..b29bad96e 100644 --- a/sites/intro-to-rails/clean_up_links_on_the_topics_list.step +++ b/sites/intro-to-rails/clean_up_links_on_the_topics_list.step @@ -21,7 +21,7 @@ steps { step "Change 'destroy' to 'delete'" do message "Change the line with the word 'Destroy' to this:" - source_code :erb, "<%= link_to 'Delete', topic, method: :delete, data: { confirm: 'Are you sure?' } %>" + source_code :erb, "<%= link_to 'Delete', topic, data: { turbo_method: :delete, turbo_confirm: 'Are you sure?' } %>" end step "Confirm your changes" do @@ -39,6 +39,4 @@ explanation { MARKDOWN } -insert 'consider_deploying_again' - next_step "credits_and_next_steps" diff --git a/sites/intro-to-rails/creating_a_migration.step b/sites/intro-to-rails/creating_a_migration.step index 72d30f929..4402e5af9 100644 --- a/sites/intro-to-rails/creating_a_migration.step +++ b/sites/intro-to-rails/creating_a_migration.step @@ -2,7 +2,7 @@ goals { model_diagram header: 'Topics', fields: %w(id title description) - message "The suggestotron has a list of topics that people can vote on. We'll store our topics in the database. In this step you'll do the following:" + message "The app has a list of topics that people can vote on. We'll store our topics in the database. In this step you'll do the following:" goal "Create a simple *Table* in the database for topics with a title and a description" goal "Automatically generate the corresponding *Scaffold* in Rails (namely, the *Model*, the *View*, and the *Controller*)." @@ -20,8 +20,7 @@ steps { * `description:text` says that topics have a description which is a "text". (What's the difference between "string" and "text"? Basically "text" is for strings that might be very long.) MARKDOWN - message "If you want, take some time to poke around the files listed in this step. You can learn about them in the [Rails Architecture](rails_architecture) page." - link "rails_architecture" + } step { diff --git a/sites/intro-to-rails/credits_and_next_steps.step b/sites/intro-to-rails/credits_and_next_steps.step index d2639cdcd..02eea32a2 100644 --- a/sites/intro-to-rails/credits_and_next_steps.step +++ b/sites/intro-to-rails/credits_and_next_steps.step @@ -7,12 +7,12 @@ You get another sticker! :) # Extra Credit -If you got all the way through Suggestotron with some time to spare, here's some extra stuff you can try: +If you got all the way through with some time to spare, here's some extra stuff you can try: * Add a downvote button that does the opposite of what the upvote button does * Create upvote and downvote methods in the Topic model and use those in the topics controller instead directly modifying the topics votes * Sort topics by their number of votes -* Add an 'about' page, linked from the bottom of the Suggestotron topics list. Link back to the Topics list from the About page so users don't get stranded. +* Add an 'about' page, linked from the bottom of the topics list. Link back to the Topics list from the About page so users don't get stranded. * If your class has a **lot** of time left over: * Users should be allowed to vote only once: give votes a user_id and allow a user to have voted on each topic only once. But wait, what is a 'user' in our system? Get a volunteer to introduce everyone to [Devise](https://github.com/plataformatec/devise), a simple way to add authentication to a Rails application. * Users should be able to give a post a 'negative' vote instead of a positive one. How might you represent that in this system? diff --git a/sites/intro-to-rails/getting_started.step b/sites/intro-to-rails/getting_started.step index 01ad21b9f..46a953546 100644 --- a/sites/intro-to-rails/getting_started.step +++ b/sites/intro-to-rails/getting_started.step @@ -10,63 +10,23 @@ steps do tip "If you have any problems, call over a TA." step do - insert 'switch_to_home_directory' - end - - step do - console "mkdir railsbridge" - message "This command creates a new directory for us to store our project in." - end - - step do - console "cd railsbridge" - end - - step do - message "Check to see if you have any existing suggestotron apps from a previous workshop." - option_half "OSX/Linux" do - console "ls" - message "`ls` stands for **l**i**s**t." - message "It lists the contents of the current directory." - message "If you have any old suggestotron apps in that list, you can remove them to prevent hiccups:" - console "rm -rf suggestotron" - end - option_half "Windows" do - console "dir" - message "`dir` stands for **dir**ectory." - message "It lists the contents of the current directory." - message "If you have any old suggestotron apps in that list, you can remove them to prevent hiccups:" - console "rmdir /s /q suggestotron" - end - end - - step do - console "rails new suggestotron" - message "`rails new` creates a new Rails project with the name you give." - message "In this case we told it to create a new project called `suggestotron`. We'll go into detail on what it created shortly." + console "rails new ." + message "`rails new` creates a new Rails project in the specified folder." + message "In this case we told it to create a new project in the current folder, denoted by the \".\" at the end." message "This will print a lot of stuff to the screen and can take a while to finish." end step do - console "cd suggestotron" - message "`cd suggestotron` makes suggestotron our current directory." + console "ls" + message "`ls` stands for \"list (stuff).\"" end step do message <<-MARKDOWN -Open the suggestotron folder as a project in your text editor. - MARKDOWN - - tip "Close any files that are already open. They might be from yesterday's `test_app`, and we want to make sure that we're editing files in today's `suggestotron` app." - - message <<-MARKDOWN -In **Atom**, you can use the `File > Add Project Folder...` menu option: - -![Atom Project menu screenshot](img/atom_add_folder_to_project.png) +Let's look at the structure of the whole project. -Select your `suggestotron` folder from the file picker that opens. If everything works out Atom should show the directories of your app in a tree structure on the left: +You can see the project directory. This is convenient when you're going to edit several files and want to navigate quickly. -![Screenshot of Suggestotron project folder tree in Atom](img/atom_project_as_folder.png) MARKDOWN end @@ -105,4 +65,4 @@ Select your `suggestotron` folder from the file picker that opens. If everything message "There is a lot more that `rails new` created. Probably enough to fill a book, so we're going to ignore them for now." end -next_step "add_the_project_to_a_git_repo" +next_step "running_your_application_locally" diff --git a/sites/intro-to-rails/hooking_up_votes_and_topics.step b/sites/intro-to-rails/hooking_up_votes_and_topics.step index 42502a734..c39c3e7ac 100644 --- a/sites/intro-to-rails/hooking_up_votes_and_topics.step +++ b/sites/intro-to-rails/hooking_up_votes_and_topics.step @@ -44,7 +44,7 @@ end result <<-CONSOLE $ rails c - Loading development environment (Rails 5.0.0) + Loading development environment (Rails 7.0.8) 2.3.0 :001 > CONSOLE @@ -56,7 +56,7 @@ end tip "`my_topic` here could have been any variable name, but we'll stick with `my_topic` for consistency." - console_with_message "Change the title of that topic to something else:", "my_topic.update_attributes(title: 'Edited in the console')" + console_with_message "Change the title of that topic to something else:", "my_topic.update(title: 'Edited in the console')" console_with_message "Add a vote to that topic:", "my_topic.votes.create" @@ -85,7 +85,7 @@ end ul class: 'no-style-type' do li "my_topic.title" li "my_topic.title = 'New title'" - li "my_topic.update_attributes(title: 'New title')" + li "my_topic.update(title: 'New title')" li "my_topic.save" li "my_topic.save!" li "my_topic.destroy" diff --git a/sites/intro-to-rails/img/Seattle_list_with_topic.png b/sites/intro-to-rails/img/Seattle_list_with_topic.png index e693d8f27..4fca01a75 100644 Binary files a/sites/intro-to-rails/img/Seattle_list_with_topic.png and b/sites/intro-to-rails/img/Seattle_list_with_topic.png differ diff --git a/sites/intro-to-rails/img/Seattle_topic_created.png b/sites/intro-to-rails/img/Seattle_topic_created.png index 77a8816f4..e4ea54907 100644 Binary files a/sites/intro-to-rails/img/Seattle_topic_created.png and b/sites/intro-to-rails/img/Seattle_topic_created.png differ diff --git a/sites/intro-to-rails/img/Start_page.png b/sites/intro-to-rails/img/Start_page.png index d5fbf50f6..d9fce8b61 100644 Binary files a/sites/intro-to-rails/img/Start_page.png and b/sites/intro-to-rails/img/Start_page.png differ diff --git a/sites/intro-to-rails/img/codespaces1.png b/sites/intro-to-rails/img/codespaces1.png new file mode 100644 index 000000000..542ac95d5 Binary files /dev/null and b/sites/intro-to-rails/img/codespaces1.png differ diff --git a/sites/intro-to-rails/img/codespaces2.png b/sites/intro-to-rails/img/codespaces2.png new file mode 100644 index 000000000..a7f9d6693 Binary files /dev/null and b/sites/intro-to-rails/img/codespaces2.png differ diff --git a/sites/intro-to-rails/img/codespaces5.png b/sites/intro-to-rails/img/codespaces5.png new file mode 100644 index 000000000..8c3924b3d Binary files /dev/null and b/sites/intro-to-rails/img/codespaces5.png differ diff --git a/sites/intro-to-rails/img/codespaces6.png b/sites/intro-to-rails/img/codespaces6.png new file mode 100644 index 000000000..c325714df Binary files /dev/null and b/sites/intro-to-rails/img/codespaces6.png differ diff --git a/sites/intro-to-rails/img/codespaces7.png b/sites/intro-to-rails/img/codespaces7.png new file mode 100644 index 000000000..ff7885cf1 Binary files /dev/null and b/sites/intro-to-rails/img/codespaces7.png differ diff --git a/sites/intro-to-rails/img/codespaces8.png b/sites/intro-to-rails/img/codespaces8.png new file mode 100644 index 000000000..36f662b6b Binary files /dev/null and b/sites/intro-to-rails/img/codespaces8.png differ diff --git a/sites/intro-to-rails/img/codespaces9.png b/sites/intro-to-rails/img/codespaces9.png new file mode 100644 index 000000000..9ed18a67f Binary files /dev/null and b/sites/intro-to-rails/img/codespaces9.png differ diff --git a/sites/intro-to-rails/img/open-in-browser.png b/sites/intro-to-rails/img/open-in-browser.png new file mode 100644 index 000000000..a6a7baf93 Binary files /dev/null and b/sites/intro-to-rails/img/open-in-browser.png differ diff --git a/sites/intro-to-rails/img/terminal-tabs1.png b/sites/intro-to-rails/img/terminal-tabs1.png new file mode 100644 index 000000000..77a936942 Binary files /dev/null and b/sites/intro-to-rails/img/terminal-tabs1.png differ diff --git a/sites/intro-to-rails/img/terminal-tabs2.png b/sites/intro-to-rails/img/terminal-tabs2.png new file mode 100644 index 000000000..8483aeb58 Binary files /dev/null and b/sites/intro-to-rails/img/terminal-tabs2.png differ diff --git a/sites/intro-to-rails/intro-to-rails.step b/sites/intro-to-rails/intro-to-rails.step index 69f0a102d..ddd6d08fe 100755 --- a/sites/intro-to-rails/intro-to-rails.step +++ b/sites/intro-to-rails/intro-to-rails.step @@ -36,32 +36,50 @@ day. Probably. ### Requirements -We're going to be working with: - -* Ruby 2.3 or greater installed via RVM (Mac or Linux) or RailsInstaller (Windows) -* Rails 5.0.x -* Bundler -* SQLite -* The text editor of your choice - -Everything should be set up the night before during our -install-fest. Please ensure you have everything working _before_ you -show up for RailsBridge on Saturday. - -You can verify that you have everything working by trying this out in your terminal: - -
-$ irb
->> 1 + 2
-=> 3
->> require "active_support"
-=> true
->> exit
-$
-
-
+To get through this course, you'll need a free Github account. + +Create a free Github account by filling the signup form. + + + +On the next screen, you can click Skip personalization on the bottom to continue. + + + +Once you are signed into Github, you'll need to create a repository - a new programming project. + +To do that, +create a new repository from the RailsBridge template. + +You can pick any name you like, or accept the default suggestion. You can also decide if you want your code to be public +for anyone to see, or private. + +Click Create repository to continue. + + + +It may take a moment for your repository to be generated. + + + + +When it's finished, you'll be taken to a page that looks like this. Click on the green Code button, +make sure you're on the "Codespaces" tab, +then click Create codespace on main. This will be our code editor. + + + +This will begin setting up the editor in your browser. This usually takes at least 2 - 3 minutes. + + + +The editor will automatically set up like this once it's ready. + + + +Congratulations! You're ready to start coding. + -If you can do that, you are probably good to go. MARKDOWN insert 'working_effectively_and_efficiently' diff --git a/sites/intro-to-rails/rails_architecture.step b/sites/intro-to-rails/rails_architecture.step index e356d0df2..688701279 100644 --- a/sites/intro-to-rails/rails_architecture.step +++ b/sites/intro-to-rails/rails_architecture.step @@ -1,7 +1,5 @@ goals { - goal "Create a database table for topics with a title and a description" - message "In this step we'll learn a bit about Rails architecture. By the end of this step you should understand the following concepts:" ul { @@ -51,3 +49,5 @@ Models, Views and Controllers each have specific jobs. Separating responsibilit If you want to learn more about Rails Architecture, you may want to watch this video explanation (3 min 30 sec) [MVC architecture *Youtube*](https://www.youtube.com/watch?v=eTdVkgF_Slo) MARKDOWN } + +next_step "voting_on_topics" diff --git a/sites/intro-to-rails/redirect_to_the_topics_list_after_creating_a_new_topic.step b/sites/intro-to-rails/redirect_to_the_topics_list_after_creating_a_new_topic.step index 8c60ed7c1..2a1822a12 100644 --- a/sites/intro-to-rails/redirect_to_the_topics_list_after_creating_a_new_topic.step +++ b/sites/intro-to-rails/redirect_to_the_topics_list_after_creating_a_new_topic.step @@ -18,7 +18,7 @@ steps { message "Find the line:" - source_code :ruby, "format.html { redirect_to @topic, notice: 'Topic was successfully created.' }" + source_code :ruby, "format.html { redirect_to topic_url(https://github.com/@topic), notice: 'Topic was successfully created.' }" message 'and change `@topic` to `topics_path` like this:' @@ -47,7 +47,7 @@ message "In the same file, locate the update method. " message "Find the line:" - source_code :ruby, "format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }" + source_code :ruby, "format.html { redirect_to topic_url(https://github.com/@topic), notice: 'Topic was successfully updated.' }" message 'and change `@topic` to `topics_path` like before:' @@ -56,7 +56,7 @@ message "In the same file, locate the update method. " end step "Confirm your changes" do - message "Look at ." + message "Create some new topics at /topics. Notice when you create a new topic, the application takes you back to the index page with all the topics." end } diff --git a/sites/intro-to-rails/running_your_application_locally.step b/sites/intro-to-rails/running_your_application_locally.step index 1aadd1447..21b4ea599 100644 --- a/sites/intro-to-rails/running_your_application_locally.step +++ b/sites/intro-to-rails/running_your_application_locally.step @@ -5,16 +5,21 @@ end steps do step do - message "Make sure that you're in the `suggestotron` folder. You can type `pwd` (**p**rint **w**orking **d**irectory) in the terminal to see what folder you are in." console "rails server" message "This will print some stuff and stay running forever, printing more stuff every time you visit a page in your app." end step do - text "Point your web browser to " - url "http://localhost:3000/" - message "See your web app actually running!" + message <<-MARKDOWN + You should see a notification appear in the bottom right corner of your editor. + + Click on the *Open in Browser* button in the notification to navigate to your app. + MARKDOWN + + img src: "img/open-in-browser.png", alt: "Screenshot of the 'open in browser' notification." + + message "If you don't see a notification on the bottom right corner of your editor, click the \"bell\" icon to bring it back up." end step do diff --git a/sites/intro-to-rails/setting_the_default_page.step b/sites/intro-to-rails/setting_the_default_page.step index a8f3db533..12afb9f71 100644 --- a/sites/intro-to-rails/setting_the_default_page.step +++ b/sites/intro-to-rails/setting_the_default_page.step @@ -3,9 +3,9 @@ goals { message <<-MARKDOWN Now that the structure is complete, let's make the flow work smoothly. - Currently when you go to you see the "Welcome aboard" message. + Currently when you go to your homepage you see the "Welcome aboard" message. - It would be easier to use our app if went directly to the topics list. + It would be easier to use our app if the homepage went directly to the topics list. In this step we'll make that happen and learn a bit about routes in Rails. MARKDOWN @@ -14,7 +14,7 @@ goals { steps { step "Add a root route" do - message "Open the file `config/routes.rb` in an editor (In the InstallFest yesterday, we suggested that you install and use **Atom** as your editor)." + message "Open the file `config/routes.rb` in an editor." message "Look for the line `Rails.application.routes.draw` at the beginning of the file, and add the line `root 'topics#index'` after it. When you are done the start of the file should look like this:" @@ -22,14 +22,10 @@ steps { Rails.application.routes.draw do root 'topics#index' RUBY - - em do - message "(Rails 3.x users should add `root to: 'topics#index'` and will need to remove their `public/index.html` file)." - end end step "Confirm your changes" do - message "Go back to . You should be taken to the topics list automatically." + message "Go back to your homepage. You should be taken to the topics list automatically." end } @@ -67,13 +63,13 @@ explanation { ```` This shows all the URLs your application responds to. The code that starts with colons are variables so :id means the id number of the record. The code in parenthesis is optional. - You can also get this information on your site in development. Go to http://localhost:3000/rails/info and you'll see something like this: + You can also get this information on your site in development. Go to /rails/info and you'll see something like this: Screenshot of browser-based Rails routing info page - You'll also see that table in whenever you try to access an invalid route (try http://localhost:3000/sandwich) + You'll also see that table in whenever you try to access an invalid route (try /sandwich) -### Exploring Routes (optional) +### Exploring Routes Now you can have a look at the paths that are available in your app. Let's try looking at one of the topics routes we just generated. @@ -93,6 +89,4 @@ explanation { MARKDOWN } -insert 'consider_deploying' - -next_step "voting_on_topics" +next_step "rails_architecture" diff --git a/sites/intro-to-rails/voting_on_topics.step b/sites/intro-to-rails/voting_on_topics.step index d4776198b..a292fe9e9 100644 --- a/sites/intro-to-rails/voting_on_topics.step +++ b/sites/intro-to-rails/voting_on_topics.step @@ -4,7 +4,7 @@ goals { model_diagram header: 'Votes', fields: %w(id topic_id) - message "Every topic in suggestotron can be voted on. In order to count votes, we need to record votes. We'll add that table now." + message "Every topic can be voted on. In order to count votes, we need to record votes. We'll add that table now." } steps {