dandelion 0.1.1 → 0.1.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/README.md ADDED
@@ -0,0 +1,38 @@
1
+ dandelion
2
+ =========
3
+
4
+ Install
5
+ -------
6
+ Ensure that Ruby and RubyGems are installed, then run:
7
+
8
+ $ gem install dandelion
9
+
10
+ Alternatively, you can build the gem yourself:
11
+
12
+ $ git clone git://github.com/scottbnel/dandelion.git
13
+ $ cd dandelion
14
+ $ rake install
15
+
16
+ Usage
17
+ -----
18
+ Deployment options are specified in a YAML file. By default, Dandelion looks for
19
+ one named `dandelion.yml`, however, this can be overridden by passing a path as an
20
+ argument.
21
+
22
+ scheme: sftp
23
+ host: example.com
24
+ username: user
25
+ password: pass
26
+ path: path/to/deployment
27
+
28
+ exclude:
29
+ - .gitignore
30
+ - dandelion.yml
31
+
32
+ To deploy the HEAD revision, ensure you are in the root of the repository and run:
33
+
34
+ $ dandelion
35
+
36
+ If the repository has previously been deployed then only the files that have
37
+ changed since the last deployment will be transferred. All files (except those
38
+ excluded) will be transferred on first deployment.
data/lib/dandelion.rb CHANGED
@@ -9,9 +9,15 @@ module Dandelion
9
9
  puts 'Not a git repository: .git'
10
10
  exit
11
11
  end
12
+
13
+ if ARGV[0]
14
+ config_file = ARGV[0].strip
15
+ else
16
+ config_file = 'dandelion.yml'
17
+ end
12
18
 
13
- unless File.exists? 'deploy.yml'
14
- puts 'Could not find file: deploy.yml'
19
+ unless File.exists? config_file
20
+ puts "Could not find file: #{config_file}"
15
21
  exit
16
22
  end
17
23
 
@@ -34,25 +34,41 @@ module Deployment
34
34
  end
35
35
 
36
36
  def deploy
37
- if remote_revision != local_revision
38
- @diff.changed.each do |file|
39
- unless @exclude.include?(file)
40
- puts "Uploading file: #{file}"
41
- @service.write(file, @tree.show(file))
42
- end
43
- end
44
- @diff.deleted.each do |file|
45
- unless @exclude.include?(file)
46
- puts "Deleting file: #{file}"
47
- @service.delete(file)
48
- end
49
- end
37
+ if remote_revision != local_revision && any?
38
+ deploy_changed
39
+ deploy_deleted
50
40
  write_revision
51
41
  else
52
42
  puts "Nothing to deploy"
53
43
  end
54
44
  end
55
45
 
46
+ def deploy_changed
47
+ @diff.changed.each do |file|
48
+ if @exclude.include?(file)
49
+ puts "Skipping file: #{file}"
50
+ else
51
+ puts "Uploading file: #{file}"
52
+ @service.write(file, @tree.show(file))
53
+ end
54
+ end
55
+ end
56
+
57
+ def deploy_deleted
58
+ @diff.deleted.each do |file|
59
+ if @exclude.include?(file)
60
+ puts "Skipping file: #{file}"
61
+ else
62
+ puts "Deleting file: #{file}"
63
+ @service.delete(file)
64
+ end
65
+ end
66
+ end
67
+
68
+ def any?
69
+ @diff.changed.any? || @diff.deleted.any?
70
+ end
71
+
56
72
  private
57
73
 
58
74
  def read_revision
@@ -1,3 +1,3 @@
1
1
  module Dandelion
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 1
9
- version: 0.1.1
8
+ - 2
9
+ version: 0.1.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Scott Nelson
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-21 00:00:00 -05:00
17
+ date: 2011-01-31 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -59,6 +59,7 @@ extra_rdoc_files: []
59
59
  files:
60
60
  - .gitignore
61
61
  - Gemfile
62
+ - README.md
62
63
  - Rakefile
63
64
  - bin/dandelion
64
65
  - dandelion.gemspec
@@ -98,6 +99,6 @@ rubyforge_project:
98
99
  rubygems_version: 1.3.7
99
100
  signing_key:
100
101
  specification_version: 3
101
- summary: dandelion-0.1.1
102
+ summary: dandelion-0.1.2
102
103
  test_files: []
103
104