dandelion 0.3.12 → 0.3.13

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -3,3 +3,4 @@
3
3
  Gemfile.lock
4
4
  pkg/*
5
5
  .DS_Store
6
+ .ruby-version
data/README.md CHANGED
@@ -1,10 +1,12 @@
1
1
  Dandelion
2
2
  =========
3
+
3
4
  Incremental Git repository deployment.
4
5
 
5
6
  Install
6
7
  -------
7
- Ensure that Ruby and RubyGems are installed, then run:
8
+
9
+ Ensure that Ruby is installed, then run:
8
10
 
9
11
  $ gem install dandelion
10
12
 
@@ -16,42 +18,47 @@ Alternatively, you can build the gem yourself:
16
18
 
17
19
  Config
18
20
  ------
21
+
19
22
  Configuration options are specified in a YAML file (by default, the root of your
20
- Git repository is searched for a file named `dandelion.yml`). Example:
23
+ Git repository is searched for a file named `dandelion.yml`).
21
24
 
22
- # Required
23
- # --------
25
+ Example:
24
26
 
25
- scheme: sftp
26
- host: example.com
27
- username: user
28
- password: pass
27
+ ```yaml
28
+ scheme: sftp
29
+ host: example.com
30
+ username: user
31
+ password: pass
32
+ path: path/to/deployment
29
33
 
30
- # Optional
31
- # --------
34
+ exclude:
35
+ - .gitignore
36
+ - dandelion.yml
37
+ - folder/
32
38
 
33
- # Remote path
34
- path: path/to/deployment
39
+ additional:
40
+ - public/css/print.css
41
+ - public/css/screen.css
42
+ - public/js/main.js
43
+ ```
35
44
 
36
- # Local Path
37
- local_path: path/in/repo
45
+ Required:
46
+
47
+ * `scheme` (the file transfer scheme, see below)
38
48
 
39
- # Remote file name in which the current revision is stored
40
- revision_file: .revision
49
+ Optional:
41
50
 
42
- # These files (from Git) will not be uploaded during a deploy
43
- exclude:
44
- - .gitignore
45
- - dandelion.yml
51
+ * `path` (relative path from root of remote file tree, defaults to the root)
52
+ * `local_path` (relative path from root of local repository, defaults to repository root)
53
+ * `exclude` (list of files or directories to exclude from deployment, if `local_path` is set files are relative to that path)
54
+ * `additional` (additional list of files from your working directory that will be deployed)
55
+ * `revision_file` (remote file in which revision SHA is stored, defaults to .revision)
46
56
 
47
- # These files (from your working directory) will be uploaded on every deploy
48
- additional:
49
- - public/css/print.css
50
- - public/css/screen.css
51
- - public/js/main.js
57
+ Each scheme also has additional required and optional configuration parameters (see below).
52
58
 
53
59
  Schemes
54
60
  -------
61
+
55
62
  There is support for multiple backend file transfer schemes. The configuration
56
63
  must specify one of these schemes and the set of additional parameters required
57
64
  by the given scheme.
@@ -66,12 +73,7 @@ Required:
66
73
 
67
74
  Optional:
68
75
 
69
- * `path`
70
- * `local_path` (defaults to repository root)
71
- * `exclude` (if local_path is set, files are relative to that path)
72
- * `additional`
73
- * `port`
74
- * `revision_file` (defaults to .revision)
76
+ * `port` (defaults to 22)
75
77
  * `preserve_permissions` (defaults to true)
76
78
 
77
79
  **FTP**: `scheme: ftp`
@@ -84,12 +86,7 @@ Required:
84
86
 
85
87
  Optional:
86
88
 
87
- * `path`
88
- * `local_path` (defaults to repository root)
89
- * `exclude` (if local_path is set, files are relative to that path)
90
- * `additional`
91
- * `port`
92
- * `revision_file` (defaults to .revision)
89
+ * `port` (defaults to 21)
93
90
  * `passive` (defaults to true)
94
91
 
95
92
  **Amazon S3**: `scheme: s3`
@@ -100,16 +97,9 @@ Required:
100
97
  * `secret_access_key`
101
98
  * `bucket_name`
102
99
 
103
- Optional:
104
-
105
- * `path`
106
- * `local_path` (defaults to repository root)
107
- * `exclude` (if local_path is set, files are relative to that path)
108
- * `additional`
109
- * `revision_file` (defaults to .revision)
110
-
111
100
  Usage
112
101
  -----
102
+
113
103
  From within your Git repository, run:
114
104
 
115
105
  $ dandelion deploy
data/dandelion.gemspec CHANGED
@@ -11,6 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.homepage = 'http://github.com/scttnlsn/dandelion'
12
12
  s.summary = "dandelion-#{s.version}"
13
13
  s.description = 'Incremental Git repository deployment'
14
+ s.license = 'MIT'
14
15
 
15
16
  s.add_dependency 'grit', '>= 2.4.1'
16
17
 
data/lib/dandelion/git.rb CHANGED
@@ -19,12 +19,9 @@ module Dandelion
19
19
  def initialize(repo, from_revision, to_revision, local_path)
20
20
  @repo = repo
21
21
  @local_path = local_path
22
- @from_revision = from_revision
23
- @to_revision = to_revision
24
- unless @local_path.nil? || @local_path.empty?
25
- @from_revision = "#{@from_revision}:#{@local_path}"
26
- @to_revision = "#{@to_revision}:#{@local_path}"
27
- end
22
+ @from_revision = revision_string(from_revision)
23
+ @to_revision = revision_string(to_revision)
24
+
28
25
  begin
29
26
  @files = parse(diff)
30
27
  rescue Grit::Git::CommandFailed
@@ -43,7 +40,7 @@ module Dandelion
43
40
  private
44
41
 
45
42
  def diff
46
- @repo.git.native(:diff, {:name_status => true, :raise => true}, @from_revision, @to_revision)
43
+ @repo.git.native(:diff, { :name_status => true, :raise => true }, @from_revision, @to_revision)
47
44
  end
48
45
 
49
46
  def parse(diff)
@@ -54,6 +51,14 @@ module Dandelion
54
51
  end
55
52
  files
56
53
  end
54
+
55
+ def revision_string(revision)
56
+ if @local_path.nil? || @local_path.empty?
57
+ revision
58
+ else
59
+ "#{revision}:#{@local_path}"
60
+ end
61
+ end
57
62
  end
58
63
 
59
64
  class Tree
@@ -67,23 +72,43 @@ module Dandelion
67
72
  end
68
73
 
69
74
  def files
70
- @revision = "#{@revision}:#{@local_path}" unless @local_path.nil? || @local_path.empty?
71
- @repo.git.native(:ls_tree, {:name_only => true, :full_tree => true, :r => true}, @revision).split("\n")
75
+ @repo.git.native(:ls_tree, { :name_only => true, :full_tree => true, :r => true }, revision_string).split("\n")
72
76
  end
73
77
 
74
78
  def show(file)
75
- @file = file
76
- @file = "#{@local_path}/#{file}" unless @local_path.nil? || @local_path.empty?
77
- if (@tree / "#{@file}").is_a?(Grit::Submodule)
79
+ blob = @tree / file_path(file)
80
+ if blob.is_a?(Grit::Submodule)
78
81
  puts "#{file} is a submodule, ignoring."
79
- return
82
+ else
83
+ blob.data
80
84
  end
81
- (@tree / "#{@file}").data
82
85
  end
83
86
 
84
87
  def revision
85
88
  @commit.sha
86
89
  end
90
+
91
+ private
92
+
93
+ def file_path(file)
94
+ if local_path?
95
+ File.join(@local_path, file)
96
+ else
97
+ file
98
+ end
99
+ end
100
+
101
+ def revision_string
102
+ if local_path?
103
+ "#{@revision}:#{@local_path}"
104
+ else
105
+ @revision
106
+ end
107
+ end
108
+
109
+ def local_path?
110
+ !@local_path.nil? && !@local_path.empty?
111
+ end
87
112
  end
88
113
  end
89
114
  end
@@ -1,3 +1,3 @@
1
1
  module Dandelion
2
- VERSION = '0.3.12'
2
+ VERSION = '0.3.13'
3
3
  end
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: dandelion
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.12
5
+ version: 0.3.13
6
6
  platform: ruby
7
7
  authors:
8
8
  - Scott Nelson
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-23 00:00:00.000000000 Z
12
+ date: 2013-10-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  version_requirements: !ruby/object:Gem::Requirement
@@ -135,7 +135,8 @@ files:
135
135
  - test/test_git.rb
136
136
  - test/test_sftp.rb
137
137
  homepage: http://github.com/scttnlsn/dandelion
138
- licenses: []
138
+ licenses:
139
+ - MIT
139
140
  post_install_message:
140
141
  rdoc_options: []
141
142
  require_paths:
@@ -157,7 +158,7 @@ rubyforge_project:
157
158
  rubygems_version: 1.8.23
158
159
  signing_key:
159
160
  specification_version: 3
160
- summary: dandelion-0.3.12
161
+ summary: dandelion-0.3.13
161
162
  test_files:
162
163
  - test/fixtures/diff
163
164
  - test/fixtures/ls_tree