dandelion 0.2.2 → 0.2.3

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 CHANGED
@@ -15,17 +15,17 @@ Alternatively, you can build the gem yourself:
15
15
 
16
16
  Config
17
17
  ------
18
- Configuration options are specified in a YAML file (Dandelion looks for
19
- `dandelion.yml` by default). Example:
18
+ Configuration options are specified in a YAML file (the root of your Git repository
19
+ is searched for a file named `dandelion.yml` by default). Example:
20
20
 
21
21
  # Required
22
22
  scheme: sftp
23
23
  host: example.com
24
24
  username: user
25
25
  password: pass
26
- path: path/to/deployment
27
26
 
28
27
  # Optional
28
+ path: path/to/deployment
29
29
  exclude:
30
30
  - .gitignore
31
31
  - dandelion.yml
@@ -53,7 +53,7 @@ Optional: `path`, `exclude`
53
53
 
54
54
  Usage
55
55
  -----
56
- From the root directory of a Git repository, run:
56
+ From within your Git repository, run:
57
57
 
58
58
  $ dandelion deploy
59
59
 
@@ -68,11 +68,17 @@ files which have changed since the last deployment need to be transferred.
68
68
  For a more complete summary of usage options, run:
69
69
 
70
70
  $ dandelion -h
71
- Usage: dandelion [options] [[command] [options]]
71
+ Usage: dandelion [options] [[command] [options]] [config_file]
72
72
  -v, --version Display the current version
73
73
  -h, --help Display this screen
74
74
  --repo=[REPO] Use the given repository
75
75
 
76
76
  Available commands:
77
77
  deploy
78
- status
78
+ status
79
+
80
+ Or:
81
+
82
+ $ dandelion COMMAND -h
83
+
84
+ To see the options for a given command.
data/lib/dandelion/cli.rb CHANGED
@@ -9,11 +9,9 @@ require 'yaml'
9
9
  module Dandelion
10
10
  module Cli
11
11
  class Options
12
- attr_reader :config_file
13
-
14
12
  def initialize
15
13
  @options = {}
16
- @config_file = 'dandelion.yml'
14
+ @config_file = nil
17
15
  @global = global_parser
18
16
  @commands = { 'deploy' => deploy_parser, 'status' => status_parser }
19
17
  @commands_help = "\nAvailable commands:\n #{@commands.keys.join("\n ")}"
@@ -47,8 +45,20 @@ module Dandelion
47
45
  @options[key] = value
48
46
  end
49
47
 
48
+ def config_file
49
+ @config_file || File.join(@options[:repo], 'dandelion.yml')
50
+ end
51
+
50
52
  private
51
53
 
54
+ def closest_repo(dir)
55
+ if File.exists?(File.join(dir, '.git'))
56
+ dir
57
+ else
58
+ File.dirname(dir) != dir && closest_repo(File.dirname(dir))
59
+ end
60
+ end
61
+
52
62
  def global_parser
53
63
  OptionParser.new do |opts|
54
64
  opts.banner = 'Usage: dandelion [options] [[command] [options]]'
@@ -64,7 +74,7 @@ module Dandelion
64
74
  exit
65
75
  end
66
76
 
67
- @options[:repo] = '.'
77
+ @options[:repo] = closest_repo(File.expand_path('.'))
68
78
  opts.on('--repo=[REPO]', 'Use the given repository') do |repo|
69
79
  @options[:repo] = repo
70
80
  end
@@ -1,3 +1,3 @@
1
1
  module Dandelion
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dandelion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-05-25 00:00:00.000000000 -04:00
12
+ date: 2011-06-08 00:00:00.000000000 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: grit
17
- requirement: &2157532620 !ruby/object:Gem::Requirement
17
+ requirement: &2153656700 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 2.4.1
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2157532620
25
+ version_requirements: *2153656700
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: mocha
28
- requirement: &2157532120 !ruby/object:Gem::Requirement
28
+ requirement: &2153656200 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 0.9.12
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *2157532120
36
+ version_requirements: *2153656200
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: net-sftp
39
- requirement: &2157531660 !ruby/object:Gem::Requirement
39
+ requirement: &2153683620 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 2.0.5
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *2157531660
47
+ version_requirements: *2153683620
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: aws-s3
50
- requirement: &2157531200 !ruby/object:Gem::Requirement
50
+ requirement: &2153683160 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,7 +55,7 @@ dependencies:
55
55
  version: 0.6.0
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *2157531200
58
+ version_requirements: *2153683160
59
59
  description: Incremental Git repository deployment
60
60
  email:
61
61
  - scottbnel@gmail.com
@@ -135,7 +135,7 @@ rubyforge_project:
135
135
  rubygems_version: 1.6.2
136
136
  signing_key:
137
137
  specification_version: 3
138
- summary: dandelion-0.2.2
138
+ summary: dandelion-0.2.3
139
139
  test_files:
140
140
  - test/fixtures/diff
141
141
  - test/fixtures/ls_tree