Sha256: 509f7776fbd7d3c70bfe8184c8dd5f235449d13ad4fe23db0fa8af34f80eb4bc

Contents?: true

Size: 971 Bytes

Versions: 17

Compression:

Stored size: 971 Bytes

Contents

module ForkCMSDeploy
	class ForkCMS
		ForkLibPath = File.dirname(__FILE__) + '/../forkcms_deploy'

		def self.determine_version_to_use(version)
			versions = version.split('.')
			until versions.empty?
				# Exact version match
				if File.exists?(ForkLibPath + "/forkcms_#{versions.join('.')}.rb")
					return versions.join('.')
				else
					level_version = versions.pop
					
					# Find a version that might match on the same level
					matching_level = Dir.glob(ForkLibPath + "/forkcms_#{versions.join('.')}.[0-9]*.rb")
					matching_level.sort.reverse.each do |file|
						# Extract the file's level-version from the path
						file_version = file[/(\d+).rb$/, 1]
						
						# Return this version if the file's version is lower then the Fork version
						# (such that, for Fork 3.6, 3.5 is loaded, but not for Fork 3.4
						return (versions + [file_version]).join('.') if file_version < level_version
					end
				end
			end

			return "default"
		end
	end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
forkcms_deploy-4.5.0 lib/forkcms_deploy/forkcms.rb
forkcms_deploy-4.4.6 lib/forkcms_deploy/forkcms.rb
forkcms_deploy-4.4.5 lib/forkcms_deploy/forkcms.rb
forkcms_deploy-4.4.4 lib/forkcms_deploy/forkcms.rb
forkcms_deploy-4.4.3 lib/forkcms_deploy/forkcms.rb
forkcms_deploy-4.4.2 lib/forkcms_deploy/forkcms.rb
forkcms_deploy-4.4.1 lib/forkcms_deploy/forkcms.rb
forkcms_deploy-4.2.0 lib/forkcms_deploy/forkcms.rb
forkcms_deploy-4.1.0 lib/forkcms_deploy/forkcms.rb
forkcms_deploy-4.0.1 lib/forkcms_deploy/forkcms.rb
forkcms_deploy-4.0.0 lib/forkcms_deploy/forkcms.rb
forkcms_deploy-2.7.1 lib/forkcms_deploy/forkcms.rb
forkcms_deploy-2.7.0 lib/forkcms_deploy/forkcms.rb
forkcms_deploy-2.6.1 lib/forkcms_deploy/forkcms.rb
forkcms_deploy-2.6.0 lib/forkcms_deploy/forkcms.rb
forkcms_deploy-2.5.0 lib/forkcms_deploy/forkcms.rb
forkcms_deploy-2.4.2 lib/forkcms_deploy/forkcms.rb