forkcms_deploy 2.4.1 → 2.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.4.1
1
+ 2.4.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "forkcms_deploy"
8
- s.version = "2.4.1"
8
+ s.version = "2.4.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tijs Verkoyen", "Jan De Poorter", "Sam Tubbax"]
12
- s.date = "2013-01-14"
12
+ s.date = "2013-07-23"
13
13
  s.description = "Deployment for ForkCMS with Capistrano"
14
14
  s.email = "info@sumocoders.be"
15
15
  s.extra_rdoc_files = [
@@ -34,7 +34,7 @@ Gem::Specification.new do |s|
34
34
  ]
35
35
  s.homepage = "https://github.com/sumocoders/forkcms_deploy"
36
36
  s.require_paths = ["lib"]
37
- s.rubygems_version = "1.8.24"
37
+ s.rubygems_version = "1.8.25"
38
38
  s.summary = "Deployment for ForkCMS with Capistrano"
39
39
 
40
40
  if s.respond_to? :specification_version then
@@ -1,13 +1,30 @@
1
1
  module ForkCMSDeploy
2
2
  class ForkCMS
3
+ ForkLibPath = File.dirname(__FILE__) + '/../forkcms_deploy'
4
+
3
5
  def self.determine_version_to_use(version)
4
- until version.empty?
5
- if File.exists?(File.dirname(__FILE__) + "/../forkcms_deploy/forkcms_#{version}.rb")
6
- return version
6
+ versions = version.split('.')
7
+ until versions.empty?
8
+ # Exact version match
9
+ if File.exists?(ForkLibPath + "/forkcms_#{versions.join('.')}.rb")
10
+ return versions.join('.')
11
+ else
12
+ level_version = versions.pop
13
+
14
+ # Find a version that might match on the same level
15
+ matching_level = Dir.glob(ForkLibPath + "/forkcms_#{versions.join('.')}.[0-9]*.rb")
16
+ matching_level.sort.reverse.each do |file|
17
+ # Extract the file's level-version from the path
18
+ file_version = file[/(\d+).rb$/, 1]
19
+
20
+ # Return this version if the file's version is lower then the Fork version
21
+ # (such that, for Fork 3.6, 3.5 is loaded, but not for Fork 3.4
22
+ return (versions + [file_version]).join('.') if file_version < level_version
23
+ end
7
24
  end
8
- version = version.sub(/\.?[^\.]+$/, '')
9
25
  end
26
+
10
27
  return "default"
11
28
  end
12
29
  end
13
- end
30
+ end
@@ -3,10 +3,12 @@ require 'forkcms_deploy/forkcms.rb'
3
3
 
4
4
  class TestForkCMS < Test::Unit::TestCase
5
5
  def test_versions
6
- assert_equal "3", ForkCMSDeploy::ForkCMS.determine_version_to_use("3.4") # 3
6
+ assert_equal "3.5", ForkCMSDeploy::ForkCMS.determine_version_to_use("3.6") # 3
7
+ assert_equal "3.5", ForkCMSDeploy::ForkCMS.determine_version_to_use("3.5") # 3
8
+ assert_equal "3", ForkCMSDeploy::ForkCMS.determine_version_to_use("3.3") # 3
7
9
  assert_equal "3", ForkCMSDeploy::ForkCMS.determine_version_to_use("3") # 3
8
10
  assert_equal "2", ForkCMSDeploy::ForkCMS.determine_version_to_use("2") # 2
9
11
  assert_equal "default", ForkCMSDeploy::ForkCMS.determine_version_to_use("1") # default
10
12
  assert_equal "default", ForkCMSDeploy::ForkCMS.determine_version_to_use("1.2.3") # default
11
13
  end
12
- end
14
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forkcms_deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.1
4
+ version: 2.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-01-14 00:00:00.000000000 Z
14
+ date: 2013-07-23 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: capistrano
@@ -71,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  version: '0'
72
72
  requirements: []
73
73
  rubyforge_project:
74
- rubygems_version: 1.8.24
74
+ rubygems_version: 1.8.25
75
75
  signing_key:
76
76
  specification_version: 3
77
77
  summary: Deployment for ForkCMS with Capistrano