master f99f083e1127 cached
33 files
62.5 KB
17.7k tokens
35 symbols
1 requests
Download .txt
Repository: railsinstaller/railsinstaller-windows
Branch: master
Commit: f99f083e1127
Files: 33
Total size: 62.5 KB

Directory structure:
gitextract_brru3rkp/

├── .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/
│   │   ├── actions.rb
│   │   ├── components.rb
│   │   ├── downloads.rb
│   │   └── methods.rb
│   ├── railsinstaller.rb
│   └── setup/
│       └── globals.rb
├── rake/
│   └── railsinstaller.rake
├── rakefile.rb
└── resources/
    ├── chm/
    │   ├── README
    │   ├── contents.hhc.rhtml
    │   ├── index.hhk.rhtml
    │   └── project.hhp.rhtml
    ├── railsinstaller/
    │   ├── LICENSE.txt
    │   ├── railsinstaller.iss
    │   ├── railsinstaller_gui.iss
    │   ├── setup_environment.bat
    │   └── util.iss
    └── scripts/
        ├── config_check.rb
        ├── publickey.bat
        ├── setup_ssh.bat
        ├── sshkey
        └── sshkey.bat

================================================
FILE CONTENTS
================================================

================================================
FILE: .gems
================================================
rubyzip
POpen4


================================================
FILE: .gitignore
================================================
*.exe
*.rbc
*.swp
*~
.idea/
archives/
pkg/
stage/


================================================
FILE: CHANGELOG.txt
================================================
3.2.0 - Ruby 2.2.4 

3.1.1 - Ruby 2.1.8, Rails 4.2.5, activerecord-sqlserver-adapter 4.2.6,
        coffee-rails 4.1.1, jquery-rails 4.1.0, sass-rails 5.0.4, Git 2.7.0,

3.1.0 - Ruby 2.1.5

3.0.0 - Ruby 2.0.0-p598, Rails 4.1.8, activerecord-sqlserver-adapter 4.1.0,
        coffee-rails 4.1.0, jquery-rails 3.1.2, sass-rails 4.0.5, sqlite 3.8.7.2,
        mysql-5.6.21.

2.2.4 - Rails 3.2.19, git 1.9.4, sqlite 3.8.6, mysql-5.6.20

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

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

2.2.0 - Updated main components to the latest version (Ruby 1.9.3-p362,
        Rails 3.2.11, git 1.8.0).
        Users can now exclude Git from the setup process (maybe it is already installed).

2.0.0 - Ruby 1.9.2-p290, Rails 3.1, Active Record SQLServer Adapter, TinyTDS,
        git 1.7.6, bundler 1.0.18.

1.1.0 - Automatic help for user git configuration on console start.
        Automatic ssh key configuration on console start.
        Configuration summary output on console start.
        git-bash shortcut is now added to the RailsInstaller start menu group.

1.0.5 - Ruby Updating to 1.8.7-p334 for released Security Updates.

1.0.4 - Moved Sites location back to %HOMEDRIVE%\Sites

1.0.3 - Installer now throws an error on rake package if Inno Setup 5 not found
        Added Ruby gem bin directory to the path in setup_environment.bat
        Added creation of Sites directory in the users home instead of root

1.0.2 - Include both sqlite3 and older sqlite3-ruby (which rails 3.0.3 likes best to date)

1.0.1 - Added rb-readline and a few other bundled gems.

1.0.0 - Initial Release, same features as 0.0.3

0.0.3 - Many bugfixes and minor tweaks.
        DevKit Integration Fix.
        RailsInstaller Wizard Images.

0.0.2 - Wizard Screen and functionality tweaks.
        Added sample Rails3 application in a directory for application projects.
        Tweaked git config to always convert CRLF to LF.

0.0.1 - Initial build and package tasks functional, includes Ruby 1.8.7, Git
        DevKit and Sqlite3.

0.0.0 - Initial repository created with configuration and directory outline.
        No functionality at this point.


================================================
FILE: CONTRIBUTORS.txt
================================================
# CONTRIBUTORS
#
# This file tries to detail all the developers, users and 3rd parties
# that contributed to materialize this project
#
# Please feel free to add yourself or details, but keep the file in
# as YAML formatted document. Thank you.

---
- Wayne E. Seguin
  :email: wayneeseguin+railsinstaller@gmail.com
  :website: http://rvm.beginrescueend.com/

- Luis Lavena
  :email: luislavena+railsinstaller@gmail.com
  :website: http://blog.mmediasys.com/

- Ruby Installer Team and Contributors
  :website: http://rubyinstaller.org/about/contributors

- Gerlando Piro
  :email: gpiro@engineyard.com
  :contribution: Graphics work for the install wizard.


================================================
FILE: LICENCE.txt
================================================
Copyright (c) 2010-2017 RailsInstaller Team.
All rights reserved. See CONTRIBUTORS.txt for complete list.

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:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

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.


================================================
FILE: README.md
================================================
# RailsInstaller

Rails development environment installer for Windows. This is attempt to get the installer to work agian. 4.0.0-alpha Pre-release now available
check out Install Ruby On Rails on Windows or [Releases](https://github.com/railsinstaller/railsinstaller-windows/releases) to downlaod.

## Overview

The goal of this project is to generate an installer that when run installs all
of the most common components for a Rails development environment with no
required prerequisites on a Windows system.

## Install Ruby On Rails on Windows
Currently RailsInstaller does not include everything to get rails to work on Windows. Slowly each part will get added back in, but for 
now you will need to follow instructions below to get rails installed.

1. Download and install 
[Git](https://github.com/git-for-windows/git/releases/download/v2.38.0.windows.1/Git-2.38.0-64-bit.exe).

2. Download and install 
[Nodejs](https://nodejs.org/dist/v16.17.1/node-v16.17.1-x64.msi).

3. Download and install
[Yarn](https://classic.yarnpkg.com/latest.msi).

4. Download and install 
[RailsInstaller](https://github.com/railsinstaller/railsinstaller-windows/releases/download/v4.0.0-alpha/railsinstaller-4.0.0.exe).

# Need Help, Bugs or Questions
Please come over to the Discord server [Click Here for invite](https://discord.gg/QeRYNGXHuu) 

# RailsInstaller Components

The next few sections detail the core components that make up RailsInstaller.

### Ruby 3.1.2 on Windows

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.

### Development Kit (DevKit)

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.

### Packaging/Installer

We are using [Inno Setup](http://www.jrsoftware.org/isinfo.php "Inno Setup"), a free installer for Windows programs.

## How to Contribute

The information below is out of date and will be updated soon.

RailsInstaller project code repository is located on GitHub and is bootstrapped,
built and packaged via rake tasks.

1. Download and install the latest
   [RailsInstaller](http://railsinstaller.org/).

1. Download and install latest
   [Inno Setup Quick Start Pack](http://www.jrsoftware.org/isdl.php#qsp),
   add iscc.exe in your PATH
    ```
    C:\Program Files (x86)\Inno Setup 6\ISCC.exe 
    ```
1. [Fork](https://help.github.com/articles/fork-a-repo)
   the [RailsInstaller project on github](https://github.com/railsinstaller/railsinstaller-windows.git)
   into your own GitHub account.

1. Open the the command prompt from the start menu and change directory to where you like to keep your projects.

1. Clone your fork of the project.

    ```bash
    git clone https://github.com/{{your GitHub user name}}/railsinstaller-windows.git
    cd railsinstaller-windows
    ```

1. Update from origin master branch and checkout a new topic branch for your feature/bugfix.

    ```bash
    git checkout master
    git pull origin master
    git checkout -b mybranchname
    ```

1. Bootstrap the project. From the project root run:

    ```bash
    rake bootstrap
    ```

1. Implement your new feature and/or fix your bug in your newly forked Railsinstaller project code.

  * The configuration file for specifying required packages can be found at config/railsinstaller.yml.

  * 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.

  * Methods called by the actions.rb file are implemented by lib/railsinstaller/methods.rb.

1. Next build all components onto the stage (into the stage/ directory)

    ```bash
    rake build
    ```

1. Use Inno Setup to package the installer into an executable (.exe) for testing/distribution.

    Add iscc.exe in your PATH
    ```
    C:\Program Files (x86)\Inno Setup 6\ISCC.exe 
    rake package
    ```

  * This creates the executable (.exe) package file in the pkg/ directory from the files staged during the build process in the stage/ directory.

  * 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).

1. Once you have verified your new feature/bug-fix, push your branch up to GitHub.

    ```bash
    git commit -a -m "Implemented featureX/bugfixX which <description>..."
    git push origin mybranchname
    ```

1. Now issue a [pull request](https://help.github.com/articles/using-pull-requests) on GitHub.


================================================
FILE: TEAM.txt
================================================
Luis Lavena (luislavena+railsinstaller@gmail.com)
Wayne E. Seguin (wayneeseguin+railsinstaller@gmail.com)


================================================
FILE: VERSION.txt
================================================
4.0.1


================================================
FILE: config/railsinstaller.yml
================================================
---
:gems:
  :name: Gems
  :title: Ruby Gems
  :category: gems
  :list:
    -
      :name: rails
      :version: "7.1.2"

:ruby322:
  :category: component
  :title: Ruby 3.2.2
  :name: Ruby322
  :regex: '^.*$'
  :url: "https://github.com/robertmabbs/railsinstaller-rubydevkit/releases/download/rubyinstaller-devkit-3.2.2-1-x64/rubyinstaller-devkit-3.2.2-1-x64.7z"
  :rename: Ruby3.2.2
  
:bsdtar:
  :name: BSDTar
  :title: Basic BSDTar
  :category: utility
  :target: bin
  :binary: "basic-bsdtar.exe"
  :regex: '^basic-bsdtar.exe$'
  :url: "http://downloads.sourceforge.net/mingw/basic-bsdtar-2.8.3-1-mingw32-bin.zip"

:sevenzip:
  :name: SevenZip
  :title: 7Zip
  :category: utility
  :target: bin
  :binary: "7za.exe"
  :regex: '^7za\.exe$'
  :url: "http://downloads.sourceforge.net/project/sevenzip/7-Zip/9.20/7za920.zip"
  
:git:
  :category: component
  :title: Git 2.38.1
  :name: Git
  :url: "https://github.com/robertmabbs/railsinstaller-git/releases/download/2.38.1/PortableGit.zip"
  :target: "Git"
  :regex: '^.*$'


================================================
FILE: docs/notes.txt
================================================
MSYS is "Minimal System", is some sort of Cygwin set of libraries (but
is not cygwin) that only exist to provide support for native
compilation of libraries and tools under MinGW (GCC)

For example, it provides perl and other components that make it easy
to compile things like OpenSSL. Also provides a native bash that
translates Windows paths (C:\Foo\Bar) into /c/Foo/Bar, making them
compatible with cygwin-like make, used to compile stuff.

MSYS is the complement of MinGW. Both together form DevKit.

Inside DevKit you will notice a bin folder, and inside will find
bash, sh and other scripts, then at the same level of 'bin' will find
a 'mingw' folder that contains GCC and the Windows headers, used to
compile.

Both bin and mingw/bin folders needs to be added to the PATH so things
like this can work:

sh -c "autoconf"
mkdir build
cd build
sh ../configure ...
make

We use DevKit build recipes and provide them to the
users as SFX (work on installer has been put on hold for now)

You can read more about the steps to install it here:

https://github.com/oneclick/rubyinstaller/wiki/Development-Kit

================================================================================


On Wed, Dec 29, 2010 at 6:14 PM, Wayne E. Seguin <wayneeseguin@gmail.com> wrote:
> Would you be able to walk me through an overview of how RubyInstaller works
> from the developers perspective?
>
> Meaning things like:
> * The workflow (Install Ruby and DevKit, then run 'rake ...' )

To hack on RubyInstaller you only need a previous version of Ruby
installed, nothing else.

DevKit is downloaded by "rake devkit" and is part of the dependency
change of building "rake ruby18" or "rake rub19"

> * The code flow (Starts with the rake call, runs ....)

git clone ...
cd rubyinstaller
rake ruby18 #=> results in all the libraries compiled and Ruby 1.8.7
build in sandbox/ruby18_mingw
rake ruby19 #=> only builds libraries that 1.9.2 depends on and put
the compiled output at sandbox/ruby19_mingw

Then, you need:

gem install rdoc -v "~> 2.5.11"
gem install rdoc_chm

Also, install (in your computer) InnoSetup QuickStart Pack, unicode:

http://www.jrsoftware.org/isdl.php#qsp

When installed, ensure ISPP (pre-processor) is checked for installation.

Once you're done with that, you can:

rake ruby18:package

Which will generate the rdoc (CHM) and will package the InnoSetup script.

same for ruby19:package

These tasks don't get added until you don't compile Ruby ;-)

> I have some code ready to start playing with however I am unsure how you
> would do the packaging and running, etc on windows.

I think I covered all the steps above, for sure rake tasks can be
cleaned to make it more clear the dependencies :-)

Hope that helps,


================================================
FILE: lib/extensions/stdlib.rb
================================================
class String
  # Converts a lower case and underscored string to UpperCamelCase.
  #
  # Examples:
  #   "ruby_build_path".camelcase   # => "RubyBuildPath"
  def camelcase
    self.gsub(/(?:\A|_)(.)/) { $1.upcase }
  end
end


================================================
FILE: lib/railsinstaller/actions.rb
================================================
module RailsInstaller

  def self.build!
  
  components = [
    BSDTar, SevenZip, Git, Ruby322
    ]

    components.each do |package|
      section  package.title
      download package.url
      extract  package
    end
    
    # this needs to be done as temp fix to bypass the tzdata error when installing rails
    #stage_gem_update
    
    # stage_sqlite

    # link_devkit_with_ruby

   # stage_git

    # stage_postgresql

    # stage_todo_application

    stage_gems

    # fix_batch_files

    # stage_setup_scripts

    # stage_msvc_runtime
  end

  #
  # package()
  #
  # Packages a binary installer release version together as a
  # self contained installer using Inno Setup scripting.
  #
  def self.package!

    unless %x{iscc}.scan("Inno Setup 6")
      printf "ERROR: Inno Setup is required in order to package RailsInstaller.\n"
      printf "  http://www.jrsoftware.org/isdl.php#qsp\n"
      printf "Please see README.md for full RailsInstaller instructions.\n"
      exit 1
    end

    railsinstaller_version = File.read(File.join(RailsInstaller::Root, "VERSION.txt")).chomp

    printf "\nPackaging... this *will* take a while...\n"

    # iscc "\"#{File.join(RailsInstaller::Root, "resources", "railsinstaller", "railsinstaller.iss")}\"",
    #       "/dInstallerVersion=#{railsinstaller_version}",
    #       "/dStagePath=\"#{RailsInstaller::Stage}\"",
    #       "/dRubyPath=\"#{RailsInstaller::Ruby233.rename}\"",
    #       "/dResourcesPath=\"#{File.join(RailsInstaller::Root, "resources")}\"",
    #       "/o\"#{RailsInstaller::PackageDir}\"",
    #       "/frailsinstaller-#{railsinstaller_version}"
    
      iscc " \"#{File.join(RailsInstaller::Root, "resources", "railsinstaller", "railsinstaller.iss")}\"",
        "/DInstallerVersion=\"#{railsinstaller_version}\"",
        "/DStagePath=\"#{RailsInstaller::Stage}\"",
        "/DRubyPath=\"#{RailsInstaller::Ruby322.rename}\"",
        "/DResourcesPath=\"#{File.join(RailsInstaller::Root, "resources")}\"",
        "/O\"#{RailsInstaller::PackageDir}\"",
        "/Frailsinstaller-#{railsinstaller_version}"

  end

end


================================================
FILE: lib/railsinstaller/components.rb
================================================
module RailsInstaller
  #
  # Load initial objects (OpenStruct) from railsinstaller.yml
  #
  @@config = YAML.load(
    ERB.new(
      File.read(
        File.join(Root, "config", "railsinstaller.yml")
      )
    ).result(binding)
  )

  @@config.each_pair do |key, value|
    const_set(value[:name], OpenStruct.new(value))
  end
end


================================================
FILE: lib/railsinstaller/downloads.rb
================================================
module RailsInstaller

  require "net/https"
  require "tempfile"

  # Original download() code taken from Rubinius and then butchered ;)
  # https://github.com/evanphx/rubinius/blob/master/configure#L307-350
  def self.download(url, filename = nil, count = 3)
   filename ||= File.basename(url)

   return if File.exists?(File.join(RailsInstaller::Archives, filename))

   begin

      if ENV["http_proxy"]
        protocol, userinfo, host, port = URI::split(ENV["http_proxy"])
        proxy_user, proxy_pass = userinfo.split(/:/) if userinfo
        http = Net::HTTP::Proxy(host, port, proxy_user, proxy_pass)
      else
        http = Net::HTTP
      end

      uri = URI.parse(url)

      print "Downloading from #{url} to #{RailsInstaller::Archives}/#{filename}\n" if $Flags[:verbose]
      http.get_response(uri) do |response|

        case response
          when Net::HTTPNotFound

            raise NET::HTTPNotFound, "Looking for #{url} and received a 404!"
            return false

          when Net::HTTPClientError
            print "ERROR: Client Error : #{response.inspect}\n"
            return false

          when Net::HTTPRedirection
            raise "Too many redirections for the original url, halting." if count <= 0
            print "Redirected to #{response["Location"]}\n" if $Flags[:verbose]
            url = response["location"]
            return download(url, filename, count - 1)

          when Net::HTTPOK
            temp_file = Tempfile.new("download-#{filename}")
            temp_file.binmode

            size  = 0
            total = response.header["Content-Length"].to_i

            # Ensure that the destination directory exists.
            unless File.directory?(RailsInstaller::Archives)
              FileUtils.mkdir_p(RailsInstaller::Archives)
            end

            if File.exist?(File.join(RailsInstaller::Archives, filename))
              FileUtils.rm_f(File.join(RailsInstaller::Archives, filename))
            end

            Dir.chdir(RailsInstaller::Archives) do
              # See https://github.com/oneclick/rubyinstaller/blob/master/rake/contrib/uri_ext.rb#L234-276
              # for another alternative to this.
              response.read_body do |chunk|
                temp_file << chunk
                size += chunk.size
                print "\r  => %d%% (%d of %d) " % [(size * 100) / total, size, total]
              end

              temp_file.close
              FileUtils.mv(
                temp_file.path,
                File.join(RailsInstaller::Archives, filename),
                :force => true
              )

              print "\n\n"
            end
          else
            raise RuntimeError, "Failed to download #{url}: #{response.message}"
        end
      end

   rescue Exception => exception
      if File.exists?(File.join(RailsInstaller::Archives, filename))
        File.unlink(File.join(RailsInstaller::Archives, filename))
      end
      printf "ERROR: #{exception.message}\n"
      return false
    end
    return true
  end
end


================================================
FILE: lib/railsinstaller/methods.rb
================================================
module RailsInstaller

  #
  # unzip:
  # Requires: rubyzip (gem install rubyzip) # require "zip/zip"
  #
  def self.unzip(package)
    filename  = File.basename(package.url)
    base_path = File.dirname(filename)

    if package.target.nil?
      target_path = base_path
    else
      target_path = File.join(base_path, package.target)
    end
    regex = Regexp.new(package.regex) unless package.regex.nil?
    files = []

    printf " => Extracting #{filename}\n"

    Dir.chdir(RailsInstaller::Archives) do
      archive = File.join(RailsInstaller::Archives, filename)

      Zip::File.open(archive) do |zipfile|
        printf "zipfile: #{zipfile.inspect}\n" if $Flags[:verbose]

        if regex
          entries = zipfile.entries.select do |entry|
            entry.name.match(regex)
          end
        else
          entries = zipfile.entries
        end

        FileUtils.mkdir_p(File.join(RailsInstaller::Stage, "bin"))

        entries.each do |entry|
          printf "DEBUG: Extracting #{entry.name}\n" if $Flags[:verbose]
          files << entry.name
          if File.exists?(entry.name)
            FileUtils.rm_f(entry.name)
          end
          zipfile.extract(entry, entry.name)

          if File.exist?(File.join(RailsInstaller::Archives, entry.name))
            FileUtils.mv(
              File.join(RailsInstaller::Archives, entry.name),
              File.join(RailsInstaller::Stage, "bin", entry.name),
              :force => true
            )
          end
        end
      end
    end
    files
  end

  #
  # extract
  #
  # Used to extract a non-zip file using BSDTar
  #
  def self.extract(package)
    Dir.chdir(RailsInstaller::Archives) do
      filename = File.basename(package.url)

      unless File.exists?(filename)
        raise "ERROR: #{filename} does not exist, did the download step fail?"
      end

      if package.target.nil?
        target_path = RailsInstaller::Stage
      else
        target_path = File.join(RailsInstaller::Stage, package.target)
      end
      bsdtar   = File.join(RailsInstaller::Stage, "bin", RailsInstaller::BSDTar.binary)
      sevenzip = File.join(RailsInstaller::Stage, "bin", RailsInstaller::SevenZip.binary)

      if package.category == "utility" &&
        File.exist?(File.join(RailsInstaller::Stage, "bin", package.binary))
        printf "#{package.name} already on stage.\n"
        return
      end

      printf " => Extracting #{filename} to the stage.\n" if $Flags[:verbose]

      FileUtils.mkdir_p(RailsInstaller::Stage) unless File.directory?(RailsInstaller::Stage)

      case package.category
        when "utility" # Remove target file, if exists.
          target = File.join(RailsInstaller::Stage, "bin", package.binary)
          if File.exists?(target)
            printf "#{target} on stage.\n"
            return
          end
          FileUtils.rm_f(target) if File.exist?(target)
        when "component" # Remove target dir if it exists and is different than the stage
          if (File.directory?(target_path) && target_path != RailsInstaller::Stage)
            FileUtils.rm_rf(target_path)
          end
        else
        raise "Unknown package category"#{package.category}".\npackage category should be one of {"utility","component"}?"
      end

      archive = File.join(RailsInstaller::Archives, filename)

      Dir.chdir(RailsInstaller::Stage) do
          case filename
            when /(^.+\.tar)\.z$/, /(^.+\.tar)\.gz$/, /(^.+\.tar)\.bz2$/, /(^.+\.tar)\.lzma$/, /(^.+)\.tgz$/
              line = %Q("#{bsdtar}" -xf "#{archive}")
            when /^.+\.7z$/
              line = %Q("#{sevenzip}" x -y -t7z -o#{target_path} "#{archive}")
            when /^.+sfx\.exe$/
              line = %Q("#{sevenzip}" x -y -t7z -sfx -o#{target_path} #{archive})
            when /(^.+\.zip$)/
              if File.exist?(sevenzip) # Use bsdtar once we already have it
              line = %Q("#{sevenzip}" x -y -o#{target_path} #{archive})
            else
              return unzip(package) # For the unzip case we can return a list of extracted files.
            end
          else
            raise "\nERROR:\n  Cannot extract #{archive}, unhandled file extension!\n"
        end

        sh(line)

        if package.rename
          case package.category
            when "component"
              Dir.chdir(RailsInstaller::Stage) do
                if File.exist?(package.rename)
                  FileUtils.rm_rf(package.rename)
                end

                source = File.basename(package.url, File.extname(package.url))
                printf "DEBUG: source: %s\ntarget: %s\n", source, package.rename if $Flags[:verbose]
                FileUtils.mv(
                  File.basename(package.url, File.extname(package.url)),
                  package.rename
                )
              end
          end
        end
      end
    end
  end

  #
  # install_utility()
  #
  # Requires: open-uri
  #
  def self.install_utility

    # TODO: Merge this into download, simply check if object has a .binary attribute.
    if File.exists?(File.join(RailsInstaller::Stage, "bin", binary))
      printf "#{File.join(RailsInstaller::Stage, "bin", binary)} exists.\nSkipping download, extract and install.\n"
    else
      printf " => Downloading and extracting #{binary} from #{utility.url}\n"

      FileUtils.mkdir_p(RailsInstaller::Stage) unless File.directory?(RailsInstaller::Stage)

      Dir.chdir(RailsInstaller::Stage) do
        filename = File.basename(utility.url)
        FileUtils.rm_f(filename) if File.exist?(filename)
        # Utilities are small executables, thus using open-uri to download them is fine.
        open(utility.url) do |temporary_file|
          File.open(filename, "wb") do |file|
            file.write(temporary_file.read)
          end
        end

        extract(binary)

        printf " => Installing #{binary} to #{File.join(RailsInstaller::Stage, "bin")}\n"

        FileUtils.mkdir_p(RailsInstaller::Stage, "bin") unless File.directory?(RailsInstaller::Stage, "bin")

        FileUtils.mv(
          File.join(RailsInstaller::Stage, binary),
          File.join(RailsInstaller::Stage, "bin", binary),
          :force => true
        )
      end
    end
  end

  #
  # Copy required Sqlite3 files on to the stage
  #
  def self.stage_sqlite
    Sqlite3.files.each do |file|
      if File.exist?(File.join(Stage, file))
        FileUtils.mv(
          File.join(Stage, file),
          File.join(Stage, Ruby233.rename, "bin", file)
        )
      end
    end
  end

  #
  # Copy required Postgresql files on to the stage
  #
  def self.stage_postgresql
    PostgresServer.files.each do |file|
      if File.exist?(File.join(Stage, file))
        FileUtils.cp(
          File.join(Stage, PostgresServer.target, "bin", file),
          File.join(Stage, Ruby233.rename, "bin", file)
        )
      end
    end
  end

  #
  # Add functionality to DevKit object that was loaded during configure.
  #
  def self.link_devkit_with_ruby
    devkit_path = File.join(Stage, DevKit.target)
    ruby_path = File.join(Stage, Ruby233.rename)
    FileUtils.mkdir_p(devkit_path) unless File.directory?(devkit_path)
    Dir.chdir(devkit_path) do
      File.open("config.yml", "w") do |file|
        file.write(%Q(---\n- #{ruby_path}))
      end
      sh %Q{#{File.join(ruby_path, "bin", "ruby")} dk.rb install}
    end
  end

  def self.stage_git
    # TODO: adjust git config for CRLF => LF autoadjust.
    gitconfig = File.join(Stage, Git.target, "etc", "gitconfig")
    config = File.read(gitconfig)
    File.open(gitconfig, "w") do |config_file|
      config_file.write(config.gsub(/autocrlf = true/, "autocrlf = false"))
    end
  end
  
  def self.stage_gem_update  
  ruby_path = File.join(Stage, Ruby322.rename)
  
  line = %Q(#{File.join(ruby_path, "bin", "gem")} update )
  sh line
  end

  def self.stage_gems
    section Gems
    build_gems(File.join(Stage, Ruby322.rename), Gems.list)
  end

  def self.fix_batch_files
    ruby_path = File.join(Stage, Ruby233.rename)
    bin_path = File.join(ruby_path, "bin/")
	  filenames = Dir.glob("#{bin_path}*.bat")
	  filenames.each do |filename|
		  text = File.read(filename)
		  fixed = text.gsub(/#{bin_path}/, '')
		  other_bin_path = bin_path.gsub(/\//, '\\\\\\\\')
		  fixed = fixed.gsub(/#{other_bin_path}/, '')
		  File.open(filename, "w") { |file|
			  file.write fixed
		  }
	  end
  end

  def self.stage_todo_application
    section RailsTodo
    todo_path = File.join(Stage, "Sites", "todo")
    FileUtils.rm_rf(todo_path) if File.exist?(todo_path)

    git_binary = File.join(Stage, Git.target, "bin", "git")

    line = %Q(#{git_binary} clone -b railsinstaller https://github.com/engineyard/todo todo)

    applications_path = File.join(RailsInstaller::Stage, "Sites")
    FileUtils.mkdir_p applications_path unless File.exist?(applications_path)
    Dir.chdir(applications_path) { sh line }
    # now bootstrap gems...

    if File.exist?(File.join(todo_path, ".git"))
      FileUtils.rm_rf(File.join(todo_path, ".git"))
    end

    gem_install File.join(Stage, Ruby233.rename), "bundler", :version => "1.15.3"

    ruby_binary("bundle", "install", "", File.join(Stage, Ruby233.rename), File.join(applications_path, "todo"))
  end

  def self.stage_rails_sample_application
    # Generate sample rails application in the Rails application directory on
    # stage.
    section Rails
    sample = File.join(Stage, "Sites", "sample")
    FileUtils.rm_rf(sample) if File.exist?(sample)
    ruby_binary("rails", "new", "sample", File.join(Stage, Ruby233.rename))
  end

  # Renders setup scripts to be used post-installation
  # They have installation-sensitive information (installation path)
  def self.stage_setup_scripts
    section Scripts
    scripts_path = File.join(RailsInstaller::Stage, "scripts")
    FileUtils.mkdir_p(scripts_path) unless File.exist?(scripts_path)

    %w( config_check.rb ).each do |file|
      FileUtils.cp(
        File.join(RailsInstaller::Scripts, file),
        File.join(scripts_path, file)
      )
    end

    %w( publickey.bat ).each do |file|
      FileUtils.cp(
        File.join(RailsInstaller::Scripts, file),
        File.join(Stage, Ruby233.rename, "bin", file)
      )
    end
  end

  # MSVC Runtime 2008 is Required for Postgresql Server
  def self.stage_msvc_runtime
    download(MsvcRuntime.url)
    pkg_path = File.join(RailsInstaller::Stage, "pkg")

    FileUtils.mkdir_p(pkg_path) unless File.exist?(pkg_path)

    FileUtils.cp(
      File.join(RailsInstaller::Archives, File.basename(MsvcRuntime.url)),
      File.join(pkg_path, File.basename(MsvcRuntime.url))
    )
  end

  #
  # build_gems
  #
  # loops over each gemname and triggers it to be built.
  def self.build_gems(ruby_path, gems)
    if gems.is_a?(Array)
      gems.each do |name|
        build_gem(ruby_path, name)
      end
    elsif gems.is_a?(Hash)
      gems.each_pair do |name, version |
        build_gem(ruby_path, name, version)
      end
    else
      build_gem(ruby_path, gems)
    end
  end

  def self.build_gem(ruby_path, gem, options = {})
    if gem.is_a?(Hash)
      options[:version] = gem[:version]
      gem_install(ruby_path,gem[:name], options)
    else
      gem_install(ruby_path,gem, options)
    end
  end

  def self.gem_install(ruby_path, gem,options = {})
    printf " => Staging gem #{gem}\n" if $Flags[:verbose]
    %w(GEM_HOME GEM_PATH).each { |variable| ENV.delete(variable)}
    line = %Q(#{File.join(ruby_path, "bin", "gem")} install #{gem} )
    line << %Q( -v "#{options[:version]}" ) if options[:version]
    #line << %Q( --env-shebang --no-rdoc --no-ri --source http://rubygems.org )
    line << options[:args] if options[:args]
    sh line
  end

  def self.ruby_binary(name, line, action, ruby_path, directory_path, options = {})
    printf " => rails #{line} #{action}\n" if $Flags[:verbose]
    %w(GEM_HOME GEM_PATH).each { |variable| ENV.delete(variable)}
    line = %Q(#{File.join(ruby_path, "bin", "ruby")} -S #{name} #{line} #{action})
    line += options[:args] if options[:args]
    Dir.chdir(directory_path) { sh line }
  end

  def self.iscc(*params)
    executable = nil

    # look for Inno Setup compiler in the PATH
    found = ENV["PATH"].split(File::PATH_SEPARATOR).find do |path|
      File.exist?(File.join(path, "ISCC.exe")) && File.executable?(File.join(path, "ISCC.exe"))
    end

    # not found?
    if found
      executable = "ISCC.exe"
    else
      path = File.join(ENV["ProgramFiles"], "Inno Setup 6")
      if File.exist?(File.join(path, "ISCC.exe")) && File.executable?(File.join(path, "ISCC.exe"))
        path.gsub!(File::SEPARATOR, File::ALT_SEPARATOR)
        ENV["PATH"] = "#{path}#{File::PATH_SEPARATOR}#{ENV["PATH"]}" unless ENV["PATH"].include?(path)
        executable = "ISCC.exe"
      end
    end
    cmd = [executable]
    cmd.concat(params)
    sh cmd.join(" ")
  end

  #
  # sh
  #
  # Runs Shell lines, single point of shell contact.
  #
  def self.sh(line, options = {})
    stage_bin_path = File.join(RailsInstaller::Stage, "bin")
    ENV["PATH"] = "#{stage_bin_path};#{ENV["PATH"]}" unless ENV["PATH"].include?(stage_bin_path)

    printf "\nDEBUG: > %s\n\n", line if $Flags[:verbose]

    output, status = Open3.capture2e(line)
    puts output.read unless output.empty?  if $Flags[:versbose]
  end

  def self.log(text)
    printf %Q[#{text}\n]
  end

  def self.section(text)
    printf %Q{\n== #{text}\n\n}
  end
end


================================================
FILE: lib/railsinstaller.rb
================================================
module RailsInstaller # Ensure that the RailsInstaller project root is defined.
  Root       = File.expand_path(File.join(File.dirname(__FILE__), ".."))
  Stage      = File.expand_path(File.join(Root, "stage"))
  Archives   = File.expand_path(File.join(Root, "archives"))
  Scripts    = File.expand_path(File.join(Root, "resources/scripts"))
  PackageDir = File.expand_path(File.join(Root, "pkg"))
end

%w[ rubygems fileutils ostruct yaml erb uri open-uri open3 zip ].each do |name|
  printf "Loading #{name}...\n" if $Flags[:verbose]
  require name
end

gem "rubyzip"

%w[ globals ].each do |name|
  printf "Loading #{name}...\n" if $Flags[:verbose]
  require File.expand_path(File.join(RailsInstaller::Root, "lib", "setup", name + '.rb'))
end

%w[ stdlib ].each do |name|
  printf "Loading #{name}...\n" if $Flags[:verbose]
  require File.expand_path(File.join(RailsInstaller::Root, "lib", "extensions", name + '.rb'))
end

%w[ components methods downloads actions ].each do |name|
  printf "Loading #{name}...\n" if $Flags[:verbose]
  require File.expand_path(File.join(RailsInstaller::Root, "lib", "railsinstaller", name + '.rb'))
end


================================================
FILE: lib/setup/globals.rb
================================================
$Flags ||= { :verbose => false }


================================================
FILE: rake/railsinstaller.rake
================================================
task :default do
  printf "\nRailsInstaller Rake Tasks:

  {bootstrap, build, package}

See README.md for more details.\n\n"
end

task :require_railsinstaller do

  require "railsinstaller"

end

desc "Bootstrap RailsInstaller development environment (gems)"
task :bootstrap do

  require "rubygems/dependency_installer"

  gems = File.read(File.join(ProjectRoot, ".gems")).gsub(" -v", ' ').split("\n")

  gems.each do |gem|

    printf "Ensuring #{gem} is installed...\n"

    name, version, options = gem.split(/\s+/)

    installer = Gem::DependencyInstaller.new(
      { :generate_rdoc => false, :generate_ri => false }
    )

    version ? installer.install(name, version) : installer.install(name)

  end

  printf "Bootstrapped.\nDo not forget to download and install Inno Setup, see README.md for more information.\n"

end

desc "Download and build all components and dependencies into stage/."
task :build => [ :require_railsinstaller ] do

  RailsInstaller.build!

end

desc "Package all components into a single executable installer into pkg/."
task :package => [ :require_railsinstaller ] do

  RailsInstaller.package!

end


================================================
FILE: rakefile.rb
================================================
#!/usr/bin/env ruby

require "rubygems"
require "rake"

# Ensure project root is in the LOAD_PATH
$LOAD_PATH.unshift(File.join(File.expand_path(File.dirname(__FILE__)), "lib"))

ProjectRoot = File.dirname(File.expand_path(__FILE__))

# Set Flags
$Flags = {} if $Flags.nil?
if Rake.application.options.trace
  $Flags[:verbose] = true
end

# Load all Rake Task definitions
Dir["#{ProjectRoot}/rake/*.rake"].each do |file|
  puts "Loading #{File.basename(file)}" if Rake.application.options.trace
  load file
end


================================================
FILE: resources/chm/README
================================================
=RailsInstaller

The goal of the RailsInstaller project is to provide developers working on Windows
systems with an easy way to quickly get started using Ruby on Rails by providing
a Windows installer containing a fully functioning baseline MRI (Matz' Ruby
Implementation) Ruby environment tuned for Windows systems with libraries for
doing Ruby on Rails development.


================================================
FILE: resources/chm/contents.hhc.rhtml
================================================
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML>
<HEAD>
<meta name="GENERATOR" content="Microsoft&reg; HTML Help Workshop 4.1">
<!-- Sitemap 1.0 -->
</HEAD>
  <BODY>
    <OBJECT type="text/site properties">
      <param name="ImageType" value="Folder">
    </OBJECT><% rdocs.each do |rdoc| %>
    <UL>
      <LI><OBJECT type="text/sitemap">
            <param name="Name" value="<%= rdoc[:title] %>"><% if rdoc[:file] =~ /\.chm$/ %>
            <param name="Local" value="<%= rdoc[:file] %>::/index.html">
          </OBJECT>
          <OBJECT type="text/sitemap">
            <param name="Name" value="<%= rdoc[:file] %>::/contents.hhc">
            <param name="Merge" value="<%= rdoc[:file] %>::/contents.hhc">
          </OBJECT><% else %>
            <param name="Local" value="<%= rdoc[:file] %>">
          </OBJECT><% end %>
    </UL><% end %>
  </BODY>
</HTML>


================================================
FILE: resources/chm/index.hhk.rhtml
================================================
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML>
<HEAD>
<meta name="GENERATOR" content="Microsoft&reg; HTML Help Workshop 4.1">
<!-- Sitemap 1.0 -->
</HEAD><BODY>
<UL>
    <LI> <OBJECT type="text/sitemap">
        <param name="Name" value="readme">
        <param name="Local" value="readme\files\README.html">
        </OBJECT>
</UL>
</BODY></HTML>


================================================
FILE: resources/chm/project.hhp.rhtml
================================================
[OPTIONS]
Auto Index=Yes
Compatibility=1.1 or later
Compiled file=<%= File.basename(meta_chm.file) %>
Contents file=contents.hhc
Display compile progress=No
Default topic=index.html
Language=0x409 English (United States)
Title=<%= meta_chm.title %>
Full-text search=Yes
Index file=index.hhk

[FILES] <% meta_chm.files.each do |file| %>
<%= file %>
<% end %>

[MERGE FILES] <% meta_chm.merge_files.each do |merge_file| %>
<%= merge_file %>

<% end %>

[INFOTYPES]



================================================
FILE: resources/railsinstaller/LICENSE.txt
================================================
Copyright (c) 2010-2022 RailsInstaller Team.

Except:

  * Ruby is copyrighted free software by Yukihiro Matsumoto.
    http://www.ruby-lang.org/en/LICENSE.txt

  * DevKit is licensed via the RubyInstaller project:
    http://rubyinstaller.org/

  * 3rd party libraries (OpenSSL, ZLib, etc.)


This software is distributed under the terms of MIT license.

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:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

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.


================================================
FILE: resources/railsinstaller/railsinstaller.iss
================================================
; RailsInstaller - Inno Setup Script
; Adaptation from RubyInstaller installer script
;

; PRE-CHECK
; Verify that RubyPath is defined by ISCC using
; /d command line arguments.
;
; Usage:
;  iscc rubyinstaller.iss /dInstallerVersion=0.1.0
;                         /dStagePath=stage
;                         /dRubyPath=Ruby/1.9.2
;                         [/dInstVersion=26-OCT-2009]

; Full example:
; iscc resouces\railsinstaller\railsinstaller.iss \
;       /dInstallerVersion=2.1.0 \
;       /dStagePath=stage \
;       /dRubyPath=Ruby1.9.2 \
;       /opkg
;       /frailsinstaller-2.1.0.exe

#if Defined(InstallerVersion) == 0
  #error Please provide a InstallerVersion definition using a /d parameter.
#endif

#if Defined(StagePath) == 0
  #error Please provide a StagePath value to the Ruby files using a /d parameter.
#endif

; 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
#if Defined(RubyPath) == 0
  #error Please provide a RubyPath value to the Ruby files using a /d parameter.
#else
  #if FileExists(StagePath + '/' + RubyPath + '\bin\ruby.exe') == 0
    #error No Ruby installation (bin\ruby.exe) found inside defined RubyPath. Please verify.
          #error "Setup failed to run the script."
  #endif
#endif

#if Defined(InstVersion) == 0
  #define InstVersion GetDateTimeString('dd-mmm-yy"T"hhnn', '', '')
#endif

; Build Installer details using above values
#define InstallerName "RailsInstaller"
#define InstallerNameWithVersion InstallerName + " " + InstallerVersion
#define InstallerPublisher "RailsInstaller Team"
#define InstallerHomepage "http://www.railsinstaller.org/"

#define CurrentYear GetDateTimeString('yyyy', '', '')

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications!
AppId={{613C3EA5-1248-4E35-B61A-6D0B31BBC0DB}
AppName={#InstallerName}
AppVerName={#InstallerNameWithVersion}
AppPublisher={#InstallerPublisher}
AppPublisherURL={#InstallerHomepage}
AppVersion={#InstallerVersion}
DefaultGroupName={#InstallerName}
DefaultDirName={sd}\RailsInstaller
DisableProgramGroupPage=true
LicenseFile=LICENSE.txt
Compression=lzma2/ultra64
SolidCompression=true
AlwaysShowComponentsList=false
DisableReadyPage=true
InternalCompressLevel=ultra64
VersionInfoCompany={#InstallerPublisher}
VersionInfoCopyright=(c) {#CurrentYear} {#InstallerPublisher}
VersionInfoDescription=Rails development environment installer for Windows
VersionInfoTextVersion={#InstallerVersion}
VersionInfoVersion={#InstallerVersion}
UninstallDisplayIcon={app}\bin\ruby.exe
WizardImageFile={#ResourcesPath}\images\RailsInstallerWizardImage.bmp
WizardSmallImageFile={#ResourcesPath}\images\RailsInstallerWizardImageSmall.bmp
PrivilegesRequired=lowest
ChangesAssociations=yes
ChangesEnvironment=yes
UsePreviousAppDir=no

#if Defined(SignPackage) == 1
SignTool=risigntool sign /a /d $q{#InstallerNameWithVersion}$q /du $q{#InstallerHomepage}$q /t $qhttp://timestamp.comodoca.com/authenticode$q $f
#endif

[Languages]
Name: en; MessagesFile: compiler:Default.isl

[Messages]
en.InstallingLabel=Installing [name], this will take a few minutes...
en.WelcomeLabel1=Welcome to [name]!
en.WelcomeLabel2=This will install [name/ver] on your computer.  Please close any console applications before continuing.
en.WizardLicense={#InstallerName} License Agreement
en.LicenseLabel=
en.LicenseLabel3=Please read the following License Agreements and accept the terms before continuing the installation.
en.LicenseAccepted=I &accept all of the Licenses
en.LicenseNotAccepted=I &decline any of the Licenses
en.WizardSelectDir=Installation Destination and Optional Tasks
en.SelectDirDesc=This is the location that Ruby, DevKit, Rails and Sqlite will be installed to.
en.SelectDirLabel3=[name] will be installed into the following folder. Click Install to continue or click Browse to use a different one.
en.SelectDirBrowseLabel=Please avoid any folder name that contains spaces (e.g. Program Files).
en.DiskSpaceMBLabel=Required free disk space: ~[mb] MB

[Files]
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
Source: {#StagePath}\{#RubyPath}\*; DestDir: {app}\{#RubyPath}; Flags: recursesubdirs createallsubdirs
Source: {#StagePath}\Git\*; DestDir: {app}\Git; Flags: recursesubdirs createallsubdirs
;Source: {#StagePath}\Git\*; DestDir: {app}\Git; Check: InstallGit; Flags: recursesubdirs createallsubdirs
;Source: {#StagePath}\DevKit\*; DestDir: {app}\DevKit; Excludes: "config.yml"; Flags: recursesubdirs createallsubdirs
;Source: {#StagePath}\DevKit\config.yml; DestDir: {app}\DevKit; AfterInstall: UpdateDevKitConfig('{app}\{#RubyPath}', '{app}\DevKit\config.yml')
;Source: {#StagePath}\Sites\*; DestDir: {sd}\Sites; Flags: recursesubdirs createallsubdirs
;Source: {#StagePath}\scripts\*; DestDir: {app}\scripts; Flags: recursesubdirs createallsubdirs
; TODO: Instead of running the full vcredist, simply extract and bundle the dll
;       files with an associated manifest.
; Source: {#StagePath}\pkg\vcredist_x86.exe; DestDir: {tmp}; Flags: deleteafterinstall
;Source: setup_environment.bat; DestDir: {app}\{#RubyPath}

[Registry]
; FIXME: Proper registry keys for RailsInstaller (admin)
;Root: HKLM; Subkey: Software\RailsInstaller; ValueType: string; ValueName: ; ValueData: ; Flags: uninsdeletevalue uninsdeletekeyifempty; Check: IsAdmin

; FIXME: Proper registry key for RailsInstaller (user)
;Root: HKCU; Subkey: Software\RailsInstaller; ValueType: string; ValueName: ; ValueData: ; Flags: uninsdeletevalue uninsdeletekeyifempty; Check: IsNotAdmin

[Icons]
Name: {group}\Interactive Ruby; Filename: {app}\{#RubyPath}\bin\irb.bat; WorkingDir: {app}\{#RubyPath} ; IconFilename: {app}\{#RubyPath}\bin\ruby.exe; Flags: createonlyiffileexists
Name: {group}\RubyGems Documentation Server; Filename: {app}\{#RubyPath}\bin\gem.bat; Parameters: server; IconFilename: {app}\{#RubyPath}\bin\ruby.exe; Flags: createonlyiffileexists runminimized
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
;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
; {%HOMEPATH%}
Name: {group}\{cm:UninstallProgram,{#InstallerName}}; Filename: {uninstallexe}

[Run]
;Filename: "{app}\{#RubyPath}\bin\ruby.exe"; Parameters: "dk.rb install --force"; WorkingDir: "{app}\DevKit"; Flags: runhidden
;Filename: "{app}\{#RubyPath}\bin\gem.bat"; Parameters: "pristine --all --only-executables"; WorkingDir: "{app}\{#RubyPath}\bin"; Flags: runhidden
;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

; TODO: Instead of running the full vcredist, simply extract and bundle the dll
;       files with an associated manifest.
; Filename: "{tmp}\vcredist_x86.exe"; StatusMsg: "Installing Microsoft Visual C++ 2008 SP1 Redistributable Package (x86)..." ; Parameters: "/q"; WorkingDir: "{tmp}"; Flags: runhidden

[Code]
#include "util.iss"
#include "railsinstaller_gui.iss"

function GetInstallDate(Param: String): String;
begin
  Result := GetDateTimeString('yyyymmdd', #0 , #0);
end;

procedure CurStepChanged(const CurStep: TSetupStep);
begin

  // TODO move into ssPostInstall just after install completes?
  if CurStep = ssInstall then
  begin
    if UsingWinNT then
    begin
      Log(Format('Selected Tasks - Path: %d', [PathChkBox.State]));

      if IsModifyPath then
        ModifyPath([ExpandConstant('{app}') + '\{#RubyPath}\bin']);
        ModifyPath([ExpandConstant('{app}') + '\Git\bin']);

    end else
      MsgBox('Looks like you''ve got on older, unsupported Windows version.' #13 +
             'Proceeding with a reduced feature set installation.',
             mbInformation, MB_OK);
  end;
end;

procedure RegisterPreviousData(PreviousDataKey: Integer);
begin
  {* store install choices so we can use during uninstall *}
  if IsModifyPath then
    SetPreviousData(PreviousDataKey, 'PathModified', 'yes');

  SetPreviousData(PreviousDataKey, 'RailsInstallerId', '{#InstallerVersion}');
end;

procedure CurUninstallStepChanged(const CurUninstallStep: TUninstallStep);
begin
  if CurUninstallStep = usUninstall then
  begin
    if UsingWinNT then
    begin
      if GetPreviousData('PathModified', 'no') = 'yes' then
	    begin
        ModifyPath([ExpandConstant('{app}') + '\{#RubyPath}\bin']);
        ModifyPath([ExpandConstant('{app}') + '\Git\bin']);
		end
    end;
  end;
end;

procedure UpdateDevKitConfig(RubyPath: string; FileName: string);
var
  S: String;
begin
  // Make YAML happy :-)
  S := ExpandConstant(RubyPath);
  StringChangeEx(S, '\', '/', True);

  // Update DevKit config.yml with the installation path
  SaveStringToFile(ExpandConstant(FileName), '- ' + S, False);
end;


================================================
FILE: resources/railsinstaller/railsinstaller_gui.iss
================================================
// RubyInstaller Inno Setup GUI Customizations
//
// Copyright (c) 2009 Jon Maken
// Revision: 11/23/2009 3:35:36 PM
// License: MIT

var
  PathChkBox, PathExtChkBox: TCheckBox;

function IsAssociated(): Boolean;
begin
  Result := PathExtChkBox.Checked;
end;

function IsModifyPath(): Boolean;
begin
  Result := PathChkBox.Checked;
end;

procedure ParseSilentTasks();
var
  I, N: Integer;
  Param: String;
  Tasks: TStringList;
begin
  {* parse command line args for silent install tasks *}
  for I := 0 to ParamCount do
  begin
    Param := AnsiUppercase(ParamStr(I));
    if Pos('/TASKS', Param) <> 0 then
    begin
      Param := Trim(Copy(Param, Pos('=', Param) + 1, Length(Param)));
      try
        // TODO check for too many tasks to prevent overflow??
        Tasks := StrToList(Param, ',');
        for N := 0 to Tasks.Count - 1 do
          case Trim(Tasks.Strings[N]) of
            'MODPATH': PathChkBox.State := cbChecked;
          end;
      finally
        Tasks.Free;
      end;
    end;
  end;
end;

procedure URLText_OnClick(Sender: TObject);
var
  ErrorCode: Integer;
begin
  if Sender is TNewStaticText then
    ShellExec('open', TNewStaticText(Sender).Caption, '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
end;

procedure InitializeWizard;
var
  Page: TWizardPage;
  HostPage: TNewNotebookPage;
  URLText, TmpLabel: TNewStaticText;
begin

  {* Path and file association task check boxes *}

  Page := PageFromID(wpSelectDir);
  
  PathChkBox := TCheckBox.Create(Page);
  PathChkBox.Parent := Page.Surface;
  PathChkBox.State := cbChecked;
  PathChkBox.Caption := 'Add executables for Ruby and DevKit to the PATH ';
  PathChkBox.Alignment := taRightJustify;
  PathChkBox.Top := ScaleY(125);
  PathChkBox.Left := ScaleX(18);
  PathChkBox.Width := Page.SurfaceWidth;
  PathChkBox.Height := ScaleY(17);

  ParseSilentTasks;

  HostPage := WizardForm.FinishedPage;

  TmpLabel := TNewStaticText.Create(HostPage);
  TmpLabel.Parent := HostPage;
  TmpLabel.Top := ScaleY(180);
  TmpLabel.Left := ScaleX(176);
  TmpLabel.AutoSize := True;
  TmpLabel.Caption := 'Web Site:';

  URLText := TNewStaticText.Create(HostPage);
  URLText.Parent := HostPage;
  URLText.Top := TmpLabel.Top;
  URLText.Left := TmpLabel.Left + TmpLabel.Width + ScaleX(4);
  URLText.AutoSize := True;
  URLText.Caption := 'http://railsinstaller.org/';
  URLText.Cursor := crHand;
  URLText.Font.Color := clBlue;
  URLText.OnClick := @URLText_OnClick;

  TmpLabel := TNewStaticText.Create(HostPage);
  TmpLabel.Parent := HostPage;
  TmpLabel.Top := ScaleY(196);
  TmpLabel.Left := ScaleX(176);
  TmpLabel.AutoSize := True;
  TmpLabel.Caption := 'Mailing List:';

  URLText := TNewStaticText.Create(HostPage);
  URLText.Parent := HostPage;
  URLText.Top := TmpLabel.Top;
  URLText.Left := TmpLabel.Left + TmpLabel.Width + ScaleX(4);
  URLText.AutoSize := True;
  URLText.Caption := 'http://groups.google.com/group/railsinstaller';
  URLText.Cursor := crHand;
  URLText.Font.Color := clBlue;
  URLText.OnClick := @URLText_OnClick;

  TmpLabel := TNewStaticText.Create(HostPage);
  TmpLabel.Parent := HostPage;
  TmpLabel.Top := ScaleY(212);
  TmpLabel.Left := ScaleX(176);
  TmpLabel.AutoSize := True;
  TmpLabel.Caption := 'IRC:';

  URLText := TNewStaticText.Create(HostPage);
  URLText.Parent := HostPage;
  URLText.Top := TmpLabel.Top;
  URLText.Left := TmpLabel.Left + TmpLabel.Width + ScaleX(4);
  URLText.AutoSize := True;
  URLText.Caption := 'http://wiki.github.com/wayneeseguin/railsinstaller';
  URLText.Cursor := crHand;
  URLText.Font.Color := clBlue;
  URLText.OnClick := @URLText_OnClick;

  URLText := TNewStaticText.Create(HostPage);
  URLText.Parent := HostPage;
  URLText.Top := TmpLabel.Top;
  URLText.Left := TmpLabel.Left + TmpLabel.Width + ScaleX(4);
  URLText.AutoSize := True;
  URLText.Caption := 'http://webchat.freenode.net/?channels=railsinstaller';
  URLText.Cursor := crHand;
  URLText.Font.Color := clBlue;
  URLText.OnClick := @URLText_OnClick;

end;

procedure CurPageChanged(CurPageID: Integer);
begin
  if CurPageID = wpSelectDir then
    WizardForm.NextButton.Caption := '&Install';
end;



================================================
FILE: resources/railsinstaller/setup_environment.bat
================================================
@ECHO OFF

REM
REM Environment setup file for RailsInstaller.
REM

REM
REM First we determine where is RUBY_DIR (which is where this script is)
REM
PUSHD %~dp0.
SET RUBY_DIR=%CD%
POPD

REM
REM Now determine the RailsInstaller root directory (parent directory of Ruby)
REM
PUSHD %RUBY_DIR%\..
SET ROOT_DIR=%CD%
POPD

REM
REM Add RUBY_DIR\bin to the PATH, DevKit\bin and then Git\cmd
REM RUBY_DIR\bin takes higher priority to avoid other tools conflict
REM
SET PATH=%RUBY_DIR%\bin;%RUBY_DIR%\lib\ruby\gems\1.9.1\bin;%ROOT_DIR%\DevKit\bin;%PATH%
IF EXIST %ROOT_DIR%\Git\cmd SET PATH=%ROOT_DIR%\Git\cmd;%PATH%
SET RUBY_DIR=
SET ROOT_DIR=

REM
REM Create the %HOMEDRIVE%\Sites directory.
REM
IF NOT EXIST %HOMEDRIVE%\Sites MD %HOMEDRIVE%\Sites

REM
REM Set the HOME environment variables for Ruby & Gems to use with ENV["HOME"]
REM
SET HOME=%HOMEDRIVE%%HOMEPATH%

SET RailsInstallerPath=%1
REM Check configurations for Git and SSH
IF EXIST %RailsInstallerPath% (
  ruby %RailsInstallerPath%\scripts\config_check.rb
) ELSE (
  ruby.exe "require 'rbconfig' ; file=%%\#{RbConfig::}"
)

REM NOTE that we start out in the Sites directory as the current working dir
IF EXIST %HOMEDRIVE%\Sites CD %HOMEDRIVE%\Sites


================================================
FILE: resources/railsinstaller/util.iss
================================================
// Inno Setup utilities
//
// Copyright (c) 2009 Jon Maken
// Revision: 11/03/2009 8:04:17 PM
// License: MIT

// forward declarations
function MungePathish(const SrcList: TStringList; NewData: Array of String; RegValue: String; IsUninstalling: Boolean): Boolean; forward;
procedure ModifyPathish(NewData: Array of String; RegValue, Delim: String); forward;
function StrToList(const SrcString: String; Delim: String): TStringList; forward;
function ListToStr(const SrcList: TStringList; Delim: String): String; forward;

function IsAdmin(): Boolean;
begin
  Result := IsAdminLoggedOn or IsPowerUserLoggedOn;
end;

function IsNotAdmin(): Boolean;
begin
  Result := not (IsAdminLoggedOn or IsPowerUserLoggedOn);
end;

function GetUserHive(): Integer;
begin
  if IsAdminLoggedOn or IsPowerUserLoggedOn then
    Result :=  HKLM
  else
    Result := HKCU;
end;

function GetEnvironmentKey(): String;
begin
  if IsAdmin then
    Result := 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment'
  else
    Result := 'Environment';
end;

procedure ModifyFileExts(Exts: Array of String);
begin
  ModifyPathish(Exts, 'PATHEXT', ';');
end;

procedure ModifyPath(Exts: Array of String);
begin
  ModifyPathish(Exts, 'PATH', ';');
end;

// Modifies path-like registry keys such as PATH, PATHEXT
procedure ModifyPathish(NewData: Array of String; RegValue, Delim: String);
var
  NeedRegChange: Boolean;
  RootKey: Integer;
  SubKey, OrigData, NewPathish, Tmp, TmpExpandable: String;
  PathishList: TStringList;
begin
  RootKey := GetUserHive;
  SubKey := GetEnvironmentKey;

  try
    RegQueryStringValue(RootKey, SubKey, RegValue, OrigData);
    Log('Original ' + AnsiUppercase(RegValue) + ': ' + OrigData);

    // ensure originally empty users PATHEXT also contains system values
    if (RootKey = HKCU) and (AnsiUppercase(RegValue) = 'PATHEXT') and (OrigData = '') then
    begin
      Log('Empty HKCU ' + AnsiUppercase(RegValue) + ', prepending %PATHEXT% to new value');
      OrigData := ('%' + RegValue + '%');
    end;

    PathishList := StrToList(OrigData, Delim);

    NeedRegChange := MungePathish(PathishList, NewData, RegValue, IsUninstaller);

    if NeedRegChange then
    begin
      NewPathish := ListToStr(PathishList, ';');

      case AnsiUppercase(RegValue) of
        'PATH': RegWriteExpandStringValue(RootKey, SubKey, 'Path', NewPathish);
        'PATHEXT': RegWriteExpandStringValue(RootKey, SubKey, 'PATHEXT', NewPathish);
      end;
      Log(AnsiUppercase(RegValue) + ' updated to: ' + NewPathish);

      // remove values if empty after uninstaller reverts its mods
      if IsUninstaller then
      begin
        if RegQueryStringValue(RootKey, SubKey, RegValue, Tmp) then
        begin
          // If the key is empty or expandable version (%RegValue%), remove it.
          TmpExpandable := '%' + RegValue + '%';
          if (Tmp = '') or (Tmp = TmpExpandable) then
          begin
            RegDeleteValue(RootKey, SubKey, RegValue);
            Log('uninstaller deleted empty ' + AnsiUppercase(RegValue) +
                ' to match original config');
          end;
        end;
      end;
    end else  // no reg change needed
      Log('no changes need for ' + AnsiUppercase(RegValue));
  finally
    PathishList.Free;
  end;
end;

function StrToList(const SrcString: String; Delim: String): TStringList;
var
  PathList: TStringList;
  TmpPath: String;
begin
  PathList := TStringList.Create;

  // empty PATH
  if Length(SrcString) = 0 then Result := PathList;

  if (Length(SrcString) > 0) then
  begin
    // single entry with no trailing ';'
    if Pos(Delim, SrcString) = 0 then
    begin
      PathList.Append(SrcString);

      Result := PathList;
    // single entry with trailing ';'
    // TODO address pathological case of multiple trailing ';' chars?
    end else if Pos(Delim, SrcString) = Length(SrcString) then
    begin
      TmpPath := SrcString;
      StringChangeEx(TmpPath, Delim, '', True);
      PathList.Append(TmpPath);

      Result := PathList;
    end else
    // multiple entries
    begin
      TmpPath := SrcString;
      // clean up a leading ';' pathological case if it exists
      if Pos(Delim, TmpPath) = 1 then TmpPath := Copy(TmpPath, 2, Length(TmpPath));
      while (Pos(Delim, TmpPath) > 0) do
      begin
        PathList.Append(Copy(TmpPath, 1, Pos(Delim, TmpPath) - 1));
        TmpPath := Copy(TmpPath, Pos(Delim, TmpPath) + 1, Length(TmpPath));
      end;
      // add final remaining dir if not empty due to trailing ';'
      if Length(TmpPath) > 0 then PathList.Append(TmpPath);

      Result := PathList;
    end;
  end;
end;

function ListToStr(const SrcList: TStringList; Delim: String): String;
var
  Path: String;
  I: Integer;
begin
  for I := 0 to SrcList.Count - 1 do begin
    if Length(Path) = 0 then
    begin
      Path := SrcList[I];
      Continue;
    end;
    Path := Path + Delim + SrcList[I];
  end;

  Result := Path;
end;

function MungePathish(const SrcList: TStringList; NewData: Array of String;
                      RegValue: String; IsUninstalling: Boolean): Boolean;
var
  RootKey, I, N: Integer;
  Item: String;
  RegChangeFlag: Boolean;
begin
  RegChangeFlag := False;
  RootKey := GetUserHive;

  for N := 0 to GetArrayLength(NewData) - 1 do
  begin
    Item := NewData[N];
    if not IsUninstalling then  // installing...
    begin
      // update PathishList ONLY if new item isn't already in the list
      // DO NOT ASSUME that the installer should duplicate entry or change order!
      if SrcList.IndexOf(Item) = -1 then
      begin
        case AnsiUppercase(RegValue) of
          'PATH': SrcList.Insert(0, Item);
          'PATHEXT': SrcList.Add(AnsiUppercase(Item));
        end;
        RegChangeFlag := True;
      end else  // already in existing config, no need for update; log it
        Log(Item + ' already on ' + AnsiUppercase(RegValue) +
          ' in original config; not modifying ' + AnsiUppercase(RegValue));
    end else  // uninstalling...
    begin
      I := SrcList.IndexOf(Item);
      if I <> -1 then  // found on PathishList, delete it
      begin
        SrcList.Delete(I);
        RegChangeFlag := True;
      end;  // not found on PathishList, no need for registry mod
    end;
  end;

  Result := RegChangeFlag;
end;


================================================
FILE: resources/scripts/config_check.rb
================================================
#!/usr/bin/env ruby

require "fileutils"

Config =
  {
    :banner => "\n# Rails Environment Configuration.\n",
    :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",
    :git_name_prompt => "\n Please enter your name, for example mine is: Wayne E. Seguin\nname > ",
    :git_email_prompt => "\n Please enter your email address, for example mine is: wayneeseguin@gmail.com\nemail > ",
    :railsinstaller_path => File.dirname(File.dirname($0)),
    :home        => File.join(ENV["HOMEDRIVE"], ENV["HOMEPATH"]),
    :ssh_path    => File.join(ENV["HOMEDRIVE"], ENV["HOMEPATH"], ".ssh"),
    :ssh_key     => File.join(ENV["HOMEDRIVE"], ENV["HOMEPATH"], ".ssh", "id_rsa"),
    :ssh_pub_key => File.join(ENV["HOMEDRIVE"], ENV["HOMEPATH"], ".ssh", "id_rsa.pub"),
    :ssh_keygen  => File.join(File.dirname(File.dirname($0)), "Git", "bin", "ssh-keygen.exe"),
    :git         => File.join(File.dirname(File.dirname($0)), "Git", "bin", "git.exe"),
    :cat         => File.join(File.dirname(File.dirname($0)), "Git", "bin", "cat.exe")
  }

@notes = []

#
# Methods
#
def run(command)
  $stderr.puts "Running #{command}" if Config[:debug]
  %x{#{command}}.chomp
end

def generate_ssh_key
  run %Q{#{Config[:ssh_keygen]} -f "#{Config[:ssh_key]}" -t rsa -b 2048 -N "" -C "#{git_config("user.name")} <#{git_config("user.email")}>"}

  run %Q{clip < "#{Config[:ssh_pub_key]}"}

  @notes << "Your public ssh key (id_rsa.pub) has been automatically generated and copied to your clipboard."
end

def git_config(key)
  run %Q{#{Config[:git]} config --global #{key}}
end

#
# Configuration
#
puts Config[:banner]

["name", "email"].each do |key|
  while git_config("user.#{key}").empty?
    if Config[:git_config_incomplete]
      puts Config[:git_config_incomplete]
        Config[:git_config_incomplete] = nil
      end

    printf "%s", Config["git_#{key}_prompt".to_sym]

    value = gets.chomp
    next if value.empty?
    puts "Setting user.#{key} to #{value}"
    run %Q{#{Config[:git]} config --global user.#{key} "#{value}"}
  end
end

FileUtils.mkdir_p(Config[:ssh_path]) unless File.exist? Config[:ssh_path]
generate_ssh_key                     unless File.exist? Config[:ssh_key]

#
# Emit Summary
#
puts "
---
git:
  user.name:  #{git_config("user.name")}
  user.email: #{git_config("user.email")}
  version:    #{run "git --version"}

ruby:
  bin:        #{File.join(Config[:railsinstaller_path], "Ruby2.3.3", "bin", "ruby.exe")}
  version:    #{run "ruby -v"}

rails:
  bin:        #{File.join(Config[:railsinstaller_path], "Ruby2.3.3", "bin", "rails.bat")}
  version:    #{run "rails -v"}

ssh:
  public_key_location: #{Config[:ssh_pub_key]}
  public_key_contents: #{File.open(Config[:ssh_pub_key], "r") { |file| file.read }}

#{@notes.empty? ? "" : "NOTES:\n\n  #{@notes.join("\n  ")}"}

"

exit 0


================================================
FILE: resources/scripts/publickey.bat
================================================
@echo off
if exist "%HOMEDRIVE%%HOMEPATH%\.ssh\id_rsa.pub" (
  clip < "%HOMEDRIVE%%HOMEPATH%\.ssh\id_rsa.pub"
  echo Your public ssh key has been copied to your clipboard.
)
@echo on


================================================
FILE: resources/scripts/setup_ssh.bat
================================================
@echo off
if not exist "%homedrive%%homepath%\.ssh" mkdir "%homedrive%%homepath%\.ssh"
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 ""
@echo on


================================================
FILE: resources/scripts/sshkey
================================================
#!/usr/bin/env ruby

pub_key_file = File.join(ENV["HOMEDRIVE"], ENV["HOMEPATH"], ".ssh", "id_rsa", "pub")

ssh_pub_key = File.open(pub_key_file, 'r') { |file| file.read }

%x{echo #{ssh_pub_key} | clip}


================================================
FILE: resources/scripts/sshkey.bat
================================================
@ECHO OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
@"ruby.exe" "C:/Projects/railsinstaller/stage/Ruby2.0.0/bin/sshkey" %1 %2 %3 %4 %5 %6 %7 %8 %9
GOTO :EOF
:WinNT
@"ruby.exe" "%~dpn0" %*
Download .txt
gitextract_brru3rkp/

├── .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/
│   │   ├── actions.rb
│   │   ├── components.rb
│   │   ├── downloads.rb
│   │   └── methods.rb
│   ├── railsinstaller.rb
│   └── setup/
│       └── globals.rb
├── rake/
│   └── railsinstaller.rake
├── rakefile.rb
└── resources/
    ├── chm/
    │   ├── README
    │   ├── contents.hhc.rhtml
    │   ├── index.hhk.rhtml
    │   └── project.hhp.rhtml
    ├── railsinstaller/
    │   ├── LICENSE.txt
    │   ├── railsinstaller.iss
    │   ├── railsinstaller_gui.iss
    │   ├── setup_environment.bat
    │   └── util.iss
    └── scripts/
        ├── config_check.rb
        ├── publickey.bat
        ├── setup_ssh.bat
        ├── sshkey
        └── sshkey.bat
Download .txt
SYMBOL INDEX (35 symbols across 7 files)

FILE: lib/extensions/stdlib.rb
  class String (line 1) | class String
    method camelcase (line 6) | def camelcase

FILE: lib/railsinstaller.rb
  type RailsInstaller (line 1) | module RailsInstaller # Ensure that the RailsInstaller project root is d...

FILE: lib/railsinstaller/actions.rb
  type RailsInstaller (line 1) | module RailsInstaller
    function build! (line 3) | def self.build!
    function package! (line 43) | def self.package!

FILE: lib/railsinstaller/components.rb
  type RailsInstaller (line 1) | module RailsInstaller

FILE: lib/railsinstaller/downloads.rb
  type RailsInstaller (line 1) | module RailsInstaller
    function download (line 8) | def self.download(url, filename = nil, count = 3)

FILE: lib/railsinstaller/methods.rb
  type RailsInstaller (line 1) | module RailsInstaller
    function unzip (line 7) | def self.unzip(package)
    function extract (line 63) | def self.extract(package)
    function install_utility (line 153) | def self.install_utility
    function stage_sqlite (line 191) | def self.stage_sqlite
    function stage_postgresql (line 205) | def self.stage_postgresql
    function link_devkit_with_ruby (line 219) | def self.link_devkit_with_ruby
    function stage_git (line 231) | def self.stage_git
    function stage_gem_update (line 240) | def self.stage_gem_update
    function stage_gems (line 247) | def self.stage_gems
    function fix_batch_files (line 252) | def self.fix_batch_files
    function stage_todo_application (line 267) | def self.stage_todo_application
    function stage_rails_sample_application (line 290) | def self.stage_rails_sample_application
    function stage_setup_scripts (line 301) | def self.stage_setup_scripts
    function stage_msvc_runtime (line 322) | def self.stage_msvc_runtime
    function build_gems (line 338) | def self.build_gems(ruby_path, gems)
    function build_gem (line 352) | def self.build_gem(ruby_path, gem, options = {})
    function gem_install (line 361) | def self.gem_install(ruby_path, gem,options = {})
    function ruby_binary (line 371) | def self.ruby_binary(name, line, action, ruby_path, directory_path, op...
    function iscc (line 379) | def self.iscc(*params)
    function sh (line 408) | def self.sh(line, options = {})
    function log (line 418) | def self.log(text)
    function section (line 422) | def self.section(text)

FILE: resources/scripts/config_check.rb
  function run (line 26) | def run(command)
  function generate_ssh_key (line 31) | def generate_ssh_key
  function git_config (line 39) | def git_config(key)
Condensed preview — 33 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (70K chars).
[
  {
    "path": ".gems",
    "chars": 17,
    "preview": "rubyzip\r\nPOpen4\r\n"
  },
  {
    "path": ".gitignore",
    "chars": 58,
    "preview": "*.exe\r\n*.rbc\r\n*.swp\r\n*~\r\n.idea/\r\narchives/\r\npkg/\r\nstage/\r\n"
  },
  {
    "path": "CHANGELOG.txt",
    "chars": 2332,
    "preview": "3.2.0 - Ruby 2.2.4 \r\n\r\n3.1.1 - Ruby 2.1.8, Rails 4.2.5, activerecord-sqlserver-adapter 4.2.6,\r\n        coffee-rails 4.1."
  },
  {
    "path": "CONTRIBUTORS.txt",
    "chars": 681,
    "preview": "# CONTRIBUTORS\r\n#\r\n# This file tries to detail all the developers, users and 3rd parties\r\n# that contributed to material"
  },
  {
    "path": "LICENCE.txt",
    "chars": 1153,
    "preview": "Copyright (c) 2010-2017 RailsInstaller Team.\r\nAll rights reserved. See CONTRIBUTORS.txt for complete list.\r\n\r\nPermission"
  },
  {
    "path": "README.md",
    "chars": 4838,
    "preview": "# RailsInstaller\r\n\r\nRails development environment installer for Windows. This is attempt to get the installer to work ag"
  },
  {
    "path": "TEAM.txt",
    "chars": 108,
    "preview": "Luis Lavena (luislavena+railsinstaller@gmail.com)\r\nWayne E. Seguin (wayneeseguin+railsinstaller@gmail.com)\r\n"
  },
  {
    "path": "VERSION.txt",
    "chars": 6,
    "preview": "4.0.1\n"
  },
  {
    "path": "config/railsinstaller.yml",
    "chars": 1027,
    "preview": "---\n:gems:\n  :name: Gems\n  :title: Ruby Gems\n  :category: gems\n  :list:\n    -\n      :name: rails\n      :version: \"7.1.2\""
  },
  {
    "path": "docs/notes.txt",
    "chars": 2814,
    "preview": "MSYS is \"Minimal System\", is some sort of Cygwin set of libraries (but\r\nis not cygwin) that only exist to provide suppor"
  },
  {
    "path": "lib/extensions/stdlib.rb",
    "chars": 234,
    "preview": "class String\r\n  # Converts a lower case and underscored string to UpperCamelCase.\r\n  #\r\n  # Examples:\r\n  #   \"ruby_build"
  },
  {
    "path": "lib/railsinstaller/actions.rb",
    "chars": 2112,
    "preview": "module RailsInstaller\n\n  def self.build!\n  \n  components = [\n    BSDTar, SevenZip, Git, Ruby322\n    ]\n\n    components.ea"
  },
  {
    "path": "lib/railsinstaller/components.rb",
    "chars": 351,
    "preview": "module RailsInstaller\r\n  #\r\n  # Load initial objects (OpenStruct) from railsinstaller.yml\r\n  #\r\n  @@config = YAML.load(\r"
  },
  {
    "path": "lib/railsinstaller/downloads.rb",
    "chars": 3139,
    "preview": "module RailsInstaller\r\n\r\n  require \"net/https\"\r\n  require \"tempfile\"\r\n\r\n  # Original download() code taken from Rubinius"
  },
  {
    "path": "lib/railsinstaller/methods.rb",
    "chars": 13463,
    "preview": "module RailsInstaller\n\n  #\n  # unzip:\n  # Requires: rubyzip (gem install rubyzip) # require \"zip/zip\"\n  #\n  def self.unz"
  },
  {
    "path": "lib/railsinstaller.rb",
    "chars": 1168,
    "preview": "module RailsInstaller # Ensure that the RailsInstaller project root is defined.\r\n  Root       = File.expand_path(File.jo"
  },
  {
    "path": "lib/setup/globals.rb",
    "chars": 34,
    "preview": "$Flags ||= { :verbose => false }\r\n"
  },
  {
    "path": "rake/railsinstaller.rake",
    "chars": 1188,
    "preview": "task :default do\r\n  printf \"\\nRailsInstaller Rake Tasks:\r\n\r\n  {bootstrap, build, package}\r\n\r\nSee README.md for more deta"
  },
  {
    "path": "rakefile.rb",
    "chars": 531,
    "preview": "#!/usr/bin/env ruby\r\n\r\nrequire \"rubygems\"\r\nrequire \"rake\"\r\n\r\n# Ensure project root is in the LOAD_PATH\r\n$LOAD_PATH.unshi"
  },
  {
    "path": "resources/chm/README",
    "chars": 375,
    "preview": "=RailsInstaller\r\n\r\nThe goal of the RailsInstaller project is to provide developers working on Windows\r\nsystems with an e"
  },
  {
    "path": "resources/chm/contents.hhc.rhtml",
    "chars": 899,
    "preview": "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\r\n<HTML>\r\n<HEAD>\r\n<meta name=\"GENERATOR\" content=\"Microsoft&reg; HTML Help"
  },
  {
    "path": "resources/chm/index.hhk.rhtml",
    "chars": 368,
    "preview": "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\r\n<HTML>\r\n<HEAD>\r\n<meta name=\"GENERATOR\" content=\"Microsoft&reg; HTML Help"
  },
  {
    "path": "resources/chm/project.hhp.rhtml",
    "chars": 487,
    "preview": "[OPTIONS]\r\nAuto Index=Yes\r\nCompatibility=1.1 or later\r\nCompiled file=<%= File.basename(meta_chm.file) %>\r\nContents file="
  },
  {
    "path": "resources/railsinstaller/LICENSE.txt",
    "chars": 1399,
    "preview": "Copyright (c) 2010-2022 RailsInstaller Team.\r\n\r\nExcept:\r\n\r\n  * Ruby is copyrighted free software by Yukihiro Matsumoto.\r"
  },
  {
    "path": "resources/railsinstaller/railsinstaller.iss",
    "chars": 9403,
    "preview": "; RailsInstaller - Inno Setup Script\r\n; Adaptation from RubyInstaller installer script\r\n;\r\n\r\n; PRE-CHECK\r\n; Verify that "
  },
  {
    "path": "resources/railsinstaller/railsinstaller_gui.iss",
    "chars": 4257,
    "preview": "// RubyInstaller Inno Setup GUI Customizations\r\n//\r\n// Copyright (c) 2009 Jon Maken\r\n// Revision: 11/23/2009 3:35:36 PM\r"
  },
  {
    "path": "resources/railsinstaller/setup_environment.bat",
    "chars": 1252,
    "preview": "@ECHO OFF\r\n\r\nREM\r\nREM Environment setup file for RailsInstaller.\r\nREM\r\n\r\nREM\r\nREM First we determine where is RUBY_DIR ("
  },
  {
    "path": "resources/railsinstaller/util.iss",
    "chars": 6473,
    "preview": "// Inno Setup utilities\r\n//\r\n// Copyright (c) 2009 Jon Maken\r\n// Revision: 11/03/2009 8:04:17 PM\r\n// License: MIT\r\n\r\n// "
  },
  {
    "path": "resources/scripts/config_check.rb",
    "chars": 3024,
    "preview": "#!/usr/bin/env ruby\r\n\r\nrequire \"fileutils\"\r\n\r\nConfig =\r\n  {\r\n    :banner => \"\\n# Rails Environment Configuration.\\n\",\r\n "
  },
  {
    "path": "resources/scripts/publickey.bat",
    "chars": 189,
    "preview": "@echo off\r\nif exist \"%HOMEDRIVE%%HOMEPATH%\\.ssh\\id_rsa.pub\" (\r\n  clip < \"%HOMEDRIVE%%HOMEPATH%\\.ssh\\id_rsa.pub\"\r\n  echo "
  },
  {
    "path": "resources/scripts/setup_ssh.bat",
    "chars": 246,
    "preview": "@echo off\r\nif not exist \"%homedrive%%homepath%\\.ssh\" mkdir \"%homedrive%%homepath%\\.ssh\"\r\nif not exist \"%homedrive%%homep"
  },
  {
    "path": "resources/scripts/sshkey",
    "chars": 210,
    "preview": "#!/usr/bin/env ruby\r\n\r\npub_key_file = File.join(ENV[\"HOMEDRIVE\"], ENV[\"HOMEPATH\"], \".ssh\", \"id_rsa\", \"pub\")\r\n\r\nssh_pub_k"
  },
  {
    "path": "resources/scripts/sshkey.bat",
    "chars": 187,
    "preview": "@ECHO OFF\r\nIF NOT \"%~f0\" == \"~f0\" GOTO :WinNT\r\n@\"ruby.exe\" \"C:/Projects/railsinstaller/stage/Ruby2.0.0/bin/sshkey\" %1 %2"
  }
]

About this extraction

This page contains the full source code of the railsinstaller/railsinstaller-windows GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 33 files (62.5 KB), approximately 17.7k tokens, and a symbol index with 35 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!