fulmar 1.6.4 → 1.7.0
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 +4 -4
- data/fulmar.gemspec +1 -1
- data/lib/fulmar/domain/model/project.rb +18 -0
- data/lib/fulmar/domain/service/configuration_service.rb +5 -0
- data/lib/fulmar/domain/service/dependency_service.rb +4 -0
- data/lib/fulmar/domain/service/helper/common_helper.rb +4 -0
- data/lib/fulmar/infrastructure/service/ssh_config_service.rb +77 -0
- data/lib/fulmar/task_manager.rb +1 -0
- data/lib/fulmar/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b922277279591ab2904e755d1ec0d1eae971c44
|
4
|
+
data.tar.gz: ec8ef42949ae63b41df9d43253c97334e600f682
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24a25cd0574c6e1843d05add4d26c602ba52f14579fca998ef57e5dc91fb7c82c621db64961531ee6164a5daf6c3cdb24b8d612c42f97c9d9d857fc9731121bb
|
7
|
+
data.tar.gz: dbc9c89acd886e4453985eda896988c70bd872e2cd3683b9d89d4f3044923de71689bbdfa0e7bf3713ee5011e78739c9fe4e9ead34f0d53ae10bc30e5e409b0d
|
data/fulmar.gemspec
CHANGED
@@ -24,6 +24,6 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_runtime_dependency 'rugged', '~>0'
|
25
25
|
spec.add_runtime_dependency 'mysql2', '~>0.3'
|
26
26
|
spec.add_runtime_dependency 'fulmar-shell', '~>1', '>=1.4.0'
|
27
|
-
spec.add_runtime_dependency 'ruby_wings', '~>0.1', '>=0.1.
|
27
|
+
spec.add_runtime_dependency 'ruby_wings', '~>0.1', '>=0.1.1'
|
28
28
|
spec.add_runtime_dependency 'colorize', '~>0'
|
29
29
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Fulmar
|
2
|
+
module Domain
|
3
|
+
module Model
|
4
|
+
# Provides information about the current project
|
5
|
+
class Project
|
6
|
+
attr_reader :name, :description, :license, :authors, :config
|
7
|
+
|
8
|
+
def initialize(config)
|
9
|
+
@name = config[:name] || '<unnamed>'
|
10
|
+
@description = config[:description] || '<no description>'
|
11
|
+
@license = config[:license] || 'proprietary'
|
12
|
+
@authors = config[:authors] || []
|
13
|
+
@config = config[:config] || {}
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
require 'pp'
|
3
|
+
require 'fulmar/domain/model/project'
|
3
4
|
|
4
5
|
module Fulmar
|
5
6
|
module Domain
|
@@ -59,6 +60,10 @@ module Fulmar
|
|
59
60
|
@config ||= load_configuration
|
60
61
|
end
|
61
62
|
|
63
|
+
def project
|
64
|
+
@project ||= Fulmar::Domain::Model::Project.new(configuration[:project])
|
65
|
+
end
|
66
|
+
|
62
67
|
def method_missing(name)
|
63
68
|
environment(name) if configuration[:environments][name]
|
64
69
|
end
|
@@ -13,7 +13,11 @@ module Fulmar
|
|
13
13
|
shell = Fulmar::Infrastructure::Service::ShellService.new(@config[:local_path])
|
14
14
|
@config.dependencies(env).each_pair do |_key, data|
|
15
15
|
next unless data[:type].blank? || data[:type] == 'git'
|
16
|
+
shell.quiet = true
|
16
17
|
shell.run "git clone #{data[:source]} #{data[:path]} -q"
|
18
|
+
shell.last_error.each do |line|
|
19
|
+
puts line unless line.include? 'already exists and is not an empty directory'
|
20
|
+
end
|
17
21
|
end
|
18
22
|
end
|
19
23
|
|
@@ -60,6 +60,10 @@ module Fulmar
|
|
60
60
|
shell
|
61
61
|
end
|
62
62
|
|
63
|
+
def ssh_config
|
64
|
+
storage['ssh_config'] ||= Fulmar::Infrastructure::Service::SSHConfigService.new configuration
|
65
|
+
end
|
66
|
+
|
63
67
|
def storage
|
64
68
|
fail 'You need to set an environment and a target first' unless configuration.ready?
|
65
69
|
@storage ||= {}
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'fulmar/shell'
|
2
|
+
|
3
|
+
module Fulmar
|
4
|
+
module Infrastructure
|
5
|
+
module Service
|
6
|
+
# Adds entries to the ssh config and checks for existing ones
|
7
|
+
class SSHConfigService
|
8
|
+
CONFIG_FILE = "#{ENV['HOME']}/.ssh/config"
|
9
|
+
KNOWN_HOST_FILE = "#{ENV['HOME']}/.ssh/known_hosts"
|
10
|
+
|
11
|
+
def initialize(config)
|
12
|
+
@config = config
|
13
|
+
end
|
14
|
+
|
15
|
+
def add_hosts
|
16
|
+
@config.configuration[:hosts].values.each do |data|
|
17
|
+
unless config_valid?(data)
|
18
|
+
puts "Skipping #{data[:hostname]}, config not sufficient." if @config[:debug]
|
19
|
+
next
|
20
|
+
end
|
21
|
+
if host_exists?(data[:hostname])
|
22
|
+
puts "Host #{data[:hostname]} exists, skipping..." if @config[:debug]
|
23
|
+
else
|
24
|
+
add_host(data[:hostname], data)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def remove_known_host(hostname)
|
30
|
+
input_file = File.open(KNOWN_HOST_FILE, 'r')
|
31
|
+
output_file = File.open(KNOWN_HOST_FILE + '.temp', 'w')
|
32
|
+
while (line = input_file.gets)
|
33
|
+
output_file.puts(line) unless /^\[?#{hostname.gsub('.', '\\.')}(?:\]:\d+)? /.match(line)
|
34
|
+
end
|
35
|
+
input_file.close
|
36
|
+
output_file.close
|
37
|
+
FileUtils.mv(KNOWN_HOST_FILE + '.temp', KNOWN_HOST_FILE)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Parses the users ssh config for an existing hostname
|
41
|
+
def host_exists?(hostname)
|
42
|
+
config_file = File.open(CONFIG_FILE, 'r')
|
43
|
+
while (line = config_file.gets)
|
44
|
+
if /\s*Host #{hostname.gsub('.', '\\.')}\s*$/.match(line)
|
45
|
+
config_file.close
|
46
|
+
return true
|
47
|
+
end
|
48
|
+
end
|
49
|
+
config_file.close
|
50
|
+
false
|
51
|
+
end
|
52
|
+
|
53
|
+
# Adds a host to the ssh config file
|
54
|
+
def add_host(hostname, host_config = {})
|
55
|
+
puts "Adding host #{host_config[:hostname]}..." if @config[:debug]
|
56
|
+
config_file = File.open(CONFIG_FILE, 'a')
|
57
|
+
|
58
|
+
config_file.puts "\n" # Add some space between this and the second last entry
|
59
|
+
config_file.puts "# Automatically generated by fulmar for project #{@config.project.description}"
|
60
|
+
config_file.puts "Host #{hostname}"
|
61
|
+
config_file.puts " Hostname #{host_config[:config_hostname]}" unless host_config[:config_hostname].blank?
|
62
|
+
config_file.puts " Port #{host_config[:config_port]}" unless host_config[:config_port].blank?
|
63
|
+
config_file.puts " User #{host_config[:config_user]}" unless host_config[:config_user].blank?
|
64
|
+
config_file.puts " ProxyCommand #{host_config[:config_proxycommand]}" unless host_config[:config_proxycommand].blank?
|
65
|
+
|
66
|
+
config_file.close
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
def config_valid?(host_config)
|
72
|
+
(!host_config[:hostname].blank? && !host_config[:config_hostname].blank?)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
data/lib/fulmar/task_manager.rb
CHANGED
@@ -14,6 +14,7 @@ require 'fulmar/infrastructure/service/composer_service'
|
|
14
14
|
require 'fulmar/infrastructure/service/shell_service'
|
15
15
|
require 'fulmar/infrastructure/service/git_service'
|
16
16
|
require 'fulmar/infrastructure/service/copy_service'
|
17
|
+
require 'fulmar/infrastructure/service/ssh_config_service'
|
17
18
|
|
18
19
|
require 'fulmar/infrastructure/service/database/database_service'
|
19
20
|
|
data/lib/fulmar/version.rb
CHANGED
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: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonas Siegl
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-06-
|
12
|
+
date: 2015-06-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -96,7 +96,7 @@ dependencies:
|
|
96
96
|
version: '0.1'
|
97
97
|
- - ">="
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version: 0.1.
|
99
|
+
version: 0.1.1
|
100
100
|
type: :runtime
|
101
101
|
prerelease: false
|
102
102
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -106,7 +106,7 @@ dependencies:
|
|
106
106
|
version: '0.1'
|
107
107
|
- - ">="
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 0.1.
|
109
|
+
version: 0.1.1
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
111
|
name: colorize
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,6 +137,7 @@ files:
|
|
137
137
|
- README.md
|
138
138
|
- bin/fulmar
|
139
139
|
- fulmar.gemspec
|
140
|
+
- lib/fulmar/domain/model/project.rb
|
140
141
|
- lib/fulmar/domain/service/application_service.rb
|
141
142
|
- lib/fulmar/domain/service/config_rendering_service.rb
|
142
143
|
- lib/fulmar/domain/service/config_test_service.rb
|
@@ -162,6 +163,7 @@ files:
|
|
162
163
|
- lib/fulmar/infrastructure/service/flow_service.rb
|
163
164
|
- lib/fulmar/infrastructure/service/git_service.rb
|
164
165
|
- lib/fulmar/infrastructure/service/shell_service.rb
|
166
|
+
- lib/fulmar/infrastructure/service/ssh_config_service.rb
|
165
167
|
- lib/fulmar/infrastructure/service/transfer/base.rb
|
166
168
|
- lib/fulmar/infrastructure/service/transfer/rsync.rb
|
167
169
|
- lib/fulmar/infrastructure/service/transfer/rsync_with_versions.rb
|