volley 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.1.8:
4
+ * more docopt fixes
5
+
3
6
  ## v0.1.7:
4
7
  * handle docopt exit for --version
5
8
  * update to use newest docopt version
data/bin/volley CHANGED
@@ -4,7 +4,6 @@ require 'rubygems'
4
4
  require 'docopt'
5
5
  require 'volley'
6
6
  require 'daemons'
7
- require 'awesome_print'
8
7
 
9
8
  DOC = <<-DOC
10
9
  Usage:
@@ -53,7 +52,6 @@ module Volley
53
52
  def run(argv)
54
53
  STDOUT.sync = true
55
54
  options = Docopt::docopt(DOC, :version => Volley::Version::STRING)
56
- ap options
57
55
  debug = options["--debug"]
58
56
  quiet = options["--quiet"]
59
57
  config = options["--config"]
@@ -64,7 +62,6 @@ module Volley
64
62
  force = options["--force"]
65
63
  args = { }
66
64
 
67
-
68
65
  Volley::Dsl::VolleyFile.init
69
66
  Volley::Dsl::VolleyFile.load(config, :optional => true)
70
67
  Volley::Dsl::VolleyFile.load(primary, :primary => true) if File.file?(primary)
@@ -79,8 +76,6 @@ module Volley
79
76
  Volley::Log.console_quiet
80
77
  end
81
78
 
82
- ap argv
83
-
84
79
  kvs = argv.select { |e| e.match(/(\w+)\=(\w+)/) }
85
80
  pos = argv.reject { |e| e.match(/(\w+)\=(\w+)/) }
86
81
 
@@ -1,5 +1,6 @@
1
1
  project :volley do
2
- scm :base
2
+ scm :auto, :required => false
3
+
3
4
  plan :init, :remote => false do
4
5
  default do
5
6
  file = File.expand_path("../../init/Volleyfile", __FILE__)
@@ -9,6 +10,21 @@ project :volley do
9
10
  end
10
11
  end
11
12
 
13
+ plan :info, :remote => false do
14
+ default do
15
+ Volley::Log.info "SCM:"
16
+ Volley::Log.info ".. branch: #{source.branch} revision: #{source.revision}" if source
17
+ Volley::Log.info "Projects/Plans:"
18
+ Volley::Dsl::Project.projects.reject{|k, _| k==:volley}.each do |p, project|
19
+ h = project.plans
20
+ next unless h.count > 0
21
+ h.keys.each do |pl|
22
+ Volley::Log.info ".. #{p}:#{pl}"
23
+ end
24
+ end
25
+ end
26
+ end
27
+
12
28
  plan :list, :remote => false do
13
29
  default do
14
30
  Volley::Dsl::Project.projects.each do |p, project|
@@ -4,6 +4,9 @@ module Volley
4
4
  class Action
5
5
  attr_reader :plan
6
6
 
7
+ delegate :project, :args, :files, :file, :attributes, :log, :arguments, :argv, :branch, :version, :action, :volley, :stop, :source,
8
+ :to => :plan
9
+
7
10
  def initialize(name, options={}, &block)
8
11
  @name = name.to_sym
9
12
  @stage = options.delete(:stage)
@@ -21,9 +24,6 @@ module Volley
21
24
  self.instance_eval &@block if @block
22
25
  end
23
26
 
24
- delegate :project, :args, :files, :file, :attributes, :log, :arguments, :argv, :branch, :version, :action, :volley, :stop,
25
- :to => :plan
26
-
27
27
  def command(cmd)
28
28
  plan.shellout(cmd)
29
29
  end
@@ -10,6 +10,9 @@ module Volley
10
10
  attr_reader :arguments
11
11
  attr_reader :attributes
12
12
 
13
+ delegate :source,
14
+ :to => :project
15
+
13
16
  def initialize(name, o={ }, &block)
14
17
  options = {
15
18
  :name => name,
@@ -111,10 +114,6 @@ module Volley
111
114
  @args = OpenStruct.new(@arguments.inject({ }) { |h, e| (k, v)=e; h[k] = v.value; h })
112
115
  end
113
116
 
114
- def source
115
- @project.source or raise "SCM not configured"
116
- end
117
-
118
117
  def remote(tf)
119
118
  raise "remote can only be set to true or false" unless [true, false].include?(tf)
120
119
  @attributes.remote = tf
@@ -36,7 +36,6 @@ module Volley
36
36
 
37
37
  attr_reader :plans
38
38
  attr_reader :name
39
- attr_reader :source
40
39
 
41
40
  def initialize(name)
42
41
  @name = name
@@ -68,10 +67,33 @@ module Volley
68
67
  end
69
68
 
70
69
  def scm(name, o={}, &block)
70
+ options = {
71
+ :required => true,
72
+ }.merge(o)
71
73
  n = name.to_s
74
+
75
+ if n == "auto"
76
+ n = autoscm
77
+ end
78
+
79
+ if n.nil? || n.blank?
80
+ puts "N not set (project: #@name)"
81
+ if options[:required]
82
+ raise "could not automatically determine SCM"
83
+ else
84
+ return
85
+ end
86
+ end
87
+
72
88
  require "volley/scm/#{n}"
73
89
  klass = "Volley::Scm::#{n.camelize}".constantize
74
- @source = klass.new(o)
90
+ @source = klass.new(options)
91
+ rescue => e
92
+ raise "unable to load SCM provider: #{n} #{e.message}"
93
+ end
94
+
95
+ def source
96
+ @source or raise "SCM not configured"
75
97
  end
76
98
 
77
99
  #def encrypt(tf, o={})
@@ -97,6 +119,14 @@ module Volley
97
119
  # }.merge(o)
98
120
  # config.pack = OpenStruct.new(options)
99
121
  #end
122
+
123
+ private
124
+
125
+ def autoscm
126
+ return "git" if File.directory?(File.expand_path("./.git"))
127
+ return "subversion" if File.directory?(File.expand_path("./.svn"))
128
+ nil
129
+ end
100
130
  end
101
131
  end
102
132
  end
@@ -10,14 +10,14 @@ module Volley
10
10
  end
11
11
 
12
12
  def branch
13
- @branch ||= `git branch`.lines.select {|e| e =~ /^\*/}.first.chomp.split[1]
13
+ @branch ||= data[:branch]
14
14
  rescue => e
15
15
  Volley::Log.error "git: could not get branch: #{e.message}"
16
16
  Volley::Log.debug e
17
17
  end
18
18
 
19
19
  def revision
20
- @revision ||= `git log --format='%h' --max-count=1`.chomp
20
+ @revision ||= data[:revision]
21
21
  end
22
22
 
23
23
  def update
@@ -26,6 +26,17 @@ module Volley
26
26
  @branch = nil
27
27
  @revision = nil
28
28
  end
29
+
30
+ private
31
+
32
+ def data
33
+ @data ||= begin
34
+ {
35
+ :branch => `git branch`.lines.select {|e| e =~ /^\*/}.first.chomp.split[1],
36
+ :revision => `git log --format='%h' --max-count=1`.chomp,
37
+ }
38
+ end
39
+ end
29
40
  end
30
41
  end
31
42
  end
@@ -9,13 +9,6 @@ module Volley
9
9
  }.merge(opt)
10
10
  end
11
11
 
12
- def data
13
- @data ||= begin
14
- update if @options[:update]
15
- YAML::load(%x{svn info})
16
- end
17
- end
18
-
19
12
  def branch
20
13
  @branch ||= begin
21
14
  if data["URL"] =~ /\/trunk/
@@ -40,6 +33,15 @@ module Volley
40
33
  up = %x{svn update}
41
34
  @data = nil
42
35
  end
36
+
37
+ private
38
+
39
+ def data
40
+ @data ||= begin
41
+ update if @options[:update]
42
+ YAML::load(%x{svn info})
43
+ end
44
+ end
43
45
  end
44
46
  end
45
47
  end
@@ -3,7 +3,7 @@ unless defined?(Volley::Version)
3
3
  module Version
4
4
  MAJOR = 0
5
5
  MINOR = 1
6
- TINY = 8
6
+ TINY = 9
7
7
  TAG = nil
8
8
  STRING = [MAJOR, MINOR, TINY, TAG].compact.join('.')
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: volley
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: