dragon 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.
@@ -6,12 +6,14 @@ module Dragon
6
6
  end
7
7
 
8
8
  def run commands
9
- commands.each{|k,v|
10
- puts "runnning: #{ k } #{ v }"
11
- unless v.empty?
12
- ran = @boxes.send( k.to_sym, v )
9
+ commands.each{|c,i|
10
+ name = c.keys[0]
11
+ args = c[name]
12
+ puts "runnning: #{ name } #{ args }"
13
+ unless args.empty?
14
+ ran = @boxes.send( name.to_sym, args )
13
15
  else
14
- ran = @boxes.send( k.to_sym )
16
+ ran = @boxes.send( name.to_sym )
15
17
  end
16
18
  puts " output: #{ ran.stdout }" if ran.respond_to? :stdout
17
19
  }
@@ -10,15 +10,15 @@ module Dragon
10
10
  def default_commands sequence
11
11
  return {} if @options.local_settings.has_key?( "commands_run_default" )
12
12
  {
13
- use_git: {
14
- git: "clone --depth=1 --branch=#{ @options.environment } #{ @options.local_settings["git_url"] } #{ @options.release }",
15
- },
16
- local_upload: {
13
+ use_git: [{
14
+ git: "clone --depth=1 --branch=#{ @options.local_settings["git_branch"] } #{ @options.local_settings["git_url"] } #{ @options.release_dir }",
15
+ }],
16
+ local_upload: [{
17
17
  dir_upload: "#{ @options.local_settings["local_upload_dir"] }",
18
- },
19
- current_linking: {
18
+ }],
19
+ current_linking: [{
20
20
  ln: "-nfs #{ @options.release_dir } #{ @options.local_settings["destination_symlink"] }",
21
- }
21
+ }]
22
22
  }[sequence]
23
23
  end
24
24
 
@@ -37,9 +37,9 @@ module Dragon
37
37
 
38
38
  def update_commands
39
39
  return nil unless !@local_settings.nil? && @local_settings.has_key?( "commands" )
40
- @local_settings['commands'].each{|k,v|
41
- rendered_value = Liquid::Template.parse( v ).render( command_liquid_args )
42
- @local_settings['commands'][k] = rendered_value
40
+ @local_settings['commands'].each_with_index{|command,i|
41
+ rendered_value = Liquid::Template.parse( @local_settings['commands'][ i ][ command.keys[0] ] ).render( command_liquid_args )
42
+ @local_settings['commands'][ i ][ command.keys[0] ] = rendered_value
43
43
  }
44
44
  end
45
45
 
@@ -6,10 +6,13 @@ module Dragon
6
6
  attr_reader :set
7
7
 
8
8
  def initialize(options)
9
+ add_commands # making sure added commads are set befor server set is created
9
10
  @options = options
10
11
  @set = server_set
11
12
  end
12
13
 
14
+ private
15
+
13
16
  def server_set
14
17
  set = Rye::Set.new
15
18
  @options.local_settings['servers'].each{ |s|
@@ -19,7 +22,12 @@ module Dragon
19
22
  end
20
23
 
21
24
  def server str
22
- Rye::Box.new( str, { keys: [ @options.local_settings['servers_key_location'] ], user: @options.local_settings['servers_username'] } )
25
+ Rye::Box.new( str, { keys: [ @options.local_settings['servers_key_location'] ], user: @options.local_settings['servers_username'], safe: false } )
26
+ end
27
+
28
+ # custom commands
29
+ def add_commands
30
+ Rye::Cmd.add_command :rm
23
31
  end
24
32
 
25
33
  end
@@ -1,3 +1,3 @@
1
1
  module Dragon
2
- VERSION="0.1.1"
2
+ VERSION="0.1.2"
3
3
  end
@@ -14,9 +14,9 @@ default: &default
14
14
  # uncomment this setting if you do not want the default commands to run
15
15
  # commands_run_default: no
16
16
  commands:
17
- cd: "{{release_dir}}/ && pwd"
18
- rm: "-rf {{release_dir}}/log"
19
- ls: "-nfs {{destination_root}}/shared/log {{release_dir}}"
17
+ - cd: "{{release_dir}}/ && pwd"
18
+ - rm: "-rf {{release_dir}}/log"
19
+ - ls: "-nfs {{destination_root}}/shared/log {{release_dir}}"
20
20
 
21
21
  staging:
22
22
  <<: *default
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dragon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-01 00:00:00.000000000 Z
12
+ date: 2013-08-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler