dandelion 0.4.5 → 0.4.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5520acb69585608fbf7087b4bb2ca2d37a7ba767
4
- data.tar.gz: bcfa8fae2c7324ee5dfebf64d54f6f3aa38b1504
3
+ metadata.gz: 2e24ed3bb3d909f2dde31c896dc0a55ba7bea103
4
+ data.tar.gz: 40301d574cfbd917d0ccc85da4449ff79f73226e
5
5
  SHA512:
6
- metadata.gz: 0b0b3e1773552af905d074664285fc30f271d2c1dfbceb8fea159bc753cedeb124c0b2462bbc3bbb077c6d600ffc1f2d72acb3df5e0ae313149f710cc2af5b4a
7
- data.tar.gz: 2f9e4b05a622d0a1a61bbdc99a7d23785d3e755b54f751364dedf896476ba0a377cbe073b794096ecf0bbe232321f004c1771a4aa719127a08d60ae48bb5e718
6
+ metadata.gz: a33bd1ff022f1c5f0c0497d52e04b545db4f38b9f69487bd7ebe6d83753e2f3189b057d1b03a670a9057f5b8d9494c2a3e62b7a84b26a0b0fe7d55980ce3fc04
7
+ data.tar.gz: 963b92769bd3ab6c1af4af22662f056776ce801472c9542d726e3e5adb9f3aefecde44700a3744fbc6148c3e517b9c3bf079cc359f03364ffc37c435de2ec2bc
@@ -21,7 +21,11 @@ module Dandelion
21
21
  connect!
22
22
 
23
23
  key = path(file)
24
- policy = AWS::S3::S3Object.acl(key, bucket_name) if @config[:preserve_permissions]
24
+
25
+ begin
26
+ policy = AWS::S3::S3Object.acl(key, bucket_name) if @config[:preserve_permissions]
27
+ rescue AWS::S3::NoSuchKey
28
+ end
25
29
 
26
30
  AWS::S3::S3Object.store(path(file), data, bucket_name)
27
31
  AWS::S3::S3Object.acl(key, bucket_name, policy) unless policy.nil?
data/lib/dandelion/cli.rb CHANGED
@@ -4,10 +4,11 @@ module Dandelion
4
4
  class CLI
5
5
  def initialize(args)
6
6
  @args = args
7
+
7
8
  @options = {}
8
- @parser = Command::Base.parser(@options)
9
-
10
9
  @options[:help] = true if @args.length == 0
10
+
11
+ @parser = Command::Base.parser(@options)
11
12
  end
12
13
 
13
14
  def config
@@ -1,3 +1,3 @@
1
1
  module Dandelion
2
- VERSION = '0.4.5'
2
+ VERSION = '0.4.6'
3
3
  end
@@ -41,18 +41,28 @@ module Dandelion
41
41
  private
42
42
 
43
43
  def lookup(val)
44
- begin
45
- begin
46
- if ref = @repo.ref(val)
47
- val = ref.target.to_s
48
- end
49
- rescue Rugged::ReferenceError
50
- end
51
-
52
- @repo.lookup(val)
53
- rescue Rugged::OdbError, Rugged::InvalidError
54
- raise RevisionError.new(val)
55
- end
44
+ result = lookup_sha(val) ||
45
+ lookup_ref(val) ||
46
+ lookup_ref("refs/tags/#{val}") ||
47
+ lookup_ref("refs/branches/#{val}") ||
48
+ lookup_ref("refs/heads/#{val}")
49
+
50
+ raise RevisionError.new(val) unless result
51
+
52
+ result
53
+ end
54
+
55
+ def lookup_sha(val)
56
+ @repo.lookup(val)
57
+ rescue Rugged::OdbError, Rugged::InvalidError
58
+ nil
59
+ end
60
+
61
+ def lookup_ref(val)
62
+ ref = @repo.ref(val)
63
+ lookup_sha(ref.target) if ref
64
+ rescue Rugged::ReferenceError
65
+ nil
56
66
  end
57
67
 
58
68
  def local_sha
@@ -19,10 +19,28 @@ describe Dandelion::Workspace do
19
19
  end
20
20
 
21
21
  context 'valid revision specified' do
22
- let(:workspace) { Dandelion::Workspace.new(test_repo, adapter, revision: initial_revision) }
22
+ context 'sha' do
23
+ let(:workspace) { Dandelion::Workspace.new(test_repo, adapter, revision: initial_revision) }
23
24
 
24
- it 'returns commit for given revision' do
25
- expect(workspace.local_commit.oid).to eq initial_revision
25
+ it 'returns commit for given revision' do
26
+ expect(workspace.local_commit.oid).to eq initial_revision
27
+ end
28
+ end
29
+
30
+ context 'tag' do
31
+ let(:workspace) { Dandelion::Workspace.new(test_repo, adapter, revision: 'test-tag') }
32
+
33
+ it 'returns commit for given revision' do
34
+ expect(workspace.local_commit.oid).to eq initial_revision
35
+ end
36
+ end
37
+
38
+ context 'branch' do
39
+ let(:workspace) { Dandelion::Workspace.new(test_repo, adapter, revision: 'master') }
40
+
41
+ it 'returns commit for given revision' do
42
+ expect(workspace.local_commit.oid).to eq head_revision
43
+ end
26
44
  end
27
45
  end
28
46
 
@@ -0,0 +1 @@
1
+ e289ff1e2729839759dbd6fe99b6e35880910c7c
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.4.5
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Nelson
@@ -101,6 +101,7 @@ files:
101
101
  - spec/fixtures/repo.git/objects/ee/314a31b622b027c10981acaed7903a3607dbd4
102
102
  - spec/fixtures/repo.git/objects/f6/66b137794d56880bab05e8fd256713a8fccf92
103
103
  - spec/fixtures/repo.git/refs/heads/master
104
+ - spec/fixtures/repo.git/refs/tags/test-tag
104
105
  - spec/fixtures/repo_symlink.git/HEAD
105
106
  - spec/fixtures/repo_symlink.git/config
106
107
  - spec/fixtures/repo_symlink.git/description
@@ -206,6 +207,7 @@ test_files:
206
207
  - spec/fixtures/repo.git/objects/ee/314a31b622b027c10981acaed7903a3607dbd4
207
208
  - spec/fixtures/repo.git/objects/f6/66b137794d56880bab05e8fd256713a8fccf92
208
209
  - spec/fixtures/repo.git/refs/heads/master
210
+ - spec/fixtures/repo.git/refs/tags/test-tag
209
211
  - spec/fixtures/repo_symlink.git/HEAD
210
212
  - spec/fixtures/repo_symlink.git/config
211
213
  - spec/fixtures/repo_symlink.git/description