chrysalis 0.1.0

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.
@@ -0,0 +1,67 @@
1
+ require 'uri'
2
+ require 'pathname'
3
+ require 'chrysalis/repository'
4
+ require 'chrysalis/ar'
5
+
6
+
7
+ module Chrysalis
8
+ module VCS
9
+ module HTTP
10
+
11
+ # Implements support for downloading dependencies from a web server.
12
+ #
13
+ # Repositories of this type are identified by <em>http://</em> URLs.
14
+ #
15
+ # Example:
16
+ # - http://www.example.com/dist/libfoo-1.2.8.tar.gz
17
+
18
+ class Repository < Chrysalis::Repository
19
+
20
+ def self.retrieves?(url, params = {})
21
+ uri = URI::parse(url)
22
+ return (uri.scheme == 'http' || uri.scheme == 'https')
23
+ end
24
+
25
+
26
+ def initialize(url, params = {})
27
+ @url = url
28
+ @params = params
29
+ end
30
+
31
+ def retrieve(to = '.')
32
+ path = Pathname.new(to).join(download_to)
33
+ raise IOError, "Refusing to overwrite existing path. (path: #{path})" if path.exist?
34
+
35
+ unless @params[:noop]
36
+ puts ""
37
+ puts "Downloading #{@url} ..."
38
+
39
+ location = URI::parse(@url)
40
+ Net::HTTP.start(location.host, location.port) do |http|
41
+ ::File.open(path, 'w') do |f|
42
+ http.get(location.path) do |stream|
43
+ f.write stream
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ extract_path = Archive.extract(path.to_s, to, @params)
50
+ WorkingCopy.new(:url => @url,
51
+ :path => extract_path)
52
+ end
53
+
54
+ private
55
+ def download_to
56
+ uri = URI::parse(@url)
57
+ file = uri.path.split('/')[-1]
58
+
59
+ raise ParameterError, "Invalid URL. (URL: #{@url})" if file.nil?
60
+ return file
61
+ end
62
+
63
+ end
64
+
65
+ end
66
+ end
67
+ end
@@ -0,0 +1 @@
1
+ require 'chrysalis/vcs/http/repository'
@@ -0,0 +1,88 @@
1
+ require 'uri'
2
+ require 'pathname'
3
+ require 'chrysalis/repository'
4
+ require 'chrysalis/core_ext/string'
5
+
6
+
7
+ module Chrysalis
8
+ module VCS
9
+ module Subversion
10
+
11
+ # Implements support for checking out dependencies from a Subversion
12
+ # repository.
13
+ #
14
+ # Repositories of this type are identified by <em>svn://</em>,
15
+ # <em>svn+ssh://</em>, <em>http://</em>, or <em>https://</em> URLs.
16
+ #
17
+ # Example:
18
+ # - http://svn.example.com/libfoo/trunk
19
+ # - http://code.example.com/svn/libfoo/trunk
20
+ # - svn://repository.local/libfoo/trunk
21
+ # - svn+ssh://ssh.example.com/libfoo/trunk
22
+
23
+ class Repository < Chrysalis::Repository
24
+
25
+ def self.retrieves?(url, params = {})
26
+ if params[:repository]
27
+ return (params[:repository] == 'svn' || params[:repository] == 'subversion')
28
+ end
29
+
30
+ uri = URI::parse(url)
31
+ return true if (uri.scheme == 'svn' || uri.scheme == 'svn+ssh')
32
+ return false if (uri.scheme != 'http' && uri.scheme != 'https')
33
+ return true if uri.host.begin? 'svn'
34
+ return true if uri.path.split('/').include? 'svn'
35
+
36
+ false
37
+ end
38
+
39
+
40
+ def initialize(url, params = {})
41
+ @url = url
42
+ @params = params
43
+ end
44
+
45
+ def retrieve(to = '.')
46
+ path = Pathname.new(to).join(checkout_to)
47
+ raise IOError, "Refusing to overwrite existing path. (path: #{path})" if path.exist?
48
+
49
+ unless @params[:noop]
50
+ puts ""
51
+ puts "Checking out #{@url} ..."
52
+ sh "svn co #{@url} #{path.cleanpath}"
53
+ end
54
+
55
+ WorkingCopy.new(:url => @url,
56
+ :path => path.cleanpath.to_s)
57
+ end
58
+
59
+ private
60
+ def checkout_to
61
+ return @params[:checkout_to] if @params[:checkout_to]
62
+
63
+ components = URI::parse(@url).path.split('/')
64
+ directory = components[-1]
65
+
66
+ raise ParameterError, "Invalid URL. (URL: #{@url})" if directory.nil?
67
+
68
+ if components[-1] == 'trunk'
69
+ directory = components[-2]
70
+ elsif components[-2] == 'branches' || components[-2] == 'tags'
71
+ directory = components[-3]
72
+ end
73
+
74
+ return directory
75
+ end
76
+
77
+ end
78
+
79
+
80
+ class WorkingCopy < Chrysalis::WorkingCopy
81
+ def self.type
82
+ :subversion
83
+ end
84
+ end
85
+
86
+ end
87
+ end
88
+ end
@@ -0,0 +1 @@
1
+ require 'chrysalis/vcs/svn/repository'
@@ -0,0 +1,3 @@
1
+ require 'chrysalis/vcs/file'
2
+ require 'chrysalis/vcs/http'
3
+ require 'chrysalis/vcs/svn'
@@ -0,0 +1,3 @@
1
+ module Chrysalis
2
+ VERSION = '0.1.0'.freeze
3
+ end
data/lib/chrysalis.rb ADDED
@@ -0,0 +1,28 @@
1
+ #--
2
+ # Copyright (c) 2007 Jared Hanson
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ # of this software and associated documentation files (the "Software"), to deal
6
+ # in the Software without restriction, including without limitation the rights
7
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ # copies of the Software, and to permit persons to whom the Software is
9
+ # furnished to do so, subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in
12
+ # all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ # THE SOFTWARE.
21
+ #++
22
+
23
+ require 'rake'
24
+ require 'chrysalis/rake_ext/intercept'
25
+ require 'chrysalis/version'
26
+ require 'chrysalis/task'
27
+ require 'chrysalis/manifest'
28
+ require 'chrysalis/project'
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.4
3
+ specification_version: 1
4
+ name: chrysalis
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.1.0
7
+ date: 2007-12-09 00:00:00 -08:00
8
+ summary: Simple dependency management with Ruby and Rake.
9
+ require_paths:
10
+ - lib
11
+ email: jaredhanson@gmail.com
12
+ homepage: http://chrysalis.rubyforge.org/
13
+ rubyforge_project: chrysalis
14
+ description:
15
+ autorequire:
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: false
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
29
+ authors:
30
+ - Jared Hanson
31
+ files:
32
+ - LICENSE
33
+ - Rakefile
34
+ - README
35
+ - lib/chrysalis
36
+ - lib/chrysalis/ar
37
+ - lib/chrysalis/ar/tar.rb
38
+ - lib/chrysalis/ar/tar_bz2.rb
39
+ - lib/chrysalis/ar/tar_gz.rb
40
+ - lib/chrysalis/ar/zip.rb
41
+ - lib/chrysalis/ar.rb
42
+ - lib/chrysalis/archive.rb
43
+ - lib/chrysalis/core_ext
44
+ - lib/chrysalis/core_ext/string.rb
45
+ - lib/chrysalis/errors.rb
46
+ - lib/chrysalis/loader.rb
47
+ - lib/chrysalis/manifest.rb
48
+ - lib/chrysalis/project.rb
49
+ - lib/chrysalis/rake_ext
50
+ - lib/chrysalis/rake_ext/intercept.rb
51
+ - lib/chrysalis/repository.rb
52
+ - lib/chrysalis/task.rb
53
+ - lib/chrysalis/vcs
54
+ - lib/chrysalis/vcs/file
55
+ - lib/chrysalis/vcs/file/repository.rb
56
+ - lib/chrysalis/vcs/file.rb
57
+ - lib/chrysalis/vcs/http
58
+ - lib/chrysalis/vcs/http/repository.rb
59
+ - lib/chrysalis/vcs/http.rb
60
+ - lib/chrysalis/vcs/svn
61
+ - lib/chrysalis/vcs/svn/repository.rb
62
+ - lib/chrysalis/vcs/svn.rb
63
+ - lib/chrysalis/vcs.rb
64
+ - lib/chrysalis/version.rb
65
+ - lib/chrysalis.rb
66
+ test_files: []
67
+
68
+ rdoc_options: []
69
+
70
+ extra_rdoc_files: []
71
+
72
+ executables: []
73
+
74
+ extensions: []
75
+
76
+ requirements: []
77
+
78
+ dependencies:
79
+ - !ruby/object:Gem::Dependency
80
+ name: rake
81
+ version_requirement:
82
+ version_requirements: !ruby/object:Gem::Version::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: 0.7.3
87
+ version:
88
+ - !ruby/object:Gem::Dependency
89
+ name: gratr
90
+ version_requirement:
91
+ version_requirements: !ruby/object:Gem::Version::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: 0.4.3
96
+ version: