fulmar 0.6.5 → 1.0.0

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: 78b184a38399a1bb85893abc9f4cc757ecd97b17
4
- data.tar.gz: 752c373642fcc1cb7792dc6388b98b2b1b91e85d
3
+ metadata.gz: 46c85744adefad501d5efd90fef1a22ebf0f8f51
4
+ data.tar.gz: d6dfa27af53d6ba87f51699583d2ab0edc55cedd
5
5
  SHA512:
6
- metadata.gz: bade5b1220e87a60d0f457135401cd19316de60a1bf442fa4f783683b675fcc0300f6b16faece6e08ab5b97fcaef3264e9eeb714d3a413d04ca32e1d4330be63
7
- data.tar.gz: 58b425a5cfde5d6be795a05caa89e071083a4431e262de56693eb5fcc8db628ef20743729c90f19be23c75e1e0d082814e3d176a0297b9eb276e9ff20dd3a55b
6
+ metadata.gz: 5c5e48948f29b756590a48c0ddae233d08b21787f4d588604abce5a0da6d6547b889ea2b484c4136ff8798d7b80939e0d9eb0822a98ffd7ed99c1652341c6af0
7
+ data.tar.gz: 194914af1388156b2f492c90027885e99717296751e878e5f72d52f44cc0660d59b96785013a0b45ee5ba183f58dceb9a5dea1a5367ddf3c4b1ea3be9b6b57e6
data/bin/fulmar CHANGED
@@ -1,3 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ if ARGV[0] == 'init'
4
+ system('touch Fulmarfile')
5
+ end
6
+
3
7
  require 'fulmar/task_manager'
data/fulmar.gemspec CHANGED
@@ -23,6 +23,6 @@ Gem::Specification.new do |spec|
23
23
  spec.add_runtime_dependency 'rake', '~>10'
24
24
  spec.add_runtime_dependency 'git', '~>1.2'
25
25
  spec.add_runtime_dependency 'mysql2', '~>0.3'
26
- spec.add_runtime_dependency 'fulmar-shell', '~>1', '>=1.2.0'
26
+ spec.add_runtime_dependency 'fulmar-shell', '~>1', '>=1.4.0'
27
27
  spec.add_runtime_dependency 'ruby_wings', '~>0.1', '>=0.1.0'
28
28
  end
@@ -8,7 +8,6 @@ module Fulmar
8
8
  def initialize
9
9
  super
10
10
  @rakefiles = %w(fulmarfile Fulmarfile fulmarfile.rb Fulmarfile.rb)
11
- @rakefiles.push(*fulmar_tasks)
12
11
  end
13
12
 
14
13
  def name
@@ -20,6 +19,12 @@ module Fulmar
20
19
  super
21
20
  end
22
21
 
22
+ def init
23
+ super
24
+ options.rakelib << fulmar_task_dir
25
+ options.rakelib << 'Fulmar'
26
+ end
27
+
23
28
  def define_task(task_class, *args, &block)
24
29
  super(task_class, *args, &wrap_environment(&block))
25
30
  end
@@ -38,8 +43,8 @@ module Fulmar
38
43
  end
39
44
 
40
45
  # Add fulmar application tasks
41
- def fulmar_tasks
42
- Dir.glob(File.expand_path(File.join(File.dirname(__FILE__), '../', 'task')) + '/*.rake')
46
+ def fulmar_task_dir
47
+ File.expand_path(File.join(File.dirname(__FILE__), '..', 'task'))
43
48
  end
44
49
  end
45
50
  end
@@ -5,9 +5,11 @@ module Fulmar
5
5
  module Service
6
6
  # Loads and prepares the configuration from the yaml file
7
7
  # TODO: Clone target configuration when used as a parameter to another service so an environment change won't affect it
8
+ # Not Sure if that is actually a god idea
8
9
  class ConfigurationService
9
10
  FULMAR_FILE = 'Fulmarfile'
10
11
  FULMAR_CONFIGURATION = 'FulmarConfiguration'
12
+ FULMAR_CONFIGURATION_DIR = 'Fulmar'
11
13
  DEPLOYMENT_CONFIG_FILE = 'deployment.yml'
12
14
 
13
15
  include Singleton
@@ -62,6 +64,33 @@ module Fulmar
62
64
  !@environment.nil? && !@target.nil?
63
65
  end
64
66
 
67
+ def has_feature?(feature)
68
+ return configuration[:features][feature] unless configuration[:features][feature].nil?
69
+ case feature
70
+ when :database
71
+ configuration[:features][:database] = any? { |data| data[:type] == 'maria' }
72
+ else
73
+ false
74
+ end
75
+ end
76
+
77
+ def each
78
+ configuration[:environments].each_key do |env|
79
+ configuration[:environments][env].each_pair do |target, data|
80
+ yield(env, target, data)
81
+ end
82
+ end
83
+ end
84
+
85
+ def any?
86
+ if block_given?
87
+ each{ |_env, _target, data| return true if yield(data) }
88
+ false
89
+ else
90
+ configuration[:environments].any?
91
+ end
92
+ end
93
+
65
94
  # Merge another configuration into the currently active one
66
95
  # Useful for supplying a default configuration, as values are not overwritten.
67
96
  # Hashes are merged.
@@ -72,6 +101,10 @@ module Fulmar
72
101
  end
73
102
  end
74
103
 
104
+ def config_files
105
+ Dir.glob(File.join(base_path, FULMAR_CONFIGURATION_DIR, '*.config.yml')).sort
106
+ end
107
+
75
108
  protected
76
109
 
77
110
  def lookup_base_path
@@ -104,7 +137,10 @@ module Fulmar
104
137
 
105
138
  # Loads the configuration from the YAML file and populates all targets
106
139
  def load_configuration
107
- @config = YAML.load_file(base_path + '/' + DEPLOYMENT_CONFIG_FILE).symbolize
140
+ @config = { environments: {}, features: {} }
141
+ config_files.each do |config_file|
142
+ @config = @config.deep_merge(YAML.load_file(config_file).symbolize)
143
+ end
108
144
 
109
145
  # Iterate over all environments and targets to prepare them
110
146
  @config[:environments].each_key do |env|
@@ -114,6 +150,7 @@ module Fulmar
114
150
  check_path(env, target)
115
151
  end
116
152
  end
153
+ @config[:environments].delete(:all)
117
154
  @config
118
155
  end
119
156
 
@@ -0,0 +1,11 @@
1
+ include Fulmar::Domain::Service::Helper::CommonHelper
2
+
3
+ if configuration.has_feature? :database
4
+ require 'fulmar/service/helper/database_helper'
5
+ include Fulmar::Domain::Service::Helper::DatabaseHelper
6
+ end
7
+
8
+ if configuration.has_feature? :flow
9
+ require 'fulmar/service/helper/flow_helper'
10
+ include Fulmar::Domain::Service::Helper::FlowHelper
11
+ end
@@ -0,0 +1,46 @@
1
+ require 'pp'
2
+
3
+ db_configs = []
4
+ configuration.each do |env, target, data|
5
+ db_configs << [env, target] if data[:type] == 'maria'
6
+ end
7
+
8
+ def create_update_task(from_db, to_db)
9
+ namespace to_db.first do
10
+ desc "Update #{to_db.first} database with #{from_db.first} data" unless to_db.first.match(/^(live|prod)/) # hide sync to live
11
+ task "from_#{from_db.first}" do
12
+ configuration.environment = from_db.first
13
+ configuration.target = from_db.last
14
+ puts 'Getting dump...'
15
+ sql_dump = database.download_dump
16
+ if sql_dump == ''
17
+ puts 'Cannot create sql dump'
18
+ else
19
+ configuration.environment = to_db.first
20
+ configuration.target = to_db.last
21
+ puts 'Sending dump...'
22
+ remote_sql_dump = upload(sql_dump)
23
+ database.load_dump(remote_sql_dump)
24
+ end
25
+ end
26
+ end
27
+ end
28
+
29
+ def create_update_tasks(db_configs)
30
+ namespace :update do
31
+ db_configs.each do |from_db|
32
+ db_configs.each do |to_db|
33
+ next if from_db == to_db
34
+ create_update_task(from_db, to_db)
35
+ end
36
+ end
37
+ end
38
+ end
39
+
40
+ if db_configs.any?
41
+ namespace :database do
42
+ if db_configs.count > 1
43
+ create_update_tasks(db_configs)
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,22 @@
1
+ # This helper file provides tasks to set the environment. This is just for convenience
2
+ # so that these tasks might be a dependency for other tasks
3
+
4
+ namespace :environment do
5
+
6
+ full_configuration[:environments].each_key do |env|
7
+ # Sets the environment to #{env}
8
+ task env do
9
+ configuration.environment = env
10
+ end
11
+
12
+ namespace env do
13
+ full_configuration[:environments][env].each_key do |target|
14
+ # Sets the environment to #{env} and the target to #{target}
15
+ task target do
16
+ configuration.environment = env
17
+ configuration.target = target
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,12 +1,13 @@
1
- include Fulmar::Domain::Service::CommonHelperService
1
+ include Fulmar::Domain::Service::Helper::CommonHelper
2
2
 
3
3
  namespace :versions do
4
4
 
5
- task :load_config do
6
- # load the configuration from the config gem
5
+ @versioned_servers = {}
6
+ configuration.each do |env, target, data|
7
+
7
8
  end
8
9
 
9
- @versioned_servers = {}
10
+
10
11
  full_configuration[:environments].each_pair do |env, targets|
11
12
  next if env == :all
12
13
 
@@ -15,40 +16,29 @@ namespace :versions do
15
16
  end
16
17
  end
17
18
 
18
- desc 'List existing versions on the server'
19
- task :list do
20
- if @versioned_servers.empty?
21
- puts 'None of the configured environments supports versioning.'
22
- else
23
- puts 'Environments which support versioning:'
24
- @versioned_servers.each_key do |env|
25
- puts "- #{env}"
26
- end
27
-
28
- puts "\nSo run one of these now:"
29
- @versioned_servers.each_key do |env|
30
- puts "$ fulmar versions:list:#{env}"
31
- end
32
- end
33
- end
34
-
35
19
  unless @versioned_servers.empty?
36
-
37
20
  namespace :list do
38
-
39
21
  @versioned_servers.each_key do |env|
40
-
41
22
  desc "List available versions for environment \"#{env}\""
42
23
  task env do
43
24
  configuration.environment = env.split(':').first
44
25
  configuration.target = env.split(':').last
45
26
  file_sync.list_releases(false).each{|item| puts item}
46
27
  end
47
-
48
28
  end
29
+ end
49
30
 
31
+ namespace :clean do
32
+ @versioned_servers.each_key do |env|
33
+ desc "Delete obsolete versions for target \"#{env}\""
34
+ task env do
35
+ configuration.environment = env.split(':').first
36
+ configuration.target = env.split(':').last
37
+ file_sync.cleanup
38
+ end
39
+ end
50
40
  end
51
41
 
52
- end
53
42
 
43
+ end
54
44
  end
@@ -0,0 +1,30 @@
1
+ module Fulmar
2
+ module Infrastructure
3
+ module Service
4
+ # Provides access to composer
5
+ class CopyService
6
+ # Copies a file to a remote server
7
+ # @param [Fulmar::Infrastructue::Service::ShellService] shell
8
+ # @param [String] local_file local filename, should be absolute
9
+ # @param [String] remote_host SSH hostname
10
+ # @param [String] remote_dir remote directory
11
+ def self.upload(shell, local_file, remote_host, remote_dir)
12
+ if shell.run "scp #{local_file} #{remote_host}:#{remote_dir.chomp('/')}/"
13
+ "#{remote_dir.chomp('/')}/#{File.basename(local_file)}"
14
+ end
15
+ end
16
+
17
+ # Downloads a file from a remote server
18
+ # @param [Fulmar::Infrastructue::Service::ShellService] shell
19
+ # @param [String] remote_host SSH hostname
20
+ # @param [String] remote_file remote directory
21
+ # @param [String] local_dir local filename, should be absolute
22
+ def self.download(shell, remote_host, remote_file, local_dir = '.')
23
+ if shell.run "scp #{remote_host}:#{remote_file} #{local_dir.chomp('/')}/"
24
+ "#{local_dir.chomp('/')}/#{File.basename(remote_file)}"
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -12,12 +12,11 @@ module Fulmar
12
12
 
13
13
  DEFAULT_CONFIG = {
14
14
  maria: {
15
- hostname: '127.0.0.1',
15
+ host: '127.0.0.1',
16
16
  port: 3306,
17
17
  user: 'root',
18
18
  password: '',
19
19
  encoding: 'utf8',
20
- backup_path: '/tmp'
21
20
  }
22
21
  }
23
22
 
@@ -63,11 +62,11 @@ module Fulmar
63
62
  end
64
63
 
65
64
  def local?
66
- @config[:maria][:hostname] == 'localhost' || @config[:maria][:hostname] == '127.0.0.1'
65
+ @config[:hostname] == 'localhost'
67
66
  end
68
67
 
69
68
  def tunnel
70
- @tunnel ||= Fulmar::Infrastructure::Service::TunnelService.new(@config[:maria][:hostname], @config[:maria][:port])
69
+ @tunnel ||= Fulmar::Infrastructure::Service::TunnelService.new(@config[:hostname], @config[:maria][:port], @config[:maria][:hostname])
71
70
  end
72
71
 
73
72
  # shortcut for DatabaseService.client.query
@@ -82,33 +81,25 @@ module Fulmar
82
81
  disconnect unless state_before
83
82
  end
84
83
 
85
- def dump(filename = nil)
86
-
87
- if filename
88
- # Ensure path is absolute
89
- path = filename[0, 1] == '/' ? filename : @config[:maria][:backup_path] + '/' + filename
90
- else
91
- path = @config[:maria][:backup_path] + '/' + backup_filename
92
- end
93
-
84
+ def dump(filename = backup_filename)
94
85
  diffable = @config[:maria][:diffable_dump] ? '--skip-comments --skip-extended-insert ' : ''
95
86
 
96
- @shell.run "mysqldump -u #{@config[:maria][:user]} --password='#{@config[:maria][:password]}' " \
97
- "#{@config[:maria][:database]} --single-transaction #{diffable}-r \"#{path}\""
87
+ @shell.run "mysqldump -h #{@config[:maria][:host]} -u #{@config[:maria][:user]} --password='#{@config[:maria][:password]}' " \
88
+ "#{@config[:maria][:database]} --single-transaction #{diffable}-r \"#{filename}\""
98
89
 
99
- path
90
+ @config[:remote_path] + '/' + filename
100
91
  end
101
92
 
102
93
  def load_dump(dump_file, database = @config[:maria][:database])
103
- @shell.run "mysql -u #{@config[:maria][:user]} --password='#{@config[:maria][:password]}' " \
94
+ @shell.run "mysql -h #{@config[:maria][:host]} -u #{@config[:maria][:user]} --password='#{@config[:maria][:password]}' " \
104
95
  "-D #{database} < #{dump_file}"
105
96
  end
106
97
 
107
98
  def download_dump(filename = backup_filename)
108
99
  local_path = filename[0, 1] == '/' ? filename : @config[:local_path] + '/' + filename
109
100
  remote_path = dump
110
- copy = system("scp -q #{@config[:maria][:hostname]}:#{remote_path} #{local_path}")
111
- system("ssh #{@config[:maria][:hostname]} 'rm -f #{remote_path}'") # delete temporary file
101
+ copy = system("scp -q #{@config[:hostname]}:#{remote_path} #{local_path}")
102
+ @shell.run "rm -f \"#{remote_path}\"" # delete temporary file
112
103
  if copy
113
104
  local_path
114
105
  else
@@ -121,7 +112,6 @@ module Fulmar
121
112
  # Test configuration
122
113
  def config_test
123
114
  fail 'Configuration option "database" missing.' unless @config[:maria][:database]
124
- @shell.run "test -d '#{@config[:maria][:backup_path]}'"
125
115
  end
126
116
 
127
117
  # Builds the filename for a new database backup file
@@ -136,6 +126,7 @@ module Fulmar
136
126
  path = local? ? @config[:local_path] : @config[:remote_path]
137
127
  @shell = Fulmar::Infrastructure::Service::ShellService.new(path, @config[:hostname])
138
128
  @shell.debug = true if @config[:debug]
129
+ @shell.strict = true
139
130
  end
140
131
 
141
132
  # Compiles a mysql config hash from valid options of the fulmar config
@@ -0,0 +1,42 @@
1
+ module Fulmar
2
+ module Infrastructure
3
+ module Service
4
+ # Implements Flow commands
5
+ class FlowService
6
+ # @param [Fulmar::Infrastructure::Service::ShellService] shell
7
+ # @param [Hash] config
8
+ def initialize(shell, config)
9
+ @remote_shell = shell
10
+ @config = config
11
+ end
12
+
13
+ def cache_clear
14
+ execute('flow:cache:flush --force')
15
+ end
16
+
17
+ def cache_warmup
18
+ execute('flow:cache:warmup')
19
+ end
20
+
21
+ def site_export(filename = export_filename)
22
+ execute("typo3.neos:site:export --filename \"#{filename}\"")
23
+ filename
24
+ end
25
+
26
+ def site_import(filename)
27
+ execute("./flow typo3.neos:site:import --filename \"#{filename}\"")
28
+ end
29
+
30
+ def execute(command)
31
+ @remote_shell.run "FLOW_CONTEXT=\"#{@config[:neos][:environment]}\" ./flow #{command}"
32
+ end
33
+
34
+ protected
35
+
36
+ def export_filename
37
+ "export_#{Time.now.strftime('%Y-%m-%dT%H%M%S')}.xml"
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -98,7 +98,7 @@ module Fulmar
98
98
  return true unless limit > 0
99
99
  releases = list_releases.sort
100
100
  return true if releases.length <= limit
101
- obsolete_dirs = releases[0, releases.length - limit].collect { |dir| "'#{@config[:releases_dir]}/#{dir}'" }
101
+ obsolete_dirs = releases[0, releases.length - limit].collect { |dir| "\"#{@config[:releases_dir]}/#{dir}\"" }
102
102
  @remote_shell.run "rm -fr #{obsolete_dirs.join(' ')}"
103
103
  end
104
104
 
@@ -6,16 +6,17 @@ module Fulmar
6
6
  class TunnelService
7
7
  attr_reader :host, :remote_port, :local_port
8
8
 
9
- def initialize(host, port)
9
+ def initialize(host, port, remote_host = 'localhost')
10
10
  @host = host
11
11
  @remote_port = port
12
+ @remote_host = remote_host
12
13
  @local_port = 0
13
14
  @tunnel_pid = 0
14
15
  end
15
16
 
16
17
  def open
17
18
  @local_port = free_port
18
- @tunnel_pid = Process.spawn "ssh #{@host} -L #{@local_port}:localhost:#{@remote_port} -N"
19
+ @tunnel_pid = Process.spawn "ssh #{@host} -L #{@local_port}:#{@remote_host}:#{@remote_port} -N"
19
20
  sleep 1
20
21
  end
21
22
 
@@ -0,0 +1,68 @@
1
+ require 'fulmar/domain/service/configuration_service'
2
+
3
+ module Fulmar
4
+ module Domain
5
+ module Service
6
+ module Helper
7
+ # Provides the helper methods used in the tasks
8
+ module CommonHelper
9
+ attr_accessor :environment
10
+
11
+ def full_configuration
12
+ configuration.configuration
13
+ end
14
+
15
+ def configuration
16
+ (@_config_service ||= Fulmar::Domain::Service::ConfigurationService.instance)
17
+ end
18
+
19
+ def composer(command, arguments = [])
20
+ (storage['composer'] ||= Fulmar::Infrastructure::Service::ComposerService.new).execute(command, arguments)
21
+ end
22
+
23
+ def local_shell
24
+ storage['local_shell'] ||= new_shell(configuration[:local_path])
25
+ end
26
+
27
+ def remote_shell
28
+ storage['remote_shell'] ||= new_shell(configuration[:remote_path], configuration[:hostname])
29
+ end
30
+
31
+ def file_sync
32
+ storage['file_sync'] ||= Fulmar::FileSync.create_transfer configuration
33
+ end
34
+
35
+ def render_templates
36
+ (Fulmar::Domain::Service::ConfigRenderingService.new configuration).render
37
+ end
38
+
39
+ def git
40
+ storage['git'] ||= Fulmar::Infrastructure::Service::GitService.new configuration
41
+ end
42
+
43
+ def upload(filename)
44
+ Fulmar::Infrastructure::Service::CopyService.upload(local_shell, filename, configuration[:hostname], configuration[:remote_path])
45
+ end
46
+
47
+ def download(filename)
48
+ Fulmar::Infrastructure::Service::CopyService.download(local_shell, configuration[:hostname], filename, configuration[:local_path])
49
+ end
50
+
51
+ def new_shell(path, hostname = 'localhost')
52
+ shell = Fulmar::Infrastructure::Service::ShellService.new(path, hostname)
53
+ shell.strict = true
54
+ shell.debug = configuration[:debug]
55
+ shell
56
+ end
57
+
58
+ def storage
59
+ fail 'You need to set an environment and a target first' unless configuration.ready?
60
+ @storage ||= {}
61
+ @storage[configuration.environment] ||= {}
62
+ @storage[configuration.environment][configuration.target] ||= {}
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,13 @@
1
+ module Fulmar
2
+ module Domain
3
+ module Service
4
+ module Helper
5
+ module DatabaseHelper
6
+ def database
7
+ storage['database'] ||= Fulmar::Infrastructure::Service::Database::DatabaseService.new configuration
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ require 'fulmar/infrastructure/service/flow_service'
2
+
3
+ module Fulmar
4
+ module Domain
5
+ module Service
6
+ module Helper
7
+ module FlowHelper
8
+ def flow
9
+ storage['flow'] ||= Fulmar::Infrastructure::Service::FlowService.new remote_shell, configuration
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -9,12 +9,13 @@ require 'fulmar/domain/service/application_service'
9
9
  require 'fulmar/domain/service/configuration_service'
10
10
  require 'fulmar/domain/service/config_rendering_service'
11
11
 
12
- require 'fulmar/service/common_helper_service'
12
+ require 'fulmar/service/helper/common_helper'
13
13
  require 'fulmar/domain/service/file_sync_service'
14
14
 
15
15
  require 'fulmar/infrastructure/service/composer_service'
16
16
  require 'fulmar/infrastructure/service/shell_service'
17
17
  require 'fulmar/infrastructure/service/git_service'
18
+ require 'fulmar/infrastructure/service/copy_service'
18
19
 
19
20
  require 'fulmar/infrastructure/service/database/database_service'
20
21
 
@@ -1,4 +1,4 @@
1
1
  # Provides a global version number
2
2
  module Fulmar
3
- VERSION = '0.6.5'
3
+ VERSION = '1.0.0'
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.5
4
+ version: 1.0.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-03-24 00:00:00.000000000 Z
12
+ date: 2015-03-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '1'
77
77
  - - ">="
78
78
  - !ruby/object:Gem::Version
79
- version: 1.2.0
79
+ version: 1.4.0
80
80
  type: :runtime
81
81
  prerelease: false
82
82
  version_requirements: !ruby/object:Gem::Requirement
@@ -86,7 +86,7 @@ dependencies:
86
86
  version: '1'
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 1.2.0
89
+ version: 1.4.0
90
90
  - !ruby/object:Gem::Dependency
91
91
  name: ruby_wings
92
92
  requirement: !ruby/object:Gem::Requirement
@@ -124,18 +124,18 @@ files:
124
124
  - bin/fulmar
125
125
  - fulmar.gemspec
126
126
  - lib/fulmar/domain/service/application_service.rb
127
- - lib/fulmar/domain/service/cache_service.rb
128
127
  - lib/fulmar/domain/service/config_rendering_service.rb
129
128
  - lib/fulmar/domain/service/configuration_service.rb
130
129
  - lib/fulmar/domain/service/file_sync_service.rb
131
130
  - lib/fulmar/domain/service/initialization_service.rb
132
- - lib/fulmar/domain/task/setup.rake
131
+ - lib/fulmar/domain/task/base.rake
132
+ - lib/fulmar/domain/task/database_sync.rake
133
+ - lib/fulmar/domain/task/environment.rake
133
134
  - lib/fulmar/domain/task/versions.rake
134
- - lib/fulmar/infrastructure/service/cache/dummy_cache_service.rb
135
- - lib/fulmar/infrastructure/service/cache/neos_cache_service.rb
136
- - lib/fulmar/infrastructure/service/cache/symfony_cache_service.rb
137
135
  - lib/fulmar/infrastructure/service/composer_service.rb
136
+ - lib/fulmar/infrastructure/service/copy_service.rb
138
137
  - lib/fulmar/infrastructure/service/database/database_service.rb
138
+ - lib/fulmar/infrastructure/service/flow_service.rb
139
139
  - lib/fulmar/infrastructure/service/git_service.rb
140
140
  - lib/fulmar/infrastructure/service/shell_service.rb
141
141
  - lib/fulmar/infrastructure/service/transfer/base.rb
@@ -143,7 +143,9 @@ files:
143
143
  - lib/fulmar/infrastructure/service/transfer/rsync_with_versions.rb
144
144
  - lib/fulmar/infrastructure/service/tunnel_service.rb
145
145
  - lib/fulmar/service/bootstrap_service.rb
146
- - lib/fulmar/service/common_helper_service.rb
146
+ - lib/fulmar/service/helper/common_helper.rb
147
+ - lib/fulmar/service/helper/database_helper.rb
148
+ - lib/fulmar/service/helper/flow_helper.rb
147
149
  - lib/fulmar/service/helper_service.rb
148
150
  - lib/fulmar/service/logger_service.rb
149
151
  - lib/fulmar/task_manager.rb
@@ -1,30 +0,0 @@
1
- require 'fulmar/infrastructure/service/cache/dummy_cache_service'
2
- require 'fulmar/infrastructure/service/cache/neos_cache_service'
3
- require 'fulmar/infrastructure/service/cache/symfony_cache_service'
4
-
5
- module Fulmar
6
- module Domain
7
- module Service
8
- # Provides a common interface for all environment specific cache services
9
- class CacheService
10
- attr_reader :type, :cache
11
-
12
- def initialize(shell, config, type = :none)
13
- @type = type
14
- @cache = case type
15
- when :neos
16
- Fulmar::Infrastructure::Service::Cache::NeosCacheService.new(shell, config)
17
- when :symfony
18
- Fulmar::Infrastructure::Service::Cache::SymfonyCacheService.new(shell, config)
19
- else
20
- Fulmar::Infrastructure::Service::Cache::DummyCacheService.new(shell, config)
21
- end
22
- end
23
-
24
- def method_missing(name, parameters)
25
- @cache.call(name, parameters)
26
- end
27
- end
28
- end
29
- end
30
- end
@@ -1,6 +0,0 @@
1
- require 'fulmar'
2
-
3
- desc 'Setup fulmar'
4
- task :setup do
5
- puts 'run setup'
6
- end
@@ -1,25 +0,0 @@
1
- module Fulmar
2
- module Infrastructure
3
- module Service
4
- module Cache
5
- # Implements no cache handling
6
- class DummyCacheService
7
- # @param [Fulmar::Infrastructure::Service::ShellService] shell
8
- # @param [Hash] config
9
- def initialize(shell, config)
10
- @remote_shell = shell
11
- @config = config
12
- end
13
-
14
- def clear
15
- true
16
- end
17
-
18
- def warmup
19
- true
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1,25 +0,0 @@
1
- module Fulmar
2
- module Infrastructure
3
- module Service
4
- module Cache
5
- # Implements Neos cache handling
6
- class NeosCacheService
7
- # @param [Fulmar::Infrastructure::Service::ShellService] shell
8
- # @param [Hash] config
9
- def initialize(shell, config)
10
- @remote_shell = shell
11
- @config = config
12
- end
13
-
14
- def clear
15
- @remote_shell.run "FLOW_CONTEXT=\"#{@config[:neos][:environment]}\" ./flow flow:cache:flush --force"
16
- end
17
-
18
- def warmup
19
- @remote_shell.run "FLOW_CONTEXT=\"#{@config[:neos][:environment]}\" ./flow flow:cache:warmup"
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1,28 +0,0 @@
1
- module Fulmar
2
- module Infrastructure
3
- module Service
4
- module Cache
5
- # Implements Symfony cache handling
6
- class SymfonyCacheService
7
- # @param [Fulmar::Infrastructure::Service::ShellService] shell
8
- # @param [Hash] config
9
- def initialize(shell, config)
10
- @remote_shell = shell
11
- @config = config
12
- end
13
-
14
- def clear
15
- @remote_shell.run [
16
- "rm -fr app/cache/#{@config[:symfony][:environment]}",
17
- "php app/console cache:clear --env=#{@config[:symfony][:environment]}"
18
- ]
19
- end
20
-
21
- def warmup
22
- @remote_shell.run "php app/console cache:warmup --env=#{@config[:symfony][:environment]}"
23
- end
24
- end
25
- end
26
- end
27
- end
28
- end
@@ -1,56 +0,0 @@
1
- require 'fulmar/domain/service/configuration_service'
2
-
3
- module Fulmar
4
- module Domain
5
- module Service
6
- # Provides the helper methods used in the tasks
7
- module CommonHelperService
8
- attr_accessor :environment
9
-
10
- def full_configuration
11
- configuration.configuration
12
- end
13
-
14
- def configuration
15
- (@_config_service ||= Fulmar::Domain::Service::ConfigurationService.instance)
16
- end
17
-
18
- def composer(command, arguments = [])
19
- (@_composer ||= Fulmar::Infrastructure::Service::ComposerService.new).execute(command, arguments)
20
- end
21
-
22
- def local_shell
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]
28
- end
29
-
30
- def remote_shell
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])
36
- end
37
-
38
- def file_sync
39
- @_file_sync ||= Fulmar::FileSync.create_transfer configuration
40
- end
41
-
42
- def database
43
- @_database ||= Fulmar::Infrastructure::Service::Database::DatabaseService.new configuration
44
- end
45
-
46
- def render_templates
47
- (Fulmar::Domain::Service::ConfigRenderingService.new configuration).render
48
- end
49
-
50
- def git
51
- @_git ||= Fulmar::Infrastructure::Service::GitService.new configuration
52
- end
53
- end
54
- end
55
- end
56
- end