<commit_before>module Luban
  module Deployment
    module Packages
      class Ruby < Luban::Deployment::Package::Base
        apply_to '1.8.6' do
          after_install do
            depend_on 'rubygems', version: '1.3.7'
          end
        end

        apply_to '1.8.7' do 
          after_install do
            depend_on 'rubygems', version: '1.6.2'
          end
        end

        apply_to '<= 1.8.7' do
          before_install do
            depend_on 'openssl', version: '0.9.8zh'
          end
        end

        apply_to '1.9.1' do
          before_install do
            depend_on 'yaml', version: '0.1.6'
          end
          after_install do
            depend_on 'rubygems', version: '1.3.7'
          end
        end

        apply_to '1.9.2' do
          before_install do
            depend_on 'yaml', version: '0.1.6'
          end
          after_install do
            depend_on 'rubygems', version: '1.8.23'
          end
        end

        apply_to [">= 1.9.3", "< 2.1.2"] do
          before_install do
            depend_on 'yaml', version: '0.1.6'
          end
        end

        apply_to '>= 1.9.3' do
          before_install do
            depend_on 'openssl', version: '1.0.2h'
            #depend_on 'yaml', version: '0.1.6'
          end
        end

        apply_to :all do
          after_install do
            depend_on 'bundler', version: '1.12.3'
          end
        end
        
        def self.decompose_version(version)
          major_version, patch_level = version.split('-')
          patch_level = '' if patch_level.nil?
          patch_level = $1 if patch_level.match(/^p(\d+)$/)
          { major_version: major_version, patch_level: patch_level }
        end
        
        protected

        def setup_install_tasks
          super
          commands[:install].switch :install_doc, "Install Ruby document"
          commands[:install].switch :install_tcl, "Install with Tcl"
          commands[:install].switch :install_tk, "Install with Tk"
          commands[:install].option :bundler, "Bundler version"
          commands[:install].option :openssl, "OpenSSL version (effective for v1.9.3 or above)"
        end

        class Installer < Luban::Deployment::Package::Installer
          attr_reader :opt_dirs

          def install_doc?
            task.opts.install_doc
          end

          def install_tcl?
            task.opts.install_tcl
          end

          def install_tk?<commit_msg>Added option #rubygems to specify the version of Rubygems to install<commit_after>module Luban
  module Deployment
    module Packages
      class Ruby < Luban::Deployment::Package::Base
        apply_to '1.8.6' do
          after_install do
            depend_on 'rubygems', version: '1.3.7'
          end
        end

        apply_to '1.8.7' do 
          after_install do
            depend_on 'rubygems', version: '1.6.2'
          end
        end

        apply_to '<= 1.8.7' do
          before_install do
            depend_on 'openssl', version: '0.9.8zh'
          end
        end

        apply_to '1.9.1' do
          before_install do
            depend_on 'yaml', version: '0.1.6'
          end
          after_install do
            depend_on 'rubygems', version: '1.3.7'
          end
        end

        apply_to '1.9.2' do
          before_install do
            depend_on 'yaml', version: '0.1.6'
          end
          after_install do
            depend_on 'rubygems', version: '1.8.23'
          end
        end

        apply_to [">= 1.9.3", "< 2.1.2"] do
          before_install do
            depend_on 'yaml', version: '0.1.6'
          end
        end

        apply_to '>= 1.9.3' do
          before_install do
            depend_on 'openssl', version: '1.0.2h'
            #depend_on 'yaml', version: '0.1.6'
          end
        end

        apply_to :all do
          after_install do
            depend_on 'bundler', version: '1.12.3'
          end
        end
        
        def self.decompose_version(version)
          major_version, patch_level = version.split('-')
          patch_level = '' if patch_level.nil?
          patch_level = $1 if patch_level.match(/^p(\d+)$/)
          { major_version: major_version, patch_level: patch_level }
        end
        
        protected

        def setup_install_tasks
          super
          commands[:install].switch :install_doc, "Install Ruby document"
          commands[:install].switch :install_tcl, "Install with Tcl"
          commands[:install].switch :install_tk, "Install with Tk"
          commands[:install].option :rubygems, "Rubygems version (effective for v1.9.2 or below)"
          commands[:install].option :bundler, "Bundler version"
          commands[:install].option :openssl, "OpenSSL version (effective for v1.9.3 or above)"
        end

        class Installer < Luban::Deployment::Package::Installer
          attr_reader :opt_dirs

          def install_doc?
            task.opts.install_doc
          end

          def install_tcl?
            task.opts.install_tcl
          end

          def install_tk?
{'fraction_non_alphanumeric': 0.09468731621250735, 'fraction_numerical': 0.02528915898843364, 'mean_word_length': 1.5497251374312844, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1197159', 'n_tokens_mistral': 1562, 'n_tokens_neox': 1516, 'n_words': 380}