fulmar 0.6.4 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: afd3e3b5554ae9fb5d26cb39d2edfb58e4014654
4
- data.tar.gz: bbef26b1c6d2d97bcae7fd2574790403325402fa
3
+ metadata.gz: 78b184a38399a1bb85893abc9f4cc757ecd97b17
4
+ data.tar.gz: 752c373642fcc1cb7792dc6388b98b2b1b91e85d
5
5
  SHA512:
6
- metadata.gz: 80a6fc309f815a0ee2a024bc0ce79d0734f86bc007be600889bc43587cb565ee32fbf36774e453915b0af0ab80b8f32e0f60618679a9acc051a20102e57da817
7
- data.tar.gz: 3d8e18c4f150381a44d8a8bc81631363886ea776514071603ec46e546af72ad18a6792eec0c660a254d05fe85d433645a7aea59b9bcaed80cec809c5e43970a4
6
+ metadata.gz: bade5b1220e87a60d0f457135401cd19316de60a1bf442fa4f783683b675fcc0300f6b16faece6e08ab5b97fcaef3264e9eeb714d3a413d04ca32e1d4330be63
7
+ data.tar.gz: 58b425a5cfde5d6be795a05caa89e071083a4431e262de56693eb5fcc8db628ef20743729c90f19be23c75e1e0d082814e3d176a0297b9eb276e9ff20dd3a55b
data/Gemfile CHANGED
@@ -2,12 +2,3 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in fulmar.gemspec
4
4
  gemspec
5
-
6
- gem 'rake'
7
- gem 'mysql2'
8
- gem 'git'
9
-
10
- source 'http://dione.core4.lan:9292' do
11
- gem 'ruby_wings'
12
- gem 'fulmar-shell', '>= 1.1.0'
13
- end
data/README.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  Fulmar is a task manager for deployments.
4
4
 
5
+ This project is still under heavy development for the next few weeks. You might want to check back in May 2015. We hope
6
+ to get this somehow stable until then.
7
+
5
8
  ## Installation
6
9
 
7
10
  Add this line to your application's Gemfile:
@@ -21,12 +21,12 @@ module Fulmar
21
21
 
22
22
  # Allow access of configuration via array/hash access methods (read access)
23
23
  def [](id)
24
- (@environment.nil? || @target.nil?) ? nil : configuration[:environments][@environment][@target][id]
24
+ ready? ? configuration[:environments][@environment][@target][id] : nil
25
25
  end
26
26
 
27
27
  # Allow access of configuration via array/hash access methods (write access)
28
28
  def []=(id, value)
29
- if @environment && @target
29
+ if ready?
30
30
  configuration[:environments][@environment][@target][id] = value
31
31
  else
32
32
  fail 'Environment or target not set. Please set both variables via configuration.environment = \'xxx\' / '\
@@ -35,7 +35,7 @@ module Fulmar
35
35
  end
36
36
 
37
37
  def to_hash
38
- (@environment.nil? || @target.nil?) ? configuration : configuration[:environments][@environment][@target]
38
+ ready? ? configuration[:environments][@environment][@target] : configuration
39
39
  end
40
40
 
41
41
  def base_path
@@ -58,6 +58,10 @@ module Fulmar
58
58
  @target = target ? target.to_sym : nil
59
59
  end
60
60
 
61
+ def ready?
62
+ !@environment.nil? && !@target.nil?
63
+ end
64
+
61
65
  # Merge another configuration into the currently active one
62
66
  # Useful for supplying a default configuration, as values are not overwritten.
63
67
  # Hashes are merged.
@@ -105,10 +109,19 @@ module Fulmar
105
109
  # Iterate over all environments and targets to prepare them
106
110
  @config[:environments].each_key do |env|
107
111
  next if env == :all
108
- @config[:environments][env].each_key { |target| fill_target(env, target) }
112
+ @config[:environments][env].each_key do |target|
113
+ fill_target(env, target)
114
+ check_path(env, target)
115
+ end
109
116
  end
110
117
  @config
111
118
  end
119
+
120
+ def check_path(env, target)
121
+ unless @config[:environments][env][target][:local_path].blank?
122
+ @config[:environments][env][target][:local_path] = File.expand_path(@config[:environments][env][target][:local_path])
123
+ end
124
+ end
112
125
  end
113
126
  end
114
127
  end
@@ -24,16 +24,16 @@ module Fulmar
24
24
  def initialize(config)
25
25
  @config = config
26
26
  @config.merge DEFAULT_CONFIG
27
- @shell = Fulmar::Infrastructure::Service::ShellService.new(config[:local_path], config[:hostname])
28
27
  @tunnel = nil
29
28
  @client = nil
29
+ initialize_shell
30
30
  config_test
31
31
  end
32
32
 
33
33
  def connect
34
34
  options = compile_options
35
35
 
36
- if @config[:maria][:hostname] != 'localhost' && @config[:maria][:hostname] != '127.0.0.1'
36
+ unless local?
37
37
  tunnel.open
38
38
  options[:port] = tunnel.local_port
39
39
  end
@@ -62,6 +62,10 @@ module Fulmar
62
62
  @connected
63
63
  end
64
64
 
65
+ def local?
66
+ @config[:maria][:hostname] == 'localhost' || @config[:maria][:hostname] == '127.0.0.1'
67
+ end
68
+
65
69
  def tunnel
66
70
  @tunnel ||= Fulmar::Infrastructure::Service::TunnelService.new(@config[:maria][:hostname], @config[:maria][:port])
67
71
  end
@@ -128,6 +132,12 @@ module Fulmar
128
132
  "#{@config[:maria][:database]}_#{Time.now.strftime('%Y-%m-%dT%H%M%S')}.sql"
129
133
  end
130
134
 
135
+ def initialize_shell
136
+ path = local? ? @config[:local_path] : @config[:remote_path]
137
+ @shell = Fulmar::Infrastructure::Service::ShellService.new(path, @config[:hostname])
138
+ @shell.debug = true if @config[:debug]
139
+ end
140
+
131
141
  # Compiles a mysql config hash from valid options of the fulmar config
132
142
  def compile_options
133
143
  possible_options = [:host, :username, :password, :port, :encoding, :socket, :read_timeout, :write_timeout,
@@ -20,11 +20,19 @@ module Fulmar
20
20
  end
21
21
 
22
22
  def local_shell
23
- @_local_shell ||= Fulmar::Infrastructure::Service::ShellService.new configuration[:local_path]
23
+ fail 'You need to set an environment and a target first' unless configuration.ready?
24
+ unless @_local_shell
25
+ @_local_shell = {}
26
+ end
27
+ @_local_shell["#{configuration.environment}:#{configuration.target}"] ||= Fulmar::Infrastructure::Service::ShellService.new configuration[:local_path]
24
28
  end
25
29
 
26
30
  def remote_shell
27
- @_remote_shell ||= Fulmar::Infrastructure::Service::ShellService.new(configuration[:remote_path], configuration[:hostname])
31
+ fail 'You need to set an environment and a target first' unless configuration.ready?
32
+ unless @_remote_shell
33
+ @_remote_shell = {}
34
+ end
35
+ @_remote_shell["#{configuration.environment}:#{configuration.target}"] ||= Fulmar::Infrastructure::Service::ShellService.new(configuration[:remote_path], configuration[:hostname])
28
36
  end
29
37
 
30
38
  def file_sync
@@ -1,4 +1,4 @@
1
1
  # Provides a global version number
2
2
  module Fulmar
3
- VERSION = '0.6.4'
3
+ VERSION = '0.6.5'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fulmar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Siegl