Skip to content

Commit

Permalink
Update Install Rails for Mac 10.12 and a few other changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mattangriffel committed Nov 28, 2016
1 parent ee52518 commit 5ab9a91
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 27 deletions.
1 change: 1 addition & 0 deletions app/controllers/application_controller.rb
Expand Up @@ -14,6 +14,7 @@ def rails_version; current_user.rails_version; end

def mac?; os =~ /Mac/; end
def windows?; os =~ /Windows/; end
def linux?; os =~ /Linux/; end

helper_method :mac?, :windows?, :current_user, :os_version
end
52 changes: 27 additions & 25 deletions app/controllers/install_steps_controller.rb
Expand Up @@ -9,9 +9,9 @@ class InstallStepsController < ApplicationController
def show
case step
when :update_ruby
skip_step if ruby_version =~ /2.0/
skip_step if ruby_version =~ /2/
when :update_rails
skip_step if rails_version =~ /4.0/
skip_step if rails_version =~ /5/
end
render_wizard
end
Expand All @@ -24,57 +24,59 @@ def update
private

def set_steps
self.steps = case
when mac? then mac_steps
when windows? then windows_steps
when os == "Linux" then ubuntu_steps
else [:choose_os]
end
self.steps = [:choose_os]
case
when mac?
self.steps += mac_steps
when windows?
self.steps += windows_steps
when linux?
self.steps += ubuntu_steps
end
end

def mac_steps
steps = [:choose_os_version]
case os_version
when "10.8", "10.7", "10.6"
[ :choose_os,
:choose_os_version,
:railsinstaller,
steps += [ :railsinstaller,
:find_the_command_line,
:verify_ruby_version,
:update_ruby,
:verify_rails_version,
:update_rails,
:configure_git,
text_editor_step,
:sublime_text,
:create_your_first_app,
:see_it_live]
when "10.11", "10.10", "10.9"
[ :choose_os,
:choose_os_version,
:install_xcode,
when "10.12", "10.11", "10.10", "10.9"
steps += [ :install_xcode,
:find_the_command_line,
:install_homebrew,
:install_git,
:configure_git,
:install_rvm_and_ruby,
:install_rails,
text_editor_step,
:sublime_text,
:create_your_first_app,
:see_it_live]
else
[:choose_os, :choose_os_version]
end
return steps
end

def windows_steps
[:choose_os, :railsinstaller_windows, text_editor_step, :find_git_bash, :update_rubygems, :create_your_first_app, :see_it_live]
[ :railsinstaller_windows,
:find_git_bash,
:update_rubygems,
:update_rails,
:sublime_text,
:create_your_first_app,
:see_it_live
]
end

def ubuntu_steps
[:choose_os, :rails_for_linux_and_other]
end

def text_editor_step
:sublime_text
[:rails_for_linux_and_other]
end

def finish_wizard_path
Expand Down
1 change: 1 addition & 0 deletions app/views/install_steps/choose_os_version.html.erb
Expand Up @@ -15,6 +15,7 @@
Select your version of OS X
</h2>
<div class="options">
<%= button_to "10.12", wizard_path, name: :os_version, method: :put, class: "option" %>
<%= button_to "10.11", wizard_path, name: :os_version, method: :put, class: "option" %>
<%= button_to "10.10", wizard_path, name: :os_version, method: :put, class: "option" %>
<%= button_to "10.9", wizard_path, name: :os_version, method: :put, class: "option" %>
Expand Down
5 changes: 3 additions & 2 deletions app/views/install_steps/verify_rails_version.html.erb
Expand Up @@ -12,8 +12,9 @@

<section class="prompt center">
<h2>What version of Rails do you have?</h2>
<%= button_to "Rails 4.0", wizard_path, name: :rails_version, method: :put, class: "option" %>
<%= button_to "Rails 3.2", wizard_path, name: :rails_version, method: :put, class: "option" %>
<%= button_to "Rails 5", wizard_path, name: :rails_version, method: :put, class: "option" %>
<%= button_to "Rails 4", wizard_path, name: :rails_version, method: :put, class: "option" %>
<%= button_to "Rails 3", wizard_path, name: :rails_version, method: :put, class: "option" %>
<%= button_to "Nothing! I get an error.", wizard_path, name: :rails_version, method: :put, class: "option" %>
<button type="button" class="troubleshooting" data-toggle="collapse" data-target="#trouble">Troubleshooting</button>
</section>
Expand Down

0 comments on commit 5ab9a91

Please sign in to comment.