dandelion 0.4.7 → 0.4.8

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: ba3c395e5c9d4ab9b7c3192e69c40a0f95441ef3
4
- data.tar.gz: 9978670bf800e50566e1298c99ffe051626ad16a
3
+ metadata.gz: aeadcf729468792cec7f281add65589d50aba809
4
+ data.tar.gz: 8396aaf70815c7e892459f2c0aa1b53f506da94b
5
5
  SHA512:
6
- metadata.gz: 1df3eea14e4b717a71f8db414e69bf52d5fe634282df26ed09c863a62937615b2b9cd5b139be20c8e9455a564ac11da15334d17c849bff9870c43162f41acc2a
7
- data.tar.gz: 53b054c31c571c285cad178499ef9a20fdb57dbd587146f823e52fdd45a8d65347e103a87793b239c4cc76896898cff15f6205a43957aa8685ca281ecf7b9888
6
+ metadata.gz: d2e7fc2368f412b6244ebd1ed4aa7601c51eba2a21eff7994503823a9b84134f2e2b97cc96e2116f227654e3862605f2d404579c713cee1e97abea7038e67e37
7
+ data.tar.gz: 671a523cf2917992578413aeda92f896bf55283795dcfac94eae764479147fd494e4da94757be1a6ce77e0188fd5ab85ccea33b7199cb7e6a2415173593f2b13
data/README.md CHANGED
@@ -149,6 +149,7 @@ For a more complete summary of usage options, run:
149
149
 
150
150
  Available commands:
151
151
  deploy
152
+ init
152
153
  status
153
154
 
154
155
  Note that when specifying the repository or configuration file, the given paths
data/lib/dandelion/cli.rb CHANGED
@@ -4,7 +4,7 @@ module Dandelion
4
4
  class CLI
5
5
  def initialize(args)
6
6
  @args = args
7
-
7
+
8
8
  @options = {}
9
9
  @options[:help] = true if @args.length == 0
10
10
 
@@ -48,6 +48,10 @@ module Dandelion
48
48
  def execute!
49
49
  parse!(@parser)
50
50
 
51
+ if @args.length == 0
52
+ @options[:help] = true
53
+ end
54
+
51
55
  if @options[:help]
52
56
  display_help
53
57
  exit
@@ -127,4 +131,4 @@ module Dandelion
127
131
  Dandelion.logger
128
132
  end
129
133
  end
130
- end
134
+ end
@@ -83,4 +83,5 @@ module Dandelion
83
83
  end
84
84
 
85
85
  require 'dandelion/command/deploy'
86
- require 'dandelion/command/status'
86
+ require 'dandelion/command/init'
87
+ require 'dandelion/command/status'
@@ -0,0 +1,28 @@
1
+ module Dandelion
2
+ module Command
3
+ class Init < Command::Base
4
+ command :init
5
+
6
+ def self.parser(options)
7
+ OptionParser.new do |opts|
8
+ opts.banner = 'Usage: dandelion init <revision>'
9
+ end
10
+ end
11
+
12
+ def setup(args)
13
+ @revision = args.shift
14
+ end
15
+
16
+ def execute!
17
+ raise RevisionError.new('must specify revision') if @revision.nil?
18
+ log.info("Connecting to #{adapter.to_s}")
19
+
20
+ workspace.remote_commit = workspace.lookup(@revision)
21
+ remote_commit = workspace.remote_commit
22
+
23
+ log.info("Remote revision: #{remote_commit ? remote_commit.oid : '---'}")
24
+ log.info("Local HEAD revision: #{workspace.local_commit.oid}")
25
+ end
26
+ end
27
+ end
28
+ end
@@ -1,3 +1,3 @@
1
1
  module Dandelion
2
- VERSION = '0.4.7'
2
+ VERSION = '0.4.8'
3
3
  end
@@ -38,8 +38,6 @@ module Dandelion
38
38
  self.remote_sha = commit.oid
39
39
  end
40
40
 
41
- private
42
-
43
41
  def lookup(val)
44
42
  result = lookup_sha(val) ||
45
43
  lookup_ref(val) ||
@@ -52,6 +50,8 @@ module Dandelion
52
50
  result
53
51
  end
54
52
 
53
+ private
54
+
55
55
  def lookup_sha(val)
56
56
  @repo.lookup(val)
57
57
  rescue Rugged::OdbError, Rugged::InvalidError
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe Dandelion::Command::Init do
4
+ let(:revision) { 'e289ff1e2729839759dbd6fe99b6e35880910c7c' }
5
+
6
+ describe '#execute!' do
7
+ let(:adapter) { Dandelion::Adapter::NoOpAdapter.new({}) }
8
+ let(:workspace) { Dandelion::Workspace.new(test_repo, adapter) }
9
+ let(:command) { described_class.new(workspace, {}, {}) }
10
+
11
+ before { command.setup([revision]) }
12
+
13
+ it 'sets remote revision to specified revision' do
14
+ workspace.should_receive(:remote_commit=).with(workspace.lookup(revision))
15
+ command.execute!
16
+ end
17
+ end
18
+ 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.4.7
4
+ version: 0.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Nelson
@@ -53,6 +53,7 @@ files:
53
53
  - lib/dandelion/cli.rb
54
54
  - lib/dandelion/command.rb
55
55
  - lib/dandelion/command/deploy.rb
56
+ - lib/dandelion/command/init.rb
56
57
  - lib/dandelion/command/status.rb
57
58
  - lib/dandelion/config.rb
58
59
  - lib/dandelion/deployer.rb
@@ -65,6 +66,7 @@ files:
65
66
  - spec/dandelion/change_spec.rb
66
67
  - spec/dandelion/changeset_spec.rb
67
68
  - spec/dandelion/command/deploy_spec.rb
69
+ - spec/dandelion/command/init_spec.rb
68
70
  - spec/dandelion/command/status_spec.rb
69
71
  - spec/dandelion/command_spec.rb
70
72
  - spec/dandelion/config_spec.rb
@@ -171,6 +173,7 @@ test_files:
171
173
  - spec/dandelion/change_spec.rb
172
174
  - spec/dandelion/changeset_spec.rb
173
175
  - spec/dandelion/command/deploy_spec.rb
176
+ - spec/dandelion/command/init_spec.rb
174
177
  - spec/dandelion/command/status_spec.rb
175
178
  - spec/dandelion/command_spec.rb
176
179
  - spec/dandelion/config_spec.rb