baptize 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzE5NTg0ZDU5MmZmMDAzNWQzM2E4NDc5OTUwYjVlNGYyNjRhZWUzNQ==
4
+ NDJjNzBjYWM3MDg4MTQ3ODNjOTE1NGJhNTg5ZDE1ZWIxMDkzYTBiYw==
5
5
  data.tar.gz: !binary |-
6
- ZDM3MWI1OTQyMzQ1ZjJjMmU5ZDQzNzViOGYzNTg4ZWFiODY2ZmRlNQ==
6
+ MzQ5MzNmM2I1OTcwZTQ3N2RiMGZiMWYwYjUxNDdjNGQ3ZTU4MGQyZA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZDJjNTA5YjI1MzZmNmYzZWQwZDE3M2FiMmIyOGEyYzk0ODE5NWFkZGU3MjU4
10
- OTM0NDZjYWQwMjgyZTE0NzM3NjhjZmExODE0MjNkY2NlOWE0MGZlYmJmNzU4
11
- ODdkYWQ2MTc3ZmI4Y2VhOWMxOTY5ODBkODE2ZmM1N2E4OGY2ZjM=
9
+ MTIwNWE0ZGI5MWZkODJhNWEzNTAyMmMwMzFlNmI0Mzc0NjgzNmU5Y2ZjYzZj
10
+ MWZjZDI5MDBiZjkzMjhhZTI5OTVmZjliYjRhMzVmOWQ2M2UwZGExN2IyYzA5
11
+ OGI3MDJlMGZkZDFiOGRmYzA4YTEyZGY0MjY1Mzc4YTcwOWQ1NmY=
12
12
  data.tar.gz: !binary |-
13
- OGQwZjFmOTE4ODE1N2NlNzEzMGNhNzdiNTFjNjY5NTYyNzIzMTNlMzcxMzMw
14
- M2IxMjY2Njk2MTg5YzkyMjU5YjE1MTlkMmVmNzA3ZWM5ZWY2YmIyYTM1NjVk
15
- ZmY1NmRkMTcxZmYzYTMzYmVhNjQxNDg1MDQzZWQ2NDQyNjZhMDA=
13
+ ZDZlNTA2NjIwZmZlZjYyM2FhNWRhNGQ5ODdlMDViYzZkNmVjOTYwZDQzMDI3
14
+ MzRkMGViOGU1NTQzYWUyMzM5ZjhhMjRjMTVmNGQxOWM5Yjk5MTJkZTE2ODk0
15
+ ZGRmODgxY2E1YjQxNjZlMzJjOTk4NmQ4MWJkMThkZDAxMWRiYTY=
data/lib/baptize/dsl.rb CHANGED
@@ -123,15 +123,14 @@ module Capistrano
123
123
  desc "Configures #{policy.role}"
124
124
  task policy.role do
125
125
  logger.info "Applying policy #{policy.role}"
126
- old_env_roles = ENV['ROLES']
127
126
  # TODO: This is maybe not ideal, as multiple roles would be applied in sequence, not parallel.
128
127
  # Also, I'm not sure if they would be skipped for later roles, if already run for an earlier one
129
128
  Capistrano::Baptize::DSL.packages_installed = []
130
- ENV['ROLES'] = policy.role.to_s
131
- policy.dependencies.each do |task_name|
132
- find_and_execute_task(task_name)
129
+ for_roles policy.role do
130
+ policy.dependencies.each do |task_name|
131
+ find_and_execute_task(task_name)
132
+ end
133
133
  end
134
- ENV['ROLES'] = old_env_roles
135
134
  end
136
135
  end
137
136
  end
@@ -2,6 +2,16 @@ module Capistrano
2
2
  module Baptize
3
3
 
4
4
  module Helpers
5
+
6
+ def for_roles(*roles, &block)
7
+ old_env_roles = ENV['ROLES']
8
+ ENV['ROLES'] = Array(roles).flatten.map(&:to_s).join(",")
9
+ logger.info "Invoking for roles: #{ENV['ROLES']}"
10
+ block.call
11
+ ensure
12
+ ENV['ROLES'] = old_env_roles
13
+ end
14
+
5
15
  def asset_path(asset)
6
16
  File.join("#{capistrano_path}/assets", asset)
7
17
  end
@@ -4,8 +4,8 @@ module Capistrano
4
4
  # Defines all baptize top-level tasks
5
5
  def self.install(scope)
6
6
  scope.instance_eval do
7
- set :root_path { File.expand_path(Dir.pwd) }
8
- set :capistrano_path { "#{root_path}/capistrano" }
7
+ set(:root_path) { File.expand_path(Dir.pwd) }
8
+ set(:capistrano_path) { "#{root_path}/capistrano" }
9
9
 
10
10
  # Can't run this here, since Capfile might want to redefine
11
11
  # load_configuration :roles
@@ -22,7 +22,13 @@ module Capistrano
22
22
  if ini_file.is_a?(Hash) && ini_file[:path]
23
23
  path = ini_file[:path]
24
24
  else
25
- path = "/etc/php5/conf.d/#{package_name}.ini"
25
+ folder = "/etc/php5/conf.d"
26
+ invoke_command("php --ini") do |ch, stream, out|
27
+ if /Scan for additional .ini files in: (.*)/.match(out)
28
+ folder = $1
29
+ end
30
+ end
31
+ path = "#{folder}/#{package_name}.ini"
26
32
  end
27
33
  put(text, path)
28
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: baptize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Troels Knak-Nielsen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-06 00:00:00.000000000 Z
11
+ date: 2013-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -60,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
60
  version: '0'
61
61
  requirements: []
62
62
  rubyforge_project:
63
- rubygems_version: 2.0.3
63
+ rubygems_version: 2.0.7
64
64
  signing_key:
65
65
  specification_version: 4
66
66
  summary: Baptize is an extension for Capistrano, that allows for server provisioning