├── .gems ├── .gitignore ├── CHANGELOG.txt ├── CONTRIBUTORS.txt ├── LICENCE.txt ├── README.md ├── TEAM.txt ├── VERSION.txt ├── config └── railsinstaller.yml ├── docs └── notes.txt ├── lib ├── extensions │ └── stdlib.rb ├── railsinstaller.rb ├── railsinstaller │ ├── actions.rb │ ├── components.rb │ ├── downloads.rb │ └── methods.rb └── setup │ └── globals.rb ├── rake └── railsinstaller.rake ├── rakefile.rb └── resources ├── chm ├── README ├── contents.hhc.rhtml ├── index.hhk.rhtml └── project.hhp.rhtml ├── icons ├── ruby-doc.ico ├── ruby.ico └── rubyw.ico ├── images ├── RailsInstallerWizardImage.bmp ├── RailsinstallerWizardImageSmall.bmp ├── RubyInstallerWizardImage.bmp └── RubyInstallerWizardImageSmall.bmp ├── railsinstaller ├── LICENSE.txt ├── railsinstaller.iss ├── railsinstaller_gui.iss ├── setup_environment.bat ├── util.iss └── wizard-logo.bmp └── scripts ├── config_check.rb ├── publickey.bat ├── setup_ssh.bat ├── sshkey └── sshkey.bat /.gems: -------------------------------------------------------------------------------- 1 | rubyzip 2 | POpen4 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.exe 2 | *.rbc 3 | *.swp 4 | *~ 5 | .idea/ 6 | archives/ 7 | pkg/ 8 | stage/ 9 | -------------------------------------------------------------------------------- /CHANGELOG.txt: -------------------------------------------------------------------------------- 1 | 3.2.0 - Ruby 2.2.4 2 | 3 | 3.1.1 - Ruby 2.1.8, Rails 4.2.5, activerecord-sqlserver-adapter 4.2.6, 4 | coffee-rails 4.1.1, jquery-rails 4.1.0, sass-rails 5.0.4, Git 2.7.0, 5 | 6 | 3.1.0 - Ruby 2.1.5 7 | 8 | 3.0.0 - Ruby 2.0.0-p598, Rails 4.1.8, activerecord-sqlserver-adapter 4.1.0, 9 | coffee-rails 4.1.0, jquery-rails 3.1.2, sass-rails 4.0.5, sqlite 3.8.7.2, 10 | mysql-5.6.21. 11 | 12 | 2.2.4 - Rails 3.2.19, git 1.9.4, sqlite 3.8.6, mysql-5.6.20 13 | 14 | 2.2.3 - Ruby 1.9.3-p545, Rails 3.2.18, git 1.9.2, postgresql-9.3.4-3, sqlite 3.8.4.3, mysql-5.6.17 15 | 16 | 2.2.2 - Ruby 1.9.3-p484, Rails 3.2.16, git 1.8.4, postgresql-9.3.2-1, sqlite 3.8.2, mysql-5.6.15 17 | 18 | 2.2.0 - Updated main components to the latest version (Ruby 1.9.3-p362, 19 | Rails 3.2.11, git 1.8.0). 20 | Users can now exclude Git from the setup process (maybe it is already installed). 21 | 22 | 2.0.0 - Ruby 1.9.2-p290, Rails 3.1, Active Record SQLServer Adapter, TinyTDS, 23 | git 1.7.6, bundler 1.0.18. 24 | 25 | 1.1.0 - Automatic help for user git configuration on console start. 26 | Automatic ssh key configuration on console start. 27 | Configuration summary output on console start. 28 | git-bash shortcut is now added to the RailsInstaller start menu group. 29 | 30 | 1.0.5 - Ruby Updating to 1.8.7-p334 for released Security Updates. 31 | 32 | 1.0.4 - Moved Sites location back to %HOMEDRIVE%\Sites 33 | 34 | 1.0.3 - Installer now throws an error on rake package if Inno Setup 5 not found 35 | Added Ruby gem bin directory to the path in setup_environment.bat 36 | Added creation of Sites directory in the users home instead of root 37 | 38 | 1.0.2 - Include both sqlite3 and older sqlite3-ruby (which rails 3.0.3 likes best to date) 39 | 40 | 1.0.1 - Added rb-readline and a few other bundled gems. 41 | 42 | 1.0.0 - Initial Release, same features as 0.0.3 43 | 44 | 0.0.3 - Many bugfixes and minor tweaks. 45 | DevKit Integration Fix. 46 | RailsInstaller Wizard Images. 47 | 48 | 0.0.2 - Wizard Screen and functionality tweaks. 49 | Added sample Rails3 application in a directory for application projects. 50 | Tweaked git config to always convert CRLF to LF. 51 | 52 | 0.0.1 - Initial build and package tasks functional, includes Ruby 1.8.7, Git 53 | DevKit and Sqlite3. 54 | 55 | 0.0.0 - Initial repository created with configuration and directory outline. 56 | No functionality at this point. 57 | -------------------------------------------------------------------------------- /CONTRIBUTORS.txt: -------------------------------------------------------------------------------- 1 | # CONTRIBUTORS 2 | # 3 | # This file tries to detail all the developers, users and 3rd parties 4 | # that contributed to materialize this project 5 | # 6 | # Please feel free to add yourself or details, but keep the file in 7 | # as YAML formatted document. Thank you. 8 | 9 | --- 10 | - Wayne E. Seguin 11 | :email: wayneeseguin+railsinstaller@gmail.com 12 | :website: http://rvm.beginrescueend.com/ 13 | 14 | - Luis Lavena 15 | :email: luislavena+railsinstaller@gmail.com 16 | :website: http://blog.mmediasys.com/ 17 | 18 | - Ruby Installer Team and Contributors 19 | :website: http://rubyinstaller.org/about/contributors 20 | 21 | - Gerlando Piro 22 | :email: gpiro@engineyard.com 23 | :contribution: Graphics work for the install wizard. 24 | -------------------------------------------------------------------------------- /LICENCE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-2017 RailsInstaller Team. 2 | All rights reserved. See CONTRIBUTORS.txt for complete list. 3 | 4 | Permission is hereby granted, free of charge, to any person 5 | obtaining a copy of this software and associated documentation 6 | files (the "Software"), to deal in the Software without 7 | restriction, including without limitation the rights to use, 8 | copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the 10 | Software is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | OTHER DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RailsInstaller 2 | 3 | Rails development environment installer for Windows. This is attempt to get the installer to work agian. 4.0.0-alpha Pre-release now available 4 | check out Install Ruby On Rails on Windows or [Releases](https://github.com/railsinstaller/railsinstaller-windows/releases) to downlaod. 5 | 6 | ## Overview 7 | 8 | The goal of this project is to generate an installer that when run installs all 9 | of the most common components for a Rails development environment with no 10 | required prerequisites on a Windows system. 11 | 12 | ## Install Ruby On Rails on Windows 13 | Currently RailsInstaller does not include everything to get rails to work on Windows. Slowly each part will get added back in, but for 14 | now you will need to follow instructions below to get rails installed. 15 | 16 | 1. Download and install 17 | [Git](https://github.com/git-for-windows/git/releases/download/v2.38.0.windows.1/Git-2.38.0-64-bit.exe). 18 | 19 | 2. Download and install 20 | [Nodejs](https://nodejs.org/dist/v16.17.1/node-v16.17.1-x64.msi). 21 | 22 | 3. Download and install 23 | [Yarn](https://classic.yarnpkg.com/latest.msi). 24 | 25 | 4. Download and install 26 | [RailsInstaller](https://github.com/railsinstaller/railsinstaller-windows/releases/download/v4.0.0-alpha/railsinstaller-4.0.0.exe). 27 | 28 | # Need Help, Bugs or Questions 29 | Please come over to the Discord server [Click Here for invite](https://discord.gg/QeRYNGXHuu) 30 | 31 | # RailsInstaller Components 32 | 33 | The next few sections detail the core components that make up RailsInstaller. 34 | 35 | ### Ruby 3.1.2 on Windows 36 | 37 | RubyInstaller is a self contained package installer which installs Ruby and RubyGems on a windows system, head over to [http://rubyinstaller.org/](http://rubyinstaller.org/) for more information. 38 | 39 | ### Development Kit (DevKit) 40 | 41 | A MSYS/MinGW based toolkit that enables RailsInstaller to build native C/C++ packages, both for Ruby and gems. DevKit is built and maintained by the wonderful folks over at the RubyInstaller project. 42 | 43 | ### Packaging/Installer 44 | 45 | We are using [Inno Setup](http://www.jrsoftware.org/isinfo.php "Inno Setup"), a free installer for Windows programs. 46 | 47 | ## How to Contribute 48 | 49 | The information below is out of date and will be updated soon. 50 | 51 | RailsInstaller project code repository is located on GitHub and is bootstrapped, 52 | built and packaged via rake tasks. 53 | 54 | 1. Download and install the latest 55 | [RailsInstaller](http://railsinstaller.org/). 56 | 57 | 1. Download and install latest 58 | [Inno Setup Quick Start Pack](http://www.jrsoftware.org/isdl.php#qsp), 59 | add iscc.exe in your PATH 60 | ``` 61 | C:\Program Files (x86)\Inno Setup 6\ISCC.exe 62 | ``` 63 | 1. [Fork](https://help.github.com/articles/fork-a-repo) 64 | the [RailsInstaller project on github](https://github.com/railsinstaller/railsinstaller-windows.git) 65 | into your own GitHub account. 66 | 67 | 1. Open the the command prompt from the start menu and change directory to where you like to keep your projects. 68 | 69 | 1. Clone your fork of the project. 70 | 71 | ```bash 72 | git clone https://github.com/{{your GitHub user name}}/railsinstaller-windows.git 73 | cd railsinstaller-windows 74 | ``` 75 | 76 | 1. Update from origin master branch and checkout a new topic branch for your feature/bugfix. 77 | 78 | ```bash 79 | git checkout master 80 | git pull origin master 81 | git checkout -b mybranchname 82 | ``` 83 | 84 | 1. Bootstrap the project. From the project root run: 85 | 86 | ```bash 87 | rake bootstrap 88 | ``` 89 | 90 | 1. Implement your new feature and/or fix your bug in your newly forked Railsinstaller project code. 91 | 92 | * The configuration file for specifying required packages can be found at config/railsinstaller.yml. 93 | 94 | * Building of the installer into the stage path for packaging is implemented by Ruby code in the lib/ directory, starting with the file lib/railsinstaller/actions.rb. 95 | 96 | * Methods called by the actions.rb file are implemented by lib/railsinstaller/methods.rb. 97 | 98 | 1. Next build all components onto the stage (into the stage/ directory) 99 | 100 | ```bash 101 | rake build 102 | ``` 103 | 104 | 1. Use Inno Setup to package the installer into an executable (.exe) for testing/distribution. 105 | 106 | Add iscc.exe in your PATH 107 | ``` 108 | C:\Program Files (x86)\Inno Setup 6\ISCC.exe 109 | rake package 110 | ``` 111 | 112 | * This creates the executable (.exe) package file in the pkg/ directory from the files staged during the build process in the stage/ directory. 113 | 114 | * NOTE - You can run the package task with --trace for debugging output if the package fails to build or if you simply want to see what is being done as it is done). 115 | 116 | 1. Once you have verified your new feature/bug-fix, push your branch up to GitHub. 117 | 118 | ```bash 119 | git commit -a -m "Implemented featureX/bugfixX which ..." 120 | git push origin mybranchname 121 | ``` 122 | 123 | 1. Now issue a [pull request](https://help.github.com/articles/using-pull-requests) on GitHub. 124 | -------------------------------------------------------------------------------- /TEAM.txt: -------------------------------------------------------------------------------- 1 | Luis Lavena (luislavena+railsinstaller@gmail.com) 2 | Wayne E. Seguin (wayneeseguin+railsinstaller@gmail.com) 3 | -------------------------------------------------------------------------------- /VERSION.txt: -------------------------------------------------------------------------------- 1 | 4.0.1 2 | -------------------------------------------------------------------------------- /config/railsinstaller.yml: -------------------------------------------------------------------------------- 1 | --- 2 | :gems: 3 | :name: Gems 4 | :title: Ruby Gems 5 | :category: gems 6 | :list: 7 | - 8 | :name: rails 9 | :version: "7.1.2" 10 | 11 | :ruby322: 12 | :category: component 13 | :title: Ruby 3.2.2 14 | :name: Ruby322 15 | :regex: '^.*$' 16 | :url: "https://github.com/robertmabbs/railsinstaller-rubydevkit/releases/download/rubyinstaller-devkit-3.2.2-1-x64/rubyinstaller-devkit-3.2.2-1-x64.7z" 17 | :rename: Ruby3.2.2 18 | 19 | :bsdtar: 20 | :name: BSDTar 21 | :title: Basic BSDTar 22 | :category: utility 23 | :target: bin 24 | :binary: "basic-bsdtar.exe" 25 | :regex: '^basic-bsdtar.exe$' 26 | :url: "http://downloads.sourceforge.net/mingw/basic-bsdtar-2.8.3-1-mingw32-bin.zip" 27 | 28 | :sevenzip: 29 | :name: SevenZip 30 | :title: 7Zip 31 | :category: utility 32 | :target: bin 33 | :binary: "7za.exe" 34 | :regex: '^7za\.exe$' 35 | :url: "http://downloads.sourceforge.net/project/sevenzip/7-Zip/9.20/7za920.zip" 36 | 37 | :git: 38 | :category: component 39 | :title: Git 2.38.1 40 | :name: Git 41 | :url: "https://github.com/robertmabbs/railsinstaller-git/releases/download/2.38.1/PortableGit.zip" 42 | :target: "Git" 43 | :regex: '^.*$' 44 | -------------------------------------------------------------------------------- /docs/notes.txt: -------------------------------------------------------------------------------- 1 | MSYS is "Minimal System", is some sort of Cygwin set of libraries (but 2 | is not cygwin) that only exist to provide support for native 3 | compilation of libraries and tools under MinGW (GCC) 4 | 5 | For example, it provides perl and other components that make it easy 6 | to compile things like OpenSSL. Also provides a native bash that 7 | translates Windows paths (C:\Foo\Bar) into /c/Foo/Bar, making them 8 | compatible with cygwin-like make, used to compile stuff. 9 | 10 | MSYS is the complement of MinGW. Both together form DevKit. 11 | 12 | Inside DevKit you will notice a bin folder, and inside will find 13 | bash, sh and other scripts, then at the same level of 'bin' will find 14 | a 'mingw' folder that contains GCC and the Windows headers, used to 15 | compile. 16 | 17 | Both bin and mingw/bin folders needs to be added to the PATH so things 18 | like this can work: 19 | 20 | sh -c "autoconf" 21 | mkdir build 22 | cd build 23 | sh ../configure ... 24 | make 25 | 26 | We use DevKit build recipes and provide them to the 27 | users as SFX (work on installer has been put on hold for now) 28 | 29 | You can read more about the steps to install it here: 30 | 31 | https://github.com/oneclick/rubyinstaller/wiki/Development-Kit 32 | 33 | ================================================================================ 34 | 35 | 36 | On Wed, Dec 29, 2010 at 6:14 PM, Wayne E. Seguin wrote: 37 | > Would you be able to walk me through an overview of how RubyInstaller works 38 | > from the developers perspective? 39 | > 40 | > Meaning things like: 41 | > * The workflow (Install Ruby and DevKit, then run 'rake ...' ) 42 | 43 | To hack on RubyInstaller you only need a previous version of Ruby 44 | installed, nothing else. 45 | 46 | DevKit is downloaded by "rake devkit" and is part of the dependency 47 | change of building "rake ruby18" or "rake rub19" 48 | 49 | > * The code flow (Starts with the rake call, runs ....) 50 | 51 | git clone ... 52 | cd rubyinstaller 53 | rake ruby18 #=> results in all the libraries compiled and Ruby 1.8.7 54 | build in sandbox/ruby18_mingw 55 | rake ruby19 #=> only builds libraries that 1.9.2 depends on and put 56 | the compiled output at sandbox/ruby19_mingw 57 | 58 | Then, you need: 59 | 60 | gem install rdoc -v "~> 2.5.11" 61 | gem install rdoc_chm 62 | 63 | Also, install (in your computer) InnoSetup QuickStart Pack, unicode: 64 | 65 | http://www.jrsoftware.org/isdl.php#qsp 66 | 67 | When installed, ensure ISPP (pre-processor) is checked for installation. 68 | 69 | Once you're done with that, you can: 70 | 71 | rake ruby18:package 72 | 73 | Which will generate the rdoc (CHM) and will package the InnoSetup script. 74 | 75 | same for ruby19:package 76 | 77 | These tasks don't get added until you don't compile Ruby ;-) 78 | 79 | > I have some code ready to start playing with however I am unsure how you 80 | > would do the packaging and running, etc on windows. 81 | 82 | I think I covered all the steps above, for sure rake tasks can be 83 | cleaned to make it more clear the dependencies :-) 84 | 85 | Hope that helps, 86 | -------------------------------------------------------------------------------- /lib/extensions/stdlib.rb: -------------------------------------------------------------------------------- 1 | class String 2 | # Converts a lower case and underscored string to UpperCamelCase. 3 | # 4 | # Examples: 5 | # "ruby_build_path".camelcase # => "RubyBuildPath" 6 | def camelcase 7 | self.gsub(/(?:\A|_)(.)/) { $1.upcase } 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /lib/railsinstaller.rb: -------------------------------------------------------------------------------- 1 | module RailsInstaller # Ensure that the RailsInstaller project root is defined. 2 | Root = File.expand_path(File.join(File.dirname(__FILE__), "..")) 3 | Stage = File.expand_path(File.join(Root, "stage")) 4 | Archives = File.expand_path(File.join(Root, "archives")) 5 | Scripts = File.expand_path(File.join(Root, "resources/scripts")) 6 | PackageDir = File.expand_path(File.join(Root, "pkg")) 7 | end 8 | 9 | %w[ rubygems fileutils ostruct yaml erb uri open-uri open3 zip ].each do |name| 10 | printf "Loading #{name}...\n" if $Flags[:verbose] 11 | require name 12 | end 13 | 14 | gem "rubyzip" 15 | 16 | %w[ globals ].each do |name| 17 | printf "Loading #{name}...\n" if $Flags[:verbose] 18 | require File.expand_path(File.join(RailsInstaller::Root, "lib", "setup", name + '.rb')) 19 | end 20 | 21 | %w[ stdlib ].each do |name| 22 | printf "Loading #{name}...\n" if $Flags[:verbose] 23 | require File.expand_path(File.join(RailsInstaller::Root, "lib", "extensions", name + '.rb')) 24 | end 25 | 26 | %w[ components methods downloads actions ].each do |name| 27 | printf "Loading #{name}...\n" if $Flags[:verbose] 28 | require File.expand_path(File.join(RailsInstaller::Root, "lib", "railsinstaller", name + '.rb')) 29 | end 30 | -------------------------------------------------------------------------------- /lib/railsinstaller/actions.rb: -------------------------------------------------------------------------------- 1 | module RailsInstaller 2 | 3 | def self.build! 4 | 5 | components = [ 6 | BSDTar, SevenZip, Git, Ruby322 7 | ] 8 | 9 | components.each do |package| 10 | section package.title 11 | download package.url 12 | extract package 13 | end 14 | 15 | # this needs to be done as temp fix to bypass the tzdata error when installing rails 16 | #stage_gem_update 17 | 18 | # stage_sqlite 19 | 20 | # link_devkit_with_ruby 21 | 22 | # stage_git 23 | 24 | # stage_postgresql 25 | 26 | # stage_todo_application 27 | 28 | stage_gems 29 | 30 | # fix_batch_files 31 | 32 | # stage_setup_scripts 33 | 34 | # stage_msvc_runtime 35 | end 36 | 37 | # 38 | # package() 39 | # 40 | # Packages a binary installer release version together as a 41 | # self contained installer using Inno Setup scripting. 42 | # 43 | def self.package! 44 | 45 | unless %x{iscc}.scan("Inno Setup 6") 46 | printf "ERROR: Inno Setup is required in order to package RailsInstaller.\n" 47 | printf " http://www.jrsoftware.org/isdl.php#qsp\n" 48 | printf "Please see README.md for full RailsInstaller instructions.\n" 49 | exit 1 50 | end 51 | 52 | railsinstaller_version = File.read(File.join(RailsInstaller::Root, "VERSION.txt")).chomp 53 | 54 | printf "\nPackaging... this *will* take a while...\n" 55 | 56 | # iscc "\"#{File.join(RailsInstaller::Root, "resources", "railsinstaller", "railsinstaller.iss")}\"", 57 | # "/dInstallerVersion=#{railsinstaller_version}", 58 | # "/dStagePath=\"#{RailsInstaller::Stage}\"", 59 | # "/dRubyPath=\"#{RailsInstaller::Ruby233.rename}\"", 60 | # "/dResourcesPath=\"#{File.join(RailsInstaller::Root, "resources")}\"", 61 | # "/o\"#{RailsInstaller::PackageDir}\"", 62 | # "/frailsinstaller-#{railsinstaller_version}" 63 | 64 | iscc " \"#{File.join(RailsInstaller::Root, "resources", "railsinstaller", "railsinstaller.iss")}\"", 65 | "/DInstallerVersion=\"#{railsinstaller_version}\"", 66 | "/DStagePath=\"#{RailsInstaller::Stage}\"", 67 | "/DRubyPath=\"#{RailsInstaller::Ruby322.rename}\"", 68 | "/DResourcesPath=\"#{File.join(RailsInstaller::Root, "resources")}\"", 69 | "/O\"#{RailsInstaller::PackageDir}\"", 70 | "/Frailsinstaller-#{railsinstaller_version}" 71 | 72 | end 73 | 74 | end 75 | -------------------------------------------------------------------------------- /lib/railsinstaller/components.rb: -------------------------------------------------------------------------------- 1 | module RailsInstaller 2 | # 3 | # Load initial objects (OpenStruct) from railsinstaller.yml 4 | # 5 | @@config = YAML.load( 6 | ERB.new( 7 | File.read( 8 | File.join(Root, "config", "railsinstaller.yml") 9 | ) 10 | ).result(binding) 11 | ) 12 | 13 | @@config.each_pair do |key, value| 14 | const_set(value[:name], OpenStruct.new(value)) 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /lib/railsinstaller/downloads.rb: -------------------------------------------------------------------------------- 1 | module RailsInstaller 2 | 3 | require "net/https" 4 | require "tempfile" 5 | 6 | # Original download() code taken from Rubinius and then butchered ;) 7 | # https://github.com/evanphx/rubinius/blob/master/configure#L307-350 8 | def self.download(url, filename = nil, count = 3) 9 | filename ||= File.basename(url) 10 | 11 | return if File.exists?(File.join(RailsInstaller::Archives, filename)) 12 | 13 | begin 14 | 15 | if ENV["http_proxy"] 16 | protocol, userinfo, host, port = URI::split(ENV["http_proxy"]) 17 | proxy_user, proxy_pass = userinfo.split(/:/) if userinfo 18 | http = Net::HTTP::Proxy(host, port, proxy_user, proxy_pass) 19 | else 20 | http = Net::HTTP 21 | end 22 | 23 | uri = URI.parse(url) 24 | 25 | print "Downloading from #{url} to #{RailsInstaller::Archives}/#{filename}\n" if $Flags[:verbose] 26 | http.get_response(uri) do |response| 27 | 28 | case response 29 | when Net::HTTPNotFound 30 | 31 | raise NET::HTTPNotFound, "Looking for #{url} and received a 404!" 32 | return false 33 | 34 | when Net::HTTPClientError 35 | print "ERROR: Client Error : #{response.inspect}\n" 36 | return false 37 | 38 | when Net::HTTPRedirection 39 | raise "Too many redirections for the original url, halting." if count <= 0 40 | print "Redirected to #{response["Location"]}\n" if $Flags[:verbose] 41 | url = response["location"] 42 | return download(url, filename, count - 1) 43 | 44 | when Net::HTTPOK 45 | temp_file = Tempfile.new("download-#{filename}") 46 | temp_file.binmode 47 | 48 | size = 0 49 | total = response.header["Content-Length"].to_i 50 | 51 | # Ensure that the destination directory exists. 52 | unless File.directory?(RailsInstaller::Archives) 53 | FileUtils.mkdir_p(RailsInstaller::Archives) 54 | end 55 | 56 | if File.exist?(File.join(RailsInstaller::Archives, filename)) 57 | FileUtils.rm_f(File.join(RailsInstaller::Archives, filename)) 58 | end 59 | 60 | Dir.chdir(RailsInstaller::Archives) do 61 | # See https://github.com/oneclick/rubyinstaller/blob/master/rake/contrib/uri_ext.rb#L234-276 62 | # for another alternative to this. 63 | response.read_body do |chunk| 64 | temp_file << chunk 65 | size += chunk.size 66 | print "\r => %d%% (%d of %d) " % [(size * 100) / total, size, total] 67 | end 68 | 69 | temp_file.close 70 | FileUtils.mv( 71 | temp_file.path, 72 | File.join(RailsInstaller::Archives, filename), 73 | :force => true 74 | ) 75 | 76 | print "\n\n" 77 | end 78 | else 79 | raise RuntimeError, "Failed to download #{url}: #{response.message}" 80 | end 81 | end 82 | 83 | rescue Exception => exception 84 | if File.exists?(File.join(RailsInstaller::Archives, filename)) 85 | File.unlink(File.join(RailsInstaller::Archives, filename)) 86 | end 87 | printf "ERROR: #{exception.message}\n" 88 | return false 89 | end 90 | return true 91 | end 92 | end 93 | -------------------------------------------------------------------------------- /lib/railsinstaller/methods.rb: -------------------------------------------------------------------------------- 1 | module RailsInstaller 2 | 3 | # 4 | # unzip: 5 | # Requires: rubyzip (gem install rubyzip) # require "zip/zip" 6 | # 7 | def self.unzip(package) 8 | filename = File.basename(package.url) 9 | base_path = File.dirname(filename) 10 | 11 | if package.target.nil? 12 | target_path = base_path 13 | else 14 | target_path = File.join(base_path, package.target) 15 | end 16 | regex = Regexp.new(package.regex) unless package.regex.nil? 17 | files = [] 18 | 19 | printf " => Extracting #{filename}\n" 20 | 21 | Dir.chdir(RailsInstaller::Archives) do 22 | archive = File.join(RailsInstaller::Archives, filename) 23 | 24 | Zip::File.open(archive) do |zipfile| 25 | printf "zipfile: #{zipfile.inspect}\n" if $Flags[:verbose] 26 | 27 | if regex 28 | entries = zipfile.entries.select do |entry| 29 | entry.name.match(regex) 30 | end 31 | else 32 | entries = zipfile.entries 33 | end 34 | 35 | FileUtils.mkdir_p(File.join(RailsInstaller::Stage, "bin")) 36 | 37 | entries.each do |entry| 38 | printf "DEBUG: Extracting #{entry.name}\n" if $Flags[:verbose] 39 | files << entry.name 40 | if File.exists?(entry.name) 41 | FileUtils.rm_f(entry.name) 42 | end 43 | zipfile.extract(entry, entry.name) 44 | 45 | if File.exist?(File.join(RailsInstaller::Archives, entry.name)) 46 | FileUtils.mv( 47 | File.join(RailsInstaller::Archives, entry.name), 48 | File.join(RailsInstaller::Stage, "bin", entry.name), 49 | :force => true 50 | ) 51 | end 52 | end 53 | end 54 | end 55 | files 56 | end 57 | 58 | # 59 | # extract 60 | # 61 | # Used to extract a non-zip file using BSDTar 62 | # 63 | def self.extract(package) 64 | Dir.chdir(RailsInstaller::Archives) do 65 | filename = File.basename(package.url) 66 | 67 | unless File.exists?(filename) 68 | raise "ERROR: #{filename} does not exist, did the download step fail?" 69 | end 70 | 71 | if package.target.nil? 72 | target_path = RailsInstaller::Stage 73 | else 74 | target_path = File.join(RailsInstaller::Stage, package.target) 75 | end 76 | bsdtar = File.join(RailsInstaller::Stage, "bin", RailsInstaller::BSDTar.binary) 77 | sevenzip = File.join(RailsInstaller::Stage, "bin", RailsInstaller::SevenZip.binary) 78 | 79 | if package.category == "utility" && 80 | File.exist?(File.join(RailsInstaller::Stage, "bin", package.binary)) 81 | printf "#{package.name} already on stage.\n" 82 | return 83 | end 84 | 85 | printf " => Extracting #{filename} to the stage.\n" if $Flags[:verbose] 86 | 87 | FileUtils.mkdir_p(RailsInstaller::Stage) unless File.directory?(RailsInstaller::Stage) 88 | 89 | case package.category 90 | when "utility" # Remove target file, if exists. 91 | target = File.join(RailsInstaller::Stage, "bin", package.binary) 92 | if File.exists?(target) 93 | printf "#{target} on stage.\n" 94 | return 95 | end 96 | FileUtils.rm_f(target) if File.exist?(target) 97 | when "component" # Remove target dir if it exists and is different than the stage 98 | if (File.directory?(target_path) && target_path != RailsInstaller::Stage) 99 | FileUtils.rm_rf(target_path) 100 | end 101 | else 102 | raise "Unknown package category"#{package.category}".\npackage category should be one of {"utility","component"}?" 103 | end 104 | 105 | archive = File.join(RailsInstaller::Archives, filename) 106 | 107 | Dir.chdir(RailsInstaller::Stage) do 108 | case filename 109 | when /(^.+\.tar)\.z$/, /(^.+\.tar)\.gz$/, /(^.+\.tar)\.bz2$/, /(^.+\.tar)\.lzma$/, /(^.+)\.tgz$/ 110 | line = %Q("#{bsdtar}" -xf "#{archive}") 111 | when /^.+\.7z$/ 112 | line = %Q("#{sevenzip}" x -y -t7z -o#{target_path} "#{archive}") 113 | when /^.+sfx\.exe$/ 114 | line = %Q("#{sevenzip}" x -y -t7z -sfx -o#{target_path} #{archive}) 115 | when /(^.+\.zip$)/ 116 | if File.exist?(sevenzip) # Use bsdtar once we already have it 117 | line = %Q("#{sevenzip}" x -y -o#{target_path} #{archive}) 118 | else 119 | return unzip(package) # For the unzip case we can return a list of extracted files. 120 | end 121 | else 122 | raise "\nERROR:\n Cannot extract #{archive}, unhandled file extension!\n" 123 | end 124 | 125 | sh(line) 126 | 127 | if package.rename 128 | case package.category 129 | when "component" 130 | Dir.chdir(RailsInstaller::Stage) do 131 | if File.exist?(package.rename) 132 | FileUtils.rm_rf(package.rename) 133 | end 134 | 135 | source = File.basename(package.url, File.extname(package.url)) 136 | printf "DEBUG: source: %s\ntarget: %s\n", source, package.rename if $Flags[:verbose] 137 | FileUtils.mv( 138 | File.basename(package.url, File.extname(package.url)), 139 | package.rename 140 | ) 141 | end 142 | end 143 | end 144 | end 145 | end 146 | end 147 | 148 | # 149 | # install_utility() 150 | # 151 | # Requires: open-uri 152 | # 153 | def self.install_utility 154 | 155 | # TODO: Merge this into download, simply check if object has a .binary attribute. 156 | if File.exists?(File.join(RailsInstaller::Stage, "bin", binary)) 157 | printf "#{File.join(RailsInstaller::Stage, "bin", binary)} exists.\nSkipping download, extract and install.\n" 158 | else 159 | printf " => Downloading and extracting #{binary} from #{utility.url}\n" 160 | 161 | FileUtils.mkdir_p(RailsInstaller::Stage) unless File.directory?(RailsInstaller::Stage) 162 | 163 | Dir.chdir(RailsInstaller::Stage) do 164 | filename = File.basename(utility.url) 165 | FileUtils.rm_f(filename) if File.exist?(filename) 166 | # Utilities are small executables, thus using open-uri to download them is fine. 167 | open(utility.url) do |temporary_file| 168 | File.open(filename, "wb") do |file| 169 | file.write(temporary_file.read) 170 | end 171 | end 172 | 173 | extract(binary) 174 | 175 | printf " => Installing #{binary} to #{File.join(RailsInstaller::Stage, "bin")}\n" 176 | 177 | FileUtils.mkdir_p(RailsInstaller::Stage, "bin") unless File.directory?(RailsInstaller::Stage, "bin") 178 | 179 | FileUtils.mv( 180 | File.join(RailsInstaller::Stage, binary), 181 | File.join(RailsInstaller::Stage, "bin", binary), 182 | :force => true 183 | ) 184 | end 185 | end 186 | end 187 | 188 | # 189 | # Copy required Sqlite3 files on to the stage 190 | # 191 | def self.stage_sqlite 192 | Sqlite3.files.each do |file| 193 | if File.exist?(File.join(Stage, file)) 194 | FileUtils.mv( 195 | File.join(Stage, file), 196 | File.join(Stage, Ruby233.rename, "bin", file) 197 | ) 198 | end 199 | end 200 | end 201 | 202 | # 203 | # Copy required Postgresql files on to the stage 204 | # 205 | def self.stage_postgresql 206 | PostgresServer.files.each do |file| 207 | if File.exist?(File.join(Stage, file)) 208 | FileUtils.cp( 209 | File.join(Stage, PostgresServer.target, "bin", file), 210 | File.join(Stage, Ruby233.rename, "bin", file) 211 | ) 212 | end 213 | end 214 | end 215 | 216 | # 217 | # Add functionality to DevKit object that was loaded during configure. 218 | # 219 | def self.link_devkit_with_ruby 220 | devkit_path = File.join(Stage, DevKit.target) 221 | ruby_path = File.join(Stage, Ruby233.rename) 222 | FileUtils.mkdir_p(devkit_path) unless File.directory?(devkit_path) 223 | Dir.chdir(devkit_path) do 224 | File.open("config.yml", "w") do |file| 225 | file.write(%Q(---\n- #{ruby_path})) 226 | end 227 | sh %Q{#{File.join(ruby_path, "bin", "ruby")} dk.rb install} 228 | end 229 | end 230 | 231 | def self.stage_git 232 | # TODO: adjust git config for CRLF => LF autoadjust. 233 | gitconfig = File.join(Stage, Git.target, "etc", "gitconfig") 234 | config = File.read(gitconfig) 235 | File.open(gitconfig, "w") do |config_file| 236 | config_file.write(config.gsub(/autocrlf = true/, "autocrlf = false")) 237 | end 238 | end 239 | 240 | def self.stage_gem_update 241 | ruby_path = File.join(Stage, Ruby322.rename) 242 | 243 | line = %Q(#{File.join(ruby_path, "bin", "gem")} update ) 244 | sh line 245 | end 246 | 247 | def self.stage_gems 248 | section Gems 249 | build_gems(File.join(Stage, Ruby322.rename), Gems.list) 250 | end 251 | 252 | def self.fix_batch_files 253 | ruby_path = File.join(Stage, Ruby233.rename) 254 | bin_path = File.join(ruby_path, "bin/") 255 | filenames = Dir.glob("#{bin_path}*.bat") 256 | filenames.each do |filename| 257 | text = File.read(filename) 258 | fixed = text.gsub(/#{bin_path}/, '') 259 | other_bin_path = bin_path.gsub(/\//, '\\\\\\\\') 260 | fixed = fixed.gsub(/#{other_bin_path}/, '') 261 | File.open(filename, "w") { |file| 262 | file.write fixed 263 | } 264 | end 265 | end 266 | 267 | def self.stage_todo_application 268 | section RailsTodo 269 | todo_path = File.join(Stage, "Sites", "todo") 270 | FileUtils.rm_rf(todo_path) if File.exist?(todo_path) 271 | 272 | git_binary = File.join(Stage, Git.target, "bin", "git") 273 | 274 | line = %Q(#{git_binary} clone -b railsinstaller https://github.com/engineyard/todo todo) 275 | 276 | applications_path = File.join(RailsInstaller::Stage, "Sites") 277 | FileUtils.mkdir_p applications_path unless File.exist?(applications_path) 278 | Dir.chdir(applications_path) { sh line } 279 | # now bootstrap gems... 280 | 281 | if File.exist?(File.join(todo_path, ".git")) 282 | FileUtils.rm_rf(File.join(todo_path, ".git")) 283 | end 284 | 285 | gem_install File.join(Stage, Ruby233.rename), "bundler", :version => "1.15.3" 286 | 287 | ruby_binary("bundle", "install", "", File.join(Stage, Ruby233.rename), File.join(applications_path, "todo")) 288 | end 289 | 290 | def self.stage_rails_sample_application 291 | # Generate sample rails application in the Rails application directory on 292 | # stage. 293 | section Rails 294 | sample = File.join(Stage, "Sites", "sample") 295 | FileUtils.rm_rf(sample) if File.exist?(sample) 296 | ruby_binary("rails", "new", "sample", File.join(Stage, Ruby233.rename)) 297 | end 298 | 299 | # Renders setup scripts to be used post-installation 300 | # They have installation-sensitive information (installation path) 301 | def self.stage_setup_scripts 302 | section Scripts 303 | scripts_path = File.join(RailsInstaller::Stage, "scripts") 304 | FileUtils.mkdir_p(scripts_path) unless File.exist?(scripts_path) 305 | 306 | %w( config_check.rb ).each do |file| 307 | FileUtils.cp( 308 | File.join(RailsInstaller::Scripts, file), 309 | File.join(scripts_path, file) 310 | ) 311 | end 312 | 313 | %w( publickey.bat ).each do |file| 314 | FileUtils.cp( 315 | File.join(RailsInstaller::Scripts, file), 316 | File.join(Stage, Ruby233.rename, "bin", file) 317 | ) 318 | end 319 | end 320 | 321 | # MSVC Runtime 2008 is Required for Postgresql Server 322 | def self.stage_msvc_runtime 323 | download(MsvcRuntime.url) 324 | pkg_path = File.join(RailsInstaller::Stage, "pkg") 325 | 326 | FileUtils.mkdir_p(pkg_path) unless File.exist?(pkg_path) 327 | 328 | FileUtils.cp( 329 | File.join(RailsInstaller::Archives, File.basename(MsvcRuntime.url)), 330 | File.join(pkg_path, File.basename(MsvcRuntime.url)) 331 | ) 332 | end 333 | 334 | # 335 | # build_gems 336 | # 337 | # loops over each gemname and triggers it to be built. 338 | def self.build_gems(ruby_path, gems) 339 | if gems.is_a?(Array) 340 | gems.each do |name| 341 | build_gem(ruby_path, name) 342 | end 343 | elsif gems.is_a?(Hash) 344 | gems.each_pair do |name, version | 345 | build_gem(ruby_path, name, version) 346 | end 347 | else 348 | build_gem(ruby_path, gems) 349 | end 350 | end 351 | 352 | def self.build_gem(ruby_path, gem, options = {}) 353 | if gem.is_a?(Hash) 354 | options[:version] = gem[:version] 355 | gem_install(ruby_path,gem[:name], options) 356 | else 357 | gem_install(ruby_path,gem, options) 358 | end 359 | end 360 | 361 | def self.gem_install(ruby_path, gem,options = {}) 362 | printf " => Staging gem #{gem}\n" if $Flags[:verbose] 363 | %w(GEM_HOME GEM_PATH).each { |variable| ENV.delete(variable)} 364 | line = %Q(#{File.join(ruby_path, "bin", "gem")} install #{gem} ) 365 | line << %Q( -v "#{options[:version]}" ) if options[:version] 366 | #line << %Q( --env-shebang --no-rdoc --no-ri --source http://rubygems.org ) 367 | line << options[:args] if options[:args] 368 | sh line 369 | end 370 | 371 | def self.ruby_binary(name, line, action, ruby_path, directory_path, options = {}) 372 | printf " => rails #{line} #{action}\n" if $Flags[:verbose] 373 | %w(GEM_HOME GEM_PATH).each { |variable| ENV.delete(variable)} 374 | line = %Q(#{File.join(ruby_path, "bin", "ruby")} -S #{name} #{line} #{action}) 375 | line += options[:args] if options[:args] 376 | Dir.chdir(directory_path) { sh line } 377 | end 378 | 379 | def self.iscc(*params) 380 | executable = nil 381 | 382 | # look for Inno Setup compiler in the PATH 383 | found = ENV["PATH"].split(File::PATH_SEPARATOR).find do |path| 384 | File.exist?(File.join(path, "ISCC.exe")) && File.executable?(File.join(path, "ISCC.exe")) 385 | end 386 | 387 | # not found? 388 | if found 389 | executable = "ISCC.exe" 390 | else 391 | path = File.join(ENV["ProgramFiles"], "Inno Setup 6") 392 | if File.exist?(File.join(path, "ISCC.exe")) && File.executable?(File.join(path, "ISCC.exe")) 393 | path.gsub!(File::SEPARATOR, File::ALT_SEPARATOR) 394 | ENV["PATH"] = "#{path}#{File::PATH_SEPARATOR}#{ENV["PATH"]}" unless ENV["PATH"].include?(path) 395 | executable = "ISCC.exe" 396 | end 397 | end 398 | cmd = [executable] 399 | cmd.concat(params) 400 | sh cmd.join(" ") 401 | end 402 | 403 | # 404 | # sh 405 | # 406 | # Runs Shell lines, single point of shell contact. 407 | # 408 | def self.sh(line, options = {}) 409 | stage_bin_path = File.join(RailsInstaller::Stage, "bin") 410 | ENV["PATH"] = "#{stage_bin_path};#{ENV["PATH"]}" unless ENV["PATH"].include?(stage_bin_path) 411 | 412 | printf "\nDEBUG: > %s\n\n", line if $Flags[:verbose] 413 | 414 | output, status = Open3.capture2e(line) 415 | puts output.read unless output.empty? if $Flags[:versbose] 416 | end 417 | 418 | def self.log(text) 419 | printf %Q[#{text}\n] 420 | end 421 | 422 | def self.section(text) 423 | printf %Q{\n== #{text}\n\n} 424 | end 425 | end 426 | -------------------------------------------------------------------------------- /lib/setup/globals.rb: -------------------------------------------------------------------------------- 1 | $Flags ||= { :verbose => false } 2 | -------------------------------------------------------------------------------- /rake/railsinstaller.rake: -------------------------------------------------------------------------------- 1 | task :default do 2 | printf "\nRailsInstaller Rake Tasks: 3 | 4 | {bootstrap, build, package} 5 | 6 | See README.md for more details.\n\n" 7 | end 8 | 9 | task :require_railsinstaller do 10 | 11 | require "railsinstaller" 12 | 13 | end 14 | 15 | desc "Bootstrap RailsInstaller development environment (gems)" 16 | task :bootstrap do 17 | 18 | require "rubygems/dependency_installer" 19 | 20 | gems = File.read(File.join(ProjectRoot, ".gems")).gsub(" -v", ' ').split("\n") 21 | 22 | gems.each do |gem| 23 | 24 | printf "Ensuring #{gem} is installed...\n" 25 | 26 | name, version, options = gem.split(/\s+/) 27 | 28 | installer = Gem::DependencyInstaller.new( 29 | { :generate_rdoc => false, :generate_ri => false } 30 | ) 31 | 32 | version ? installer.install(name, version) : installer.install(name) 33 | 34 | end 35 | 36 | printf "Bootstrapped.\nDo not forget to download and install Inno Setup, see README.md for more information.\n" 37 | 38 | end 39 | 40 | desc "Download and build all components and dependencies into stage/." 41 | task :build => [ :require_railsinstaller ] do 42 | 43 | RailsInstaller.build! 44 | 45 | end 46 | 47 | desc "Package all components into a single executable installer into pkg/." 48 | task :package => [ :require_railsinstaller ] do 49 | 50 | RailsInstaller.package! 51 | 52 | end 53 | -------------------------------------------------------------------------------- /rakefile.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require "rubygems" 4 | require "rake" 5 | 6 | # Ensure project root is in the LOAD_PATH 7 | $LOAD_PATH.unshift(File.join(File.expand_path(File.dirname(__FILE__)), "lib")) 8 | 9 | ProjectRoot = File.dirname(File.expand_path(__FILE__)) 10 | 11 | # Set Flags 12 | $Flags = {} if $Flags.nil? 13 | if Rake.application.options.trace 14 | $Flags[:verbose] = true 15 | end 16 | 17 | # Load all Rake Task definitions 18 | Dir["#{ProjectRoot}/rake/*.rake"].each do |file| 19 | puts "Loading #{File.basename(file)}" if Rake.application.options.trace 20 | load file 21 | end 22 | -------------------------------------------------------------------------------- /resources/chm/README: -------------------------------------------------------------------------------- 1 | =RailsInstaller 2 | 3 | The goal of the RailsInstaller project is to provide developers working on Windows 4 | systems with an easy way to quickly get started using Ruby on Rails by providing 5 | a Windows installer containing a fully functioning baseline MRI (Matz' Ruby 6 | Implementation) Ruby environment tuned for Windows systems with libraries for 7 | doing Ruby on Rails development. 8 | -------------------------------------------------------------------------------- /resources/chm/contents.hhc.rhtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | <% rdocs.each do |rdoc| %> 11 | <% end %> 23 | 24 | 25 | -------------------------------------------------------------------------------- /resources/chm/index.hhk.rhtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 13 | 14 | -------------------------------------------------------------------------------- /resources/chm/project.hhp.rhtml: -------------------------------------------------------------------------------- 1 | [OPTIONS] 2 | Auto Index=Yes 3 | Compatibility=1.1 or later 4 | Compiled file=<%= File.basename(meta_chm.file) %> 5 | Contents file=contents.hhc 6 | Display compile progress=No 7 | Default topic=index.html 8 | Language=0x409 English (United States) 9 | Title=<%= meta_chm.title %> 10 | Full-text search=Yes 11 | Index file=index.hhk 12 | 13 | [FILES] <% meta_chm.files.each do |file| %> 14 | <%= file %> 15 | <% end %> 16 | 17 | [MERGE FILES] <% meta_chm.merge_files.each do |merge_file| %> 18 | <%= merge_file %> 19 | 20 | <% end %> 21 | 22 | [INFOTYPES] 23 | 24 | -------------------------------------------------------------------------------- /resources/icons/ruby-doc.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/railsinstaller/railsinstaller-windows/f99f083e11274f3a002a2a2861b2d63d17ea2af7/resources/icons/ruby-doc.ico -------------------------------------------------------------------------------- /resources/icons/ruby.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/railsinstaller/railsinstaller-windows/f99f083e11274f3a002a2a2861b2d63d17ea2af7/resources/icons/ruby.ico -------------------------------------------------------------------------------- /resources/icons/rubyw.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/railsinstaller/railsinstaller-windows/f99f083e11274f3a002a2a2861b2d63d17ea2af7/resources/icons/rubyw.ico -------------------------------------------------------------------------------- /resources/images/RailsInstallerWizardImage.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/railsinstaller/railsinstaller-windows/f99f083e11274f3a002a2a2861b2d63d17ea2af7/resources/images/RailsInstallerWizardImage.bmp -------------------------------------------------------------------------------- /resources/images/RailsinstallerWizardImageSmall.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/railsinstaller/railsinstaller-windows/f99f083e11274f3a002a2a2861b2d63d17ea2af7/resources/images/RailsinstallerWizardImageSmall.bmp -------------------------------------------------------------------------------- /resources/images/RubyInstallerWizardImage.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/railsinstaller/railsinstaller-windows/f99f083e11274f3a002a2a2861b2d63d17ea2af7/resources/images/RubyInstallerWizardImage.bmp -------------------------------------------------------------------------------- /resources/images/RubyInstallerWizardImageSmall.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/railsinstaller/railsinstaller-windows/f99f083e11274f3a002a2a2861b2d63d17ea2af7/resources/images/RubyInstallerWizardImageSmall.bmp -------------------------------------------------------------------------------- /resources/railsinstaller/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-2022 RailsInstaller Team. 2 | 3 | Except: 4 | 5 | * Ruby is copyrighted free software by Yukihiro Matsumoto. 6 | http://www.ruby-lang.org/en/LICENSE.txt 7 | 8 | * DevKit is licensed via the RubyInstaller project: 9 | http://rubyinstaller.org/ 10 | 11 | * 3rd party libraries (OpenSSL, ZLib, etc.) 12 | 13 | 14 | This software is distributed under the terms of MIT license. 15 | 16 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /resources/railsinstaller/railsinstaller.iss: -------------------------------------------------------------------------------- 1 | ; RailsInstaller - Inno Setup Script 2 | ; Adaptation from RubyInstaller installer script 3 | ; 4 | 5 | ; PRE-CHECK 6 | ; Verify that RubyPath is defined by ISCC using 7 | ; /d command line arguments. 8 | ; 9 | ; Usage: 10 | ; iscc rubyinstaller.iss /dInstallerVersion=0.1.0 11 | ; /dStagePath=stage 12 | ; /dRubyPath=Ruby/1.9.2 13 | ; [/dInstVersion=26-OCT-2009] 14 | 15 | ; Full example: 16 | ; iscc resouces\railsinstaller\railsinstaller.iss \ 17 | ; /dInstallerVersion=2.1.0 \ 18 | ; /dStagePath=stage \ 19 | ; /dRubyPath=Ruby1.9.2 \ 20 | ; /opkg 21 | ; /frailsinstaller-2.1.0.exe 22 | 23 | #if Defined(InstallerVersion) == 0 24 | #error Please provide a InstallerVersion definition using a /d parameter. 25 | #endif 26 | 27 | #if Defined(StagePath) == 0 28 | #error Please provide a StagePath value to the Ruby files using a /d parameter. 29 | #endif 30 | 31 | ; Once a ruby version has been downloaded then I can test this at the moment commet out so I could upgrade the INNO to version 6 32 | #if Defined(RubyPath) == 0 33 | #error Please provide a RubyPath value to the Ruby files using a /d parameter. 34 | #else 35 | #if FileExists(StagePath + '/' + RubyPath + '\bin\ruby.exe') == 0 36 | #error No Ruby installation (bin\ruby.exe) found inside defined RubyPath. Please verify. 37 | #error "Setup failed to run the script." 38 | #endif 39 | #endif 40 | 41 | #if Defined(InstVersion) == 0 42 | #define InstVersion GetDateTimeString('dd-mmm-yy"T"hhnn', '', '') 43 | #endif 44 | 45 | ; Build Installer details using above values 46 | #define InstallerName "RailsInstaller" 47 | #define InstallerNameWithVersion InstallerName + " " + InstallerVersion 48 | #define InstallerPublisher "RailsInstaller Team" 49 | #define InstallerHomepage "http://www.railsinstaller.org/" 50 | 51 | #define CurrentYear GetDateTimeString('yyyy', '', '') 52 | 53 | [Setup] 54 | ; NOTE: The value of AppId uniquely identifies this application. 55 | ; Do not use the same AppId value in installers for other applications! 56 | AppId={{613C3EA5-1248-4E35-B61A-6D0B31BBC0DB} 57 | AppName={#InstallerName} 58 | AppVerName={#InstallerNameWithVersion} 59 | AppPublisher={#InstallerPublisher} 60 | AppPublisherURL={#InstallerHomepage} 61 | AppVersion={#InstallerVersion} 62 | DefaultGroupName={#InstallerName} 63 | DefaultDirName={sd}\RailsInstaller 64 | DisableProgramGroupPage=true 65 | LicenseFile=LICENSE.txt 66 | Compression=lzma2/ultra64 67 | SolidCompression=true 68 | AlwaysShowComponentsList=false 69 | DisableReadyPage=true 70 | InternalCompressLevel=ultra64 71 | VersionInfoCompany={#InstallerPublisher} 72 | VersionInfoCopyright=(c) {#CurrentYear} {#InstallerPublisher} 73 | VersionInfoDescription=Rails development environment installer for Windows 74 | VersionInfoTextVersion={#InstallerVersion} 75 | VersionInfoVersion={#InstallerVersion} 76 | UninstallDisplayIcon={app}\bin\ruby.exe 77 | WizardImageFile={#ResourcesPath}\images\RailsInstallerWizardImage.bmp 78 | WizardSmallImageFile={#ResourcesPath}\images\RailsInstallerWizardImageSmall.bmp 79 | PrivilegesRequired=lowest 80 | ChangesAssociations=yes 81 | ChangesEnvironment=yes 82 | UsePreviousAppDir=no 83 | 84 | #if Defined(SignPackage) == 1 85 | SignTool=risigntool sign /a /d $q{#InstallerNameWithVersion}$q /du $q{#InstallerHomepage}$q /t $qhttp://timestamp.comodoca.com/authenticode$q $f 86 | #endif 87 | 88 | [Languages] 89 | Name: en; MessagesFile: compiler:Default.isl 90 | 91 | [Messages] 92 | en.InstallingLabel=Installing [name], this will take a few minutes... 93 | en.WelcomeLabel1=Welcome to [name]! 94 | en.WelcomeLabel2=This will install [name/ver] on your computer. Please close any console applications before continuing. 95 | en.WizardLicense={#InstallerName} License Agreement 96 | en.LicenseLabel= 97 | en.LicenseLabel3=Please read the following License Agreements and accept the terms before continuing the installation. 98 | en.LicenseAccepted=I &accept all of the Licenses 99 | en.LicenseNotAccepted=I &decline any of the Licenses 100 | en.WizardSelectDir=Installation Destination and Optional Tasks 101 | en.SelectDirDesc=This is the location that Ruby, DevKit, Rails and Sqlite will be installed to. 102 | en.SelectDirLabel3=[name] will be installed into the following folder. Click Install to continue or click Browse to use a different one. 103 | en.SelectDirBrowseLabel=Please avoid any folder name that contains spaces (e.g. Program Files). 104 | en.DiskSpaceMBLabel=Required free disk space: ~[mb] MB 105 | 106 | [Files] 107 | ; NOTE: Don't use "Flags: ignoreversion" on any shared system files 108 | Source: {#StagePath}\{#RubyPath}\*; DestDir: {app}\{#RubyPath}; Flags: recursesubdirs createallsubdirs 109 | Source: {#StagePath}\Git\*; DestDir: {app}\Git; Flags: recursesubdirs createallsubdirs 110 | ;Source: {#StagePath}\Git\*; DestDir: {app}\Git; Check: InstallGit; Flags: recursesubdirs createallsubdirs 111 | ;Source: {#StagePath}\DevKit\*; DestDir: {app}\DevKit; Excludes: "config.yml"; Flags: recursesubdirs createallsubdirs 112 | ;Source: {#StagePath}\DevKit\config.yml; DestDir: {app}\DevKit; AfterInstall: UpdateDevKitConfig('{app}\{#RubyPath}', '{app}\DevKit\config.yml') 113 | ;Source: {#StagePath}\Sites\*; DestDir: {sd}\Sites; Flags: recursesubdirs createallsubdirs 114 | ;Source: {#StagePath}\scripts\*; DestDir: {app}\scripts; Flags: recursesubdirs createallsubdirs 115 | ; TODO: Instead of running the full vcredist, simply extract and bundle the dll 116 | ; files with an associated manifest. 117 | ; Source: {#StagePath}\pkg\vcredist_x86.exe; DestDir: {tmp}; Flags: deleteafterinstall 118 | ;Source: setup_environment.bat; DestDir: {app}\{#RubyPath} 119 | 120 | [Registry] 121 | ; FIXME: Proper registry keys for RailsInstaller (admin) 122 | ;Root: HKLM; Subkey: Software\RailsInstaller; ValueType: string; ValueName: ; ValueData: ; Flags: uninsdeletevalue uninsdeletekeyifempty; Check: IsAdmin 123 | 124 | ; FIXME: Proper registry key for RailsInstaller (user) 125 | ;Root: HKCU; Subkey: Software\RailsInstaller; ValueType: string; ValueName: ; ValueData: ; Flags: uninsdeletevalue uninsdeletekeyifempty; Check: IsNotAdmin 126 | 127 | [Icons] 128 | Name: {group}\Interactive Ruby; Filename: {app}\{#RubyPath}\bin\irb.bat; WorkingDir: {app}\{#RubyPath} ; IconFilename: {app}\{#RubyPath}\bin\ruby.exe; Flags: createonlyiffileexists 129 | Name: {group}\RubyGems Documentation Server; Filename: {app}\{#RubyPath}\bin\gem.bat; Parameters: server; IconFilename: {app}\{#RubyPath}\bin\ruby.exe; Flags: createonlyiffileexists runminimized 130 | Name: {group}\Command Prompt with Ruby and Rails; Filename: {sys}\cmd.exe; Parameters: /E:ON /K {app}\{#RubyPath}\setup_environment.bat {app}; WorkingDir: {sd}\Sites; IconFilename: {sys}\cmd.exe; Flags: createonlyiffileexists 131 | ;Name: {group}\Git Bash; Filename: {sys}\cmd.exe; Parameters: "/c """"{app}\Git\bin\sh.exe"" --login -i"""; WorkingDir: {sd}\Sites; IconFilename: {app}\Git\etc\git.ico; Check: InstallGit; Flags: createonlyiffileexists 132 | ; {%HOMEPATH%} 133 | Name: {group}\{cm:UninstallProgram,{#InstallerName}}; Filename: {uninstallexe} 134 | 135 | [Run] 136 | ;Filename: "{app}\{#RubyPath}\bin\ruby.exe"; Parameters: "dk.rb install --force"; WorkingDir: "{app}\DevKit"; Flags: runhidden 137 | ;Filename: "{app}\{#RubyPath}\bin\gem.bat"; Parameters: "pristine --all --only-executables"; WorkingDir: "{app}\{#RubyPath}\bin"; Flags: runhidden 138 | ;Filename: {sys}\cmd.exe; Parameters: /E:ON /K {app}\{#RubyPath}\setup_environment.bat {app}; WorkingDir: {sd}\Sites; Description: "Configure git and ssh when installation has completed."; Check: InstallGit; Flags: postinstall nowait skipifsilent 139 | 140 | ; TODO: Instead of running the full vcredist, simply extract and bundle the dll 141 | ; files with an associated manifest. 142 | ; Filename: "{tmp}\vcredist_x86.exe"; StatusMsg: "Installing Microsoft Visual C++ 2008 SP1 Redistributable Package (x86)..." ; Parameters: "/q"; WorkingDir: "{tmp}"; Flags: runhidden 143 | 144 | [Code] 145 | #include "util.iss" 146 | #include "railsinstaller_gui.iss" 147 | 148 | function GetInstallDate(Param: String): String; 149 | begin 150 | Result := GetDateTimeString('yyyymmdd', #0 , #0); 151 | end; 152 | 153 | procedure CurStepChanged(const CurStep: TSetupStep); 154 | begin 155 | 156 | // TODO move into ssPostInstall just after install completes? 157 | if CurStep = ssInstall then 158 | begin 159 | if UsingWinNT then 160 | begin 161 | Log(Format('Selected Tasks - Path: %d', [PathChkBox.State])); 162 | 163 | if IsModifyPath then 164 | ModifyPath([ExpandConstant('{app}') + '\{#RubyPath}\bin']); 165 | ModifyPath([ExpandConstant('{app}') + '\Git\bin']); 166 | 167 | end else 168 | MsgBox('Looks like you''ve got on older, unsupported Windows version.' #13 + 169 | 'Proceeding with a reduced feature set installation.', 170 | mbInformation, MB_OK); 171 | end; 172 | end; 173 | 174 | procedure RegisterPreviousData(PreviousDataKey: Integer); 175 | begin 176 | {* store install choices so we can use during uninstall *} 177 | if IsModifyPath then 178 | SetPreviousData(PreviousDataKey, 'PathModified', 'yes'); 179 | 180 | SetPreviousData(PreviousDataKey, 'RailsInstallerId', '{#InstallerVersion}'); 181 | end; 182 | 183 | procedure CurUninstallStepChanged(const CurUninstallStep: TUninstallStep); 184 | begin 185 | if CurUninstallStep = usUninstall then 186 | begin 187 | if UsingWinNT then 188 | begin 189 | if GetPreviousData('PathModified', 'no') = 'yes' then 190 | begin 191 | ModifyPath([ExpandConstant('{app}') + '\{#RubyPath}\bin']); 192 | ModifyPath([ExpandConstant('{app}') + '\Git\bin']); 193 | end 194 | end; 195 | end; 196 | end; 197 | 198 | procedure UpdateDevKitConfig(RubyPath: string; FileName: string); 199 | var 200 | S: String; 201 | begin 202 | // Make YAML happy :-) 203 | S := ExpandConstant(RubyPath); 204 | StringChangeEx(S, '\', '/', True); 205 | 206 | // Update DevKit config.yml with the installation path 207 | SaveStringToFile(ExpandConstant(FileName), '- ' + S, False); 208 | end; 209 | -------------------------------------------------------------------------------- /resources/railsinstaller/railsinstaller_gui.iss: -------------------------------------------------------------------------------- 1 | // RubyInstaller Inno Setup GUI Customizations 2 | // 3 | // Copyright (c) 2009 Jon Maken 4 | // Revision: 11/23/2009 3:35:36 PM 5 | // License: MIT 6 | 7 | var 8 | PathChkBox, PathExtChkBox: TCheckBox; 9 | 10 | function IsAssociated(): Boolean; 11 | begin 12 | Result := PathExtChkBox.Checked; 13 | end; 14 | 15 | function IsModifyPath(): Boolean; 16 | begin 17 | Result := PathChkBox.Checked; 18 | end; 19 | 20 | procedure ParseSilentTasks(); 21 | var 22 | I, N: Integer; 23 | Param: String; 24 | Tasks: TStringList; 25 | begin 26 | {* parse command line args for silent install tasks *} 27 | for I := 0 to ParamCount do 28 | begin 29 | Param := AnsiUppercase(ParamStr(I)); 30 | if Pos('/TASKS', Param) <> 0 then 31 | begin 32 | Param := Trim(Copy(Param, Pos('=', Param) + 1, Length(Param))); 33 | try 34 | // TODO check for too many tasks to prevent overflow?? 35 | Tasks := StrToList(Param, ','); 36 | for N := 0 to Tasks.Count - 1 do 37 | case Trim(Tasks.Strings[N]) of 38 | 'MODPATH': PathChkBox.State := cbChecked; 39 | end; 40 | finally 41 | Tasks.Free; 42 | end; 43 | end; 44 | end; 45 | end; 46 | 47 | procedure URLText_OnClick(Sender: TObject); 48 | var 49 | ErrorCode: Integer; 50 | begin 51 | if Sender is TNewStaticText then 52 | ShellExec('open', TNewStaticText(Sender).Caption, '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode); 53 | end; 54 | 55 | procedure InitializeWizard; 56 | var 57 | Page: TWizardPage; 58 | HostPage: TNewNotebookPage; 59 | URLText, TmpLabel: TNewStaticText; 60 | begin 61 | 62 | {* Path and file association task check boxes *} 63 | 64 | Page := PageFromID(wpSelectDir); 65 | 66 | PathChkBox := TCheckBox.Create(Page); 67 | PathChkBox.Parent := Page.Surface; 68 | PathChkBox.State := cbChecked; 69 | PathChkBox.Caption := 'Add executables for Ruby and DevKit to the PATH '; 70 | PathChkBox.Alignment := taRightJustify; 71 | PathChkBox.Top := ScaleY(125); 72 | PathChkBox.Left := ScaleX(18); 73 | PathChkBox.Width := Page.SurfaceWidth; 74 | PathChkBox.Height := ScaleY(17); 75 | 76 | ParseSilentTasks; 77 | 78 | HostPage := WizardForm.FinishedPage; 79 | 80 | TmpLabel := TNewStaticText.Create(HostPage); 81 | TmpLabel.Parent := HostPage; 82 | TmpLabel.Top := ScaleY(180); 83 | TmpLabel.Left := ScaleX(176); 84 | TmpLabel.AutoSize := True; 85 | TmpLabel.Caption := 'Web Site:'; 86 | 87 | URLText := TNewStaticText.Create(HostPage); 88 | URLText.Parent := HostPage; 89 | URLText.Top := TmpLabel.Top; 90 | URLText.Left := TmpLabel.Left + TmpLabel.Width + ScaleX(4); 91 | URLText.AutoSize := True; 92 | URLText.Caption := 'http://railsinstaller.org/'; 93 | URLText.Cursor := crHand; 94 | URLText.Font.Color := clBlue; 95 | URLText.OnClick := @URLText_OnClick; 96 | 97 | TmpLabel := TNewStaticText.Create(HostPage); 98 | TmpLabel.Parent := HostPage; 99 | TmpLabel.Top := ScaleY(196); 100 | TmpLabel.Left := ScaleX(176); 101 | TmpLabel.AutoSize := True; 102 | TmpLabel.Caption := 'Mailing List:'; 103 | 104 | URLText := TNewStaticText.Create(HostPage); 105 | URLText.Parent := HostPage; 106 | URLText.Top := TmpLabel.Top; 107 | URLText.Left := TmpLabel.Left + TmpLabel.Width + ScaleX(4); 108 | URLText.AutoSize := True; 109 | URLText.Caption := 'http://groups.google.com/group/railsinstaller'; 110 | URLText.Cursor := crHand; 111 | URLText.Font.Color := clBlue; 112 | URLText.OnClick := @URLText_OnClick; 113 | 114 | TmpLabel := TNewStaticText.Create(HostPage); 115 | TmpLabel.Parent := HostPage; 116 | TmpLabel.Top := ScaleY(212); 117 | TmpLabel.Left := ScaleX(176); 118 | TmpLabel.AutoSize := True; 119 | TmpLabel.Caption := 'IRC:'; 120 | 121 | URLText := TNewStaticText.Create(HostPage); 122 | URLText.Parent := HostPage; 123 | URLText.Top := TmpLabel.Top; 124 | URLText.Left := TmpLabel.Left + TmpLabel.Width + ScaleX(4); 125 | URLText.AutoSize := True; 126 | URLText.Caption := 'http://wiki.github.com/wayneeseguin/railsinstaller'; 127 | URLText.Cursor := crHand; 128 | URLText.Font.Color := clBlue; 129 | URLText.OnClick := @URLText_OnClick; 130 | 131 | URLText := TNewStaticText.Create(HostPage); 132 | URLText.Parent := HostPage; 133 | URLText.Top := TmpLabel.Top; 134 | URLText.Left := TmpLabel.Left + TmpLabel.Width + ScaleX(4); 135 | URLText.AutoSize := True; 136 | URLText.Caption := 'http://webchat.freenode.net/?channels=railsinstaller'; 137 | URLText.Cursor := crHand; 138 | URLText.Font.Color := clBlue; 139 | URLText.OnClick := @URLText_OnClick; 140 | 141 | end; 142 | 143 | procedure CurPageChanged(CurPageID: Integer); 144 | begin 145 | if CurPageID = wpSelectDir then 146 | WizardForm.NextButton.Caption := '&Install'; 147 | end; 148 | 149 | -------------------------------------------------------------------------------- /resources/railsinstaller/setup_environment.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REM 4 | REM Environment setup file for RailsInstaller. 5 | REM 6 | 7 | REM 8 | REM First we determine where is RUBY_DIR (which is where this script is) 9 | REM 10 | PUSHD %~dp0. 11 | SET RUBY_DIR=%CD% 12 | POPD 13 | 14 | REM 15 | REM Now determine the RailsInstaller root directory (parent directory of Ruby) 16 | REM 17 | PUSHD %RUBY_DIR%\.. 18 | SET ROOT_DIR=%CD% 19 | POPD 20 | 21 | REM 22 | REM Add RUBY_DIR\bin to the PATH, DevKit\bin and then Git\cmd 23 | REM RUBY_DIR\bin takes higher priority to avoid other tools conflict 24 | REM 25 | SET PATH=%RUBY_DIR%\bin;%RUBY_DIR%\lib\ruby\gems\1.9.1\bin;%ROOT_DIR%\DevKit\bin;%PATH% 26 | IF EXIST %ROOT_DIR%\Git\cmd SET PATH=%ROOT_DIR%\Git\cmd;%PATH% 27 | SET RUBY_DIR= 28 | SET ROOT_DIR= 29 | 30 | REM 31 | REM Create the %HOMEDRIVE%\Sites directory. 32 | REM 33 | IF NOT EXIST %HOMEDRIVE%\Sites MD %HOMEDRIVE%\Sites 34 | 35 | REM 36 | REM Set the HOME environment variables for Ruby & Gems to use with ENV["HOME"] 37 | REM 38 | SET HOME=%HOMEDRIVE%%HOMEPATH% 39 | 40 | SET RailsInstallerPath=%1 41 | REM Check configurations for Git and SSH 42 | IF EXIST %RailsInstallerPath% ( 43 | ruby %RailsInstallerPath%\scripts\config_check.rb 44 | ) ELSE ( 45 | ruby.exe "require 'rbconfig' ; file=%%\#{RbConfig::}" 46 | ) 47 | 48 | REM NOTE that we start out in the Sites directory as the current working dir 49 | IF EXIST %HOMEDRIVE%\Sites CD %HOMEDRIVE%\Sites 50 | -------------------------------------------------------------------------------- /resources/railsinstaller/util.iss: -------------------------------------------------------------------------------- 1 | // Inno Setup utilities 2 | // 3 | // Copyright (c) 2009 Jon Maken 4 | // Revision: 11/03/2009 8:04:17 PM 5 | // License: MIT 6 | 7 | // forward declarations 8 | function MungePathish(const SrcList: TStringList; NewData: Array of String; RegValue: String; IsUninstalling: Boolean): Boolean; forward; 9 | procedure ModifyPathish(NewData: Array of String; RegValue, Delim: String); forward; 10 | function StrToList(const SrcString: String; Delim: String): TStringList; forward; 11 | function ListToStr(const SrcList: TStringList; Delim: String): String; forward; 12 | 13 | function IsAdmin(): Boolean; 14 | begin 15 | Result := IsAdminLoggedOn or IsPowerUserLoggedOn; 16 | end; 17 | 18 | function IsNotAdmin(): Boolean; 19 | begin 20 | Result := not (IsAdminLoggedOn or IsPowerUserLoggedOn); 21 | end; 22 | 23 | function GetUserHive(): Integer; 24 | begin 25 | if IsAdminLoggedOn or IsPowerUserLoggedOn then 26 | Result := HKLM 27 | else 28 | Result := HKCU; 29 | end; 30 | 31 | function GetEnvironmentKey(): String; 32 | begin 33 | if IsAdmin then 34 | Result := 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment' 35 | else 36 | Result := 'Environment'; 37 | end; 38 | 39 | procedure ModifyFileExts(Exts: Array of String); 40 | begin 41 | ModifyPathish(Exts, 'PATHEXT', ';'); 42 | end; 43 | 44 | procedure ModifyPath(Exts: Array of String); 45 | begin 46 | ModifyPathish(Exts, 'PATH', ';'); 47 | end; 48 | 49 | // Modifies path-like registry keys such as PATH, PATHEXT 50 | procedure ModifyPathish(NewData: Array of String; RegValue, Delim: String); 51 | var 52 | NeedRegChange: Boolean; 53 | RootKey: Integer; 54 | SubKey, OrigData, NewPathish, Tmp, TmpExpandable: String; 55 | PathishList: TStringList; 56 | begin 57 | RootKey := GetUserHive; 58 | SubKey := GetEnvironmentKey; 59 | 60 | try 61 | RegQueryStringValue(RootKey, SubKey, RegValue, OrigData); 62 | Log('Original ' + AnsiUppercase(RegValue) + ': ' + OrigData); 63 | 64 | // ensure originally empty users PATHEXT also contains system values 65 | if (RootKey = HKCU) and (AnsiUppercase(RegValue) = 'PATHEXT') and (OrigData = '') then 66 | begin 67 | Log('Empty HKCU ' + AnsiUppercase(RegValue) + ', prepending %PATHEXT% to new value'); 68 | OrigData := ('%' + RegValue + '%'); 69 | end; 70 | 71 | PathishList := StrToList(OrigData, Delim); 72 | 73 | NeedRegChange := MungePathish(PathishList, NewData, RegValue, IsUninstaller); 74 | 75 | if NeedRegChange then 76 | begin 77 | NewPathish := ListToStr(PathishList, ';'); 78 | 79 | case AnsiUppercase(RegValue) of 80 | 'PATH': RegWriteExpandStringValue(RootKey, SubKey, 'Path', NewPathish); 81 | 'PATHEXT': RegWriteExpandStringValue(RootKey, SubKey, 'PATHEXT', NewPathish); 82 | end; 83 | Log(AnsiUppercase(RegValue) + ' updated to: ' + NewPathish); 84 | 85 | // remove values if empty after uninstaller reverts its mods 86 | if IsUninstaller then 87 | begin 88 | if RegQueryStringValue(RootKey, SubKey, RegValue, Tmp) then 89 | begin 90 | // If the key is empty or expandable version (%RegValue%), remove it. 91 | TmpExpandable := '%' + RegValue + '%'; 92 | if (Tmp = '') or (Tmp = TmpExpandable) then 93 | begin 94 | RegDeleteValue(RootKey, SubKey, RegValue); 95 | Log('uninstaller deleted empty ' + AnsiUppercase(RegValue) + 96 | ' to match original config'); 97 | end; 98 | end; 99 | end; 100 | end else // no reg change needed 101 | Log('no changes need for ' + AnsiUppercase(RegValue)); 102 | finally 103 | PathishList.Free; 104 | end; 105 | end; 106 | 107 | function StrToList(const SrcString: String; Delim: String): TStringList; 108 | var 109 | PathList: TStringList; 110 | TmpPath: String; 111 | begin 112 | PathList := TStringList.Create; 113 | 114 | // empty PATH 115 | if Length(SrcString) = 0 then Result := PathList; 116 | 117 | if (Length(SrcString) > 0) then 118 | begin 119 | // single entry with no trailing ';' 120 | if Pos(Delim, SrcString) = 0 then 121 | begin 122 | PathList.Append(SrcString); 123 | 124 | Result := PathList; 125 | // single entry with trailing ';' 126 | // TODO address pathological case of multiple trailing ';' chars? 127 | end else if Pos(Delim, SrcString) = Length(SrcString) then 128 | begin 129 | TmpPath := SrcString; 130 | StringChangeEx(TmpPath, Delim, '', True); 131 | PathList.Append(TmpPath); 132 | 133 | Result := PathList; 134 | end else 135 | // multiple entries 136 | begin 137 | TmpPath := SrcString; 138 | // clean up a leading ';' pathological case if it exists 139 | if Pos(Delim, TmpPath) = 1 then TmpPath := Copy(TmpPath, 2, Length(TmpPath)); 140 | while (Pos(Delim, TmpPath) > 0) do 141 | begin 142 | PathList.Append(Copy(TmpPath, 1, Pos(Delim, TmpPath) - 1)); 143 | TmpPath := Copy(TmpPath, Pos(Delim, TmpPath) + 1, Length(TmpPath)); 144 | end; 145 | // add final remaining dir if not empty due to trailing ';' 146 | if Length(TmpPath) > 0 then PathList.Append(TmpPath); 147 | 148 | Result := PathList; 149 | end; 150 | end; 151 | end; 152 | 153 | function ListToStr(const SrcList: TStringList; Delim: String): String; 154 | var 155 | Path: String; 156 | I: Integer; 157 | begin 158 | for I := 0 to SrcList.Count - 1 do begin 159 | if Length(Path) = 0 then 160 | begin 161 | Path := SrcList[I]; 162 | Continue; 163 | end; 164 | Path := Path + Delim + SrcList[I]; 165 | end; 166 | 167 | Result := Path; 168 | end; 169 | 170 | function MungePathish(const SrcList: TStringList; NewData: Array of String; 171 | RegValue: String; IsUninstalling: Boolean): Boolean; 172 | var 173 | RootKey, I, N: Integer; 174 | Item: String; 175 | RegChangeFlag: Boolean; 176 | begin 177 | RegChangeFlag := False; 178 | RootKey := GetUserHive; 179 | 180 | for N := 0 to GetArrayLength(NewData) - 1 do 181 | begin 182 | Item := NewData[N]; 183 | if not IsUninstalling then // installing... 184 | begin 185 | // update PathishList ONLY if new item isn't already in the list 186 | // DO NOT ASSUME that the installer should duplicate entry or change order! 187 | if SrcList.IndexOf(Item) = -1 then 188 | begin 189 | case AnsiUppercase(RegValue) of 190 | 'PATH': SrcList.Insert(0, Item); 191 | 'PATHEXT': SrcList.Add(AnsiUppercase(Item)); 192 | end; 193 | RegChangeFlag := True; 194 | end else // already in existing config, no need for update; log it 195 | Log(Item + ' already on ' + AnsiUppercase(RegValue) + 196 | ' in original config; not modifying ' + AnsiUppercase(RegValue)); 197 | end else // uninstalling... 198 | begin 199 | I := SrcList.IndexOf(Item); 200 | if I <> -1 then // found on PathishList, delete it 201 | begin 202 | SrcList.Delete(I); 203 | RegChangeFlag := True; 204 | end; // not found on PathishList, no need for registry mod 205 | end; 206 | end; 207 | 208 | Result := RegChangeFlag; 209 | end; 210 | -------------------------------------------------------------------------------- /resources/railsinstaller/wizard-logo.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/railsinstaller/railsinstaller-windows/f99f083e11274f3a002a2a2861b2d63d17ea2af7/resources/railsinstaller/wizard-logo.bmp -------------------------------------------------------------------------------- /resources/scripts/config_check.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require "fileutils" 4 | 5 | Config = 6 | { 7 | :banner => "\n# Rails Environment Configuration.\n", 8 | :git_config_incomplete => "\nYour git configuration is incomplete.\nuser.name and user.email are required for properly using git and services such\nas GitHub (https://github.com/).\n", 9 | :git_name_prompt => "\n Please enter your name, for example mine is: Wayne E. Seguin\nname > ", 10 | :git_email_prompt => "\n Please enter your email address, for example mine is: wayneeseguin@gmail.com\nemail > ", 11 | :railsinstaller_path => File.dirname(File.dirname($0)), 12 | :home => File.join(ENV["HOMEDRIVE"], ENV["HOMEPATH"]), 13 | :ssh_path => File.join(ENV["HOMEDRIVE"], ENV["HOMEPATH"], ".ssh"), 14 | :ssh_key => File.join(ENV["HOMEDRIVE"], ENV["HOMEPATH"], ".ssh", "id_rsa"), 15 | :ssh_pub_key => File.join(ENV["HOMEDRIVE"], ENV["HOMEPATH"], ".ssh", "id_rsa.pub"), 16 | :ssh_keygen => File.join(File.dirname(File.dirname($0)), "Git", "bin", "ssh-keygen.exe"), 17 | :git => File.join(File.dirname(File.dirname($0)), "Git", "bin", "git.exe"), 18 | :cat => File.join(File.dirname(File.dirname($0)), "Git", "bin", "cat.exe") 19 | } 20 | 21 | @notes = [] 22 | 23 | # 24 | # Methods 25 | # 26 | def run(command) 27 | $stderr.puts "Running #{command}" if Config[:debug] 28 | %x{#{command}}.chomp 29 | end 30 | 31 | def generate_ssh_key 32 | run %Q{#{Config[:ssh_keygen]} -f "#{Config[:ssh_key]}" -t rsa -b 2048 -N "" -C "#{git_config("user.name")} <#{git_config("user.email")}>"} 33 | 34 | run %Q{clip < "#{Config[:ssh_pub_key]}"} 35 | 36 | @notes << "Your public ssh key (id_rsa.pub) has been automatically generated and copied to your clipboard." 37 | end 38 | 39 | def git_config(key) 40 | run %Q{#{Config[:git]} config --global #{key}} 41 | end 42 | 43 | # 44 | # Configuration 45 | # 46 | puts Config[:banner] 47 | 48 | ["name", "email"].each do |key| 49 | while git_config("user.#{key}").empty? 50 | if Config[:git_config_incomplete] 51 | puts Config[:git_config_incomplete] 52 | Config[:git_config_incomplete] = nil 53 | end 54 | 55 | printf "%s", Config["git_#{key}_prompt".to_sym] 56 | 57 | value = gets.chomp 58 | next if value.empty? 59 | puts "Setting user.#{key} to #{value}" 60 | run %Q{#{Config[:git]} config --global user.#{key} "#{value}"} 61 | end 62 | end 63 | 64 | FileUtils.mkdir_p(Config[:ssh_path]) unless File.exist? Config[:ssh_path] 65 | generate_ssh_key unless File.exist? Config[:ssh_key] 66 | 67 | # 68 | # Emit Summary 69 | # 70 | puts " 71 | --- 72 | git: 73 | user.name: #{git_config("user.name")} 74 | user.email: #{git_config("user.email")} 75 | version: #{run "git --version"} 76 | 77 | ruby: 78 | bin: #{File.join(Config[:railsinstaller_path], "Ruby2.3.3", "bin", "ruby.exe")} 79 | version: #{run "ruby -v"} 80 | 81 | rails: 82 | bin: #{File.join(Config[:railsinstaller_path], "Ruby2.3.3", "bin", "rails.bat")} 83 | version: #{run "rails -v"} 84 | 85 | ssh: 86 | public_key_location: #{Config[:ssh_pub_key]} 87 | public_key_contents: #{File.open(Config[:ssh_pub_key], "r") { |file| file.read }} 88 | 89 | #{@notes.empty? ? "" : "NOTES:\n\n #{@notes.join("\n ")}"} 90 | 91 | " 92 | 93 | exit 0 94 | -------------------------------------------------------------------------------- /resources/scripts/publickey.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | if exist "%HOMEDRIVE%%HOMEPATH%\.ssh\id_rsa.pub" ( 3 | clip < "%HOMEDRIVE%%HOMEPATH%\.ssh\id_rsa.pub" 4 | echo Your public ssh key has been copied to your clipboard. 5 | ) 6 | @echo on 7 | -------------------------------------------------------------------------------- /resources/scripts/setup_ssh.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | if not exist "%homedrive%%homepath%\.ssh" mkdir "%homedrive%%homepath%\.ssh" 3 | if not exist "%homedrive%%homepath%\.ssh\id_rsa.pub" c:\RailsInstaller\Git\bin\ssh-keygen.exe -f "%homedrive%%homepath%\.ssh\id_rsa" -t rsa -N "" 4 | @echo on 5 | -------------------------------------------------------------------------------- /resources/scripts/sshkey: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | pub_key_file = File.join(ENV["HOMEDRIVE"], ENV["HOMEPATH"], ".ssh", "id_rsa", "pub") 4 | 5 | ssh_pub_key = File.open(pub_key_file, 'r') { |file| file.read } 6 | 7 | %x{echo #{ssh_pub_key} | clip} 8 | -------------------------------------------------------------------------------- /resources/scripts/sshkey.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | IF NOT "%~f0" == "~f0" GOTO :WinNT 3 | @"ruby.exe" "C:/Projects/railsinstaller/stage/Ruby2.0.0/bin/sshkey" %1 %2 %3 %4 %5 %6 %7 %8 %9 4 | GOTO :EOF 5 | :WinNT 6 | @"ruby.exe" "%~dpn0" %* 7 | --------------------------------------------------------------------------------