fpm-cookery 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ # v0.5.0 (2011-11-05)
2
+ * Add git source handler.
3
+
1
4
  # v0.4.0 (2011-10-28)
2
5
  * Add svn source handler. (lusis)
3
6
  * Framework for alternate source handlers. (lusis)
data/README.md CHANGED
@@ -53,7 +53,7 @@ __fpm-cookery__ is my attempt to build such a tool.
53
53
  * Apply custom patches.
54
54
  * Dependency checking.
55
55
  * Recipe validation.
56
- * More source types. (git, svn, ...)
56
+ * More source types. (hg, bzr, ...)
57
57
  * Progress output and logging.
58
58
  * Extend recipe features and build/install helpers.
59
59
  * Configuration file. (for stuff like vendor and maintainer)
@@ -132,7 +132,6 @@ The following is an example recipe. I have some more in my recipe collection
132
132
  * No recipe validation yet.
133
133
  * No dependency validation yet.
134
134
  * No support for patches yet.
135
- * Only simple source/url types (via curl) for now.
136
135
  * No real logging output yet.
137
136
  * Pretty new and not well tested.
138
137
 
@@ -0,0 +1,57 @@
1
+ require 'fpm/cookery/source_handler/template'
2
+
3
+ module FPM
4
+ module Cookery
5
+ class SourceHandler
6
+ class Git < FPM::Cookery::SourceHandler::Template
7
+ CHECKSUM = false
8
+ NAME = :git
9
+
10
+ def fetch
11
+ if local_path.exist?
12
+ Dir.chdir(local_path) do
13
+ git('fetch', url)
14
+ end
15
+ else
16
+ Dir.chdir(cachedir) do
17
+ git('clone', url, local_path)
18
+ end
19
+ end
20
+
21
+ local_path
22
+ end
23
+
24
+ def extract
25
+ extracted_source = (builddir/local_path.basename('.git').to_s).to_s
26
+
27
+ Dir.chdir(local_path) do
28
+ if options[:sha]
29
+ git('reset', '--hard', options[:sha])
30
+ extracted_source << "-#{options[:sha]}"
31
+ elsif options[:tag]
32
+ git('checkout', '-f', options[:tag])
33
+ extracted_source << "-tag-#{options[:tag]}"
34
+ elsif options[:branch]
35
+ git('checkout', '-f', "origin/#{options[:branch]}")
36
+ extracted_source << "-branch-#{options[:branch]}"
37
+ else
38
+ git('checkout', '-f', 'origin/HEAD')
39
+ extracted_source << '-HEAD'
40
+ end
41
+
42
+ # Trailing '/' is important! (see git-checkout-index(1))
43
+ git('checkout-index', '-a', '-f', "--prefix=#{extracted_source}/")
44
+ end
45
+
46
+ extracted_source
47
+ end
48
+
49
+ private
50
+ def git(command, *args)
51
+ #puts "[DEBUG] git #{command} #{args.join(' ')}"
52
+ safesystem('git', command, *args)
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -25,7 +25,7 @@ module FPM
25
25
 
26
26
  private
27
27
  def svn(url, path)
28
- @options.has_key?(:revision) ? revision=@options[:revision] : revision='HEAD'
28
+ revision = options[:revision] || 'HEAD'
29
29
  safesystem('svn', 'export', '--force', '-q', '-r', revision, url, path)
30
30
  end
31
31
 
@@ -1,6 +1,7 @@
1
1
  require 'forwardable'
2
2
  require 'fpm/cookery/source_handler/curl'
3
3
  require 'fpm/cookery/source_handler/svn'
4
+ require 'fpm/cookery/source_handler/git'
4
5
 
5
6
  module FPM
6
7
  module Cookery
@@ -1,5 +1,5 @@
1
1
  module FPM
2
2
  module Cookery
3
- VERSION = '0.4.0'
3
+ VERSION = '0.5.0'
4
4
  end
5
5
  end
@@ -1,8 +1,15 @@
1
1
  class Redis < FPM::Cookery::Recipe
2
2
  homepage 'http://redis.io'
3
- # different source methods
3
+
4
+ # Different source methods.
5
+ #
4
6
  #source 'https://github.com/antirez/redis/trunk', :with => :svn
5
7
  #source 'https://github.com/antirez/redis/trunk', :with => :svn, :revision => '2400'
8
+ #
9
+ #source 'https://github.com/antirez/redis', :with => :git, :tag => '2.4.2
10
+ #source 'https://github.com/antirez/redis', :with => :git, :branch => '2.4'
11
+ #source 'https://github.com/antirez/redis', :with => :git, :sha => '072a905'
12
+
6
13
  source 'http://redis.googlecode.com/files/redis-2.4.2.tar.gz'
7
14
  md5 'c4b0b5e4953a11a503cb54cf6b09670e'
8
15
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fpm-cookery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-28 00:00:00.000000000 Z
12
+ date: 2011-11-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fpm
16
- requirement: &84112030 !ruby/object:Gem::Requirement
16
+ requirement: &80020110 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *84112030
24
+ version_requirements: *80020110
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: minitest
27
- requirement: &84111800 !ruby/object:Gem::Requirement
27
+ requirement: &80019860 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *84111800
35
+ version_requirements: *80019860
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &84127950 !ruby/object:Gem::Requirement
38
+ requirement: &80019630 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *84127950
46
+ version_requirements: *80019630
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: fpm
49
- requirement: &84127720 !ruby/object:Gem::Requirement
49
+ requirement: &80019400 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *84127720
57
+ version_requirements: *80019400
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: facter
60
- requirement: &84127470 !ruby/object:Gem::Requirement
60
+ requirement: &80019160 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *84127470
68
+ version_requirements: *80019160
69
69
  description: A tool for building software packages with fpm.
70
70
  email:
71
71
  - bernd@tuneafish.de
@@ -92,6 +92,7 @@ files:
92
92
  - lib/fpm/cookery/recipe.rb
93
93
  - lib/fpm/cookery/source_handler.rb
94
94
  - lib/fpm/cookery/source_handler/curl.rb
95
+ - lib/fpm/cookery/source_handler/git.rb
95
96
  - lib/fpm/cookery/source_handler/svn.rb
96
97
  - lib/fpm/cookery/source_handler/template.rb
97
98
  - lib/fpm/cookery/source_integrity_check.rb
@@ -127,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
128
  version: '0'
128
129
  requirements: []
129
130
  rubyforge_project: fpm-cookery
130
- rubygems_version: 1.8.5
131
+ rubygems_version: 1.8.10
131
132
  signing_key:
132
133
  specification_version: 3
133
134
  summary: A tool for building software packages with fpm.