ongr_deploy 0.0.6 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fbff794e477e1b05c77b0dfac5019769ac601ccb
4
- data.tar.gz: 5e269e178c88637b8c1ae6a7d35158662ed49ed3
3
+ metadata.gz: 58ba2567e8f29b31625b37cc65bc3f377c29381f
4
+ data.tar.gz: 0cf74b33aff48f6f8cce1480cb6a661668598c50
5
5
  SHA512:
6
- metadata.gz: 4012e6595d89e8ac2b88c7d8597787da25e55650c5602848e6a7c7975e184b7ad3f64ca6e94ee3f3b5a77be2445c690fa1acc4119063f20a81fcebbf130a3b72
7
- data.tar.gz: 0e11addd5a6804c37913354f92562cc55aa85cb17430e5c42435863d26d88a06ed8b5cb08589dde89fea5c4c11e4c4b2d773f1a9188072ef161154693ed1e834
6
+ metadata.gz: fc93ccf6f53aef068dc2a4beedeeee3e86aa131ba34fb6d8844629fd3e0a640dc59e1d25ff1744769e7f1ae7a864bafbee5036c505df32d7813d1974fae700b4
7
+ data.tar.gz: a8c53d6e665c28ba5b5c7aedb209fed8f57503f829324f239879095b5dd6b79b4eebf84a82e7a72bb6a1509c3a1a0dd28a10102ff15096dce019e02ad59824f0
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014-2015 NFQ Technologies UAB
1
+ Copyright (c) 2014-2016 NFQ Technologies UAB
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -0,0 +1,29 @@
1
+ require "aws-sdk"
2
+
3
+ module OngrDeploy
4
+
5
+ module Aws
6
+
7
+ def autoscale( name, *args )
8
+ ::Aws.config.update(
9
+ {
10
+ region: fetch( :aws_region ),
11
+ credentials: ::Aws::Credentials.new( fetch( :aws_id ), fetch( :aws_secret ) )
12
+ }
13
+ )
14
+
15
+ ec2_client = ::Aws::EC2::Client.new
16
+ autoscale_client = ::Aws::AutoScaling::Client.new
17
+
18
+ autoscale = ::Aws::AutoScaling::AutoScalingGroup.new name, autoscale_client
19
+
20
+ autoscale.instances.each do |i|
21
+ instance = ::Aws::EC2::Instance.new i.id, client: ec2_client
22
+
23
+ server instance.private_ip_address, *args
24
+ end
25
+ end
26
+
27
+ end
28
+
29
+ end
@@ -0,0 +1,35 @@
1
+ module OngrDeploy
2
+
3
+ module Core
4
+
5
+ def ongr_setup
6
+ set :stage_config_path, "app/deploy"
7
+ set :deploy_config_path, "app/deploy.rb"
8
+
9
+ require "capistrano/setup"
10
+
11
+ stages.each do |stage|
12
+ Rake::Task[stage].clear_actions
13
+
14
+ Rake::Task.define_task( stage ) do
15
+ invoke "load:defaults"
16
+
17
+ load deploy_config_path
18
+ load stage_config_path.join "#{stage}.rb"
19
+
20
+ begin
21
+ load File.expand_path( "../scm/#{fetch( :scm )}.rb", __FILE__ )
22
+ rescue LoadError
23
+ load "capistrano/#{fetch( :scm )}.rb"
24
+ end
25
+
26
+ I18n.locale = fetch :locale, :en
27
+
28
+ configure_backend
29
+ end
30
+ end
31
+ end
32
+
33
+ end
34
+
35
+ end
@@ -1,5 +1,5 @@
1
1
  module OngrDeploy
2
2
 
3
- VERSION = "0.0.6"
3
+ VERSION = "0.1.0"
4
4
 
5
5
  end
data/lib/ongr_deploy.rb CHANGED
@@ -1,35 +1,7 @@
1
- module OngrDeploy
1
+ require "ongr_deploy/core"
2
+ require "ongr_deploy/aws"
2
3
 
3
- def ongr_setup
4
- set :stage_config_path, "app/deploy"
5
- set :deploy_config_path, "app/deploy.rb"
6
-
7
- require "capistrano/setup"
8
-
9
- stages.each do |stage|
10
- Rake::Task[stage].clear_actions
11
-
12
- Rake::Task.define_task( stage ) do
13
- invoke "load:defaults"
14
-
15
- load deploy_config_path
16
- load stage_config_path.join "#{stage}.rb"
17
-
18
- begin
19
- load File.expand_path( "../ongr_deploy/scm/#{fetch( :scm )}.rb", __FILE__ )
20
- rescue LoadError
21
- load "capistrano/#{fetch( :scm )}.rb"
22
- end
23
-
24
- I18n.locale = fetch :locale, :en
25
-
26
- configure_backend
27
- end
28
- end
29
- end
30
-
31
- end
32
-
33
- self.extend OngrDeploy
4
+ self.extend OngrDeploy::Core
5
+ self.extend OngrDeploy::Aws
34
6
 
35
7
  ongr_setup
@@ -1,3 +1,6 @@
1
+ require "yaml"
2
+ require "deep_merge"
3
+
1
4
  namespace :rsync do
2
5
 
3
6
  def strategy
@@ -103,4 +106,29 @@ namespace :deploy do
103
106
  invoke :"rsync:pack_release"
104
107
  end
105
108
 
109
+ task :genconf do
110
+ on release_roles :all do
111
+ within release_path do
112
+ fqdn = capture :hostname, "-f"
113
+ dist = YAML::load File.read( "app/config/parameters.yml.dist" )
114
+ dist_env = fqdn.include?( "stage" ) ? "stage" : "live"
115
+ dist_list = ["parameters.yml.#{dist_env}", "parameters.yml.#{dist_env}.#{fqdn[/([a-z\-]+)/,1]}"]
116
+
117
+ dist_list.each do |df|
118
+ if File.exists? "app/config/#{df}"
119
+ overrides = YAML::load File.read( "app/config/#{df}" )
120
+
121
+ dist.deep_merge! overrides
122
+ end
123
+ end
124
+
125
+ content = StringIO.new dist.to_yaml
126
+
127
+ execute "cp", "#{fetch(:deploy_to)}/shared/app/config/parameters.yml", "#{fetch(:deploy_to)}/shared/app/config/parameters-#{Time.new.strftime "%Y%m%d%H%M"}.yml"
128
+ upload! content, "#{fetch(:deploy_to)}/shared/app/config/parameters.yml"
129
+ execute "chmod", "664", "#{fetch(:deploy_to)}/shared/app/config/parameters.yml"
130
+ end
131
+ end
132
+ end
133
+
106
134
  end
metadata CHANGED
@@ -1,29 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ongr_deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Voldemaras Kadys
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-29 00:00:00.000000000 Z
11
+ date: 2016-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: '3.3'
19
+ version: 3.3.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: '3.3'
26
+ version: 3.3.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: aws-sdk
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 2.2.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 2.2.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: deep_merge
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 1.0.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 1.0.0
27
55
  description: Capistrano extension
28
56
  email: info@ongr.io
29
57
  executables:
@@ -31,21 +59,23 @@ executables:
31
59
  extensions: []
32
60
  extra_rdoc_files: []
33
61
  files:
34
- - LICENSE
35
- - README.rdoc
36
- - Rakefile
37
62
  - bin/ongr
38
- - lib/ongr_deploy.rb
39
63
  - lib/ongr_deploy/application.rb
64
+ - lib/ongr_deploy/aws.rb
65
+ - lib/ongr_deploy/core.rb
40
66
  - lib/ongr_deploy/scm/archive.rb
41
67
  - lib/ongr_deploy/scm/rsync.rb
42
68
  - lib/ongr_deploy/version.rb
69
+ - lib/ongr_deploy.rb
43
70
  - lib/sample/Capfile
44
71
  - lib/sample/deploy.rb
45
72
  - lib/sample/stage.rb
46
73
  - lib/tasks/ongr_deploy.rake
47
74
  - lib/tasks/scm/archive.rake
48
75
  - lib/tasks/scm/rsync.rake
76
+ - LICENSE
77
+ - Rakefile
78
+ - README.rdoc
49
79
  homepage: https://github.com/ongr-io/ongr_deploy
50
80
  licenses:
51
81
  - MIT
@@ -56,17 +86,17 @@ require_paths:
56
86
  - lib
57
87
  required_ruby_version: !ruby/object:Gem::Requirement
58
88
  requirements:
59
- - - ">="
89
+ - - '>='
60
90
  - !ruby/object:Gem::Version
61
91
  version: '0'
62
92
  required_rubygems_version: !ruby/object:Gem::Requirement
63
93
  requirements:
64
- - - ">="
94
+ - - '>='
65
95
  - !ruby/object:Gem::Version
66
96
  version: '0'
67
97
  requirements: []
68
98
  rubyforge_project:
69
- rubygems_version: 2.4.5
99
+ rubygems_version: 2.0.14.1
70
100
  signing_key:
71
101
  specification_version: 4
72
102
  summary: Capistrano extension for Symfony2 & ONGR projects