rconf 1.0.11 → 1.0.12

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NWVjNmI0Nzc5YjZjODllNWZkMmMzOGM2N2ZlYmVmYzMwNDQxMjNlZA==
4
+ OTg4MDQ2NGY4ZTI1NDMzZTFiNzc5NzYwZTBmMTlkZDQ5NjhhMjM5Nw==
5
5
  data.tar.gz: !binary |-
6
- YjQ5MDVjZmQ1Zjg4NGUyYjZhODU2ZDlkOGI2MzZkOGY3MDFmZjAzYw==
6
+ OTliZTY2MjBjMDZhOGFjZTM3ZTQ5ZmJkOWIzYTdjNGRkZDc1MzU4NA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTAzMTE5ZDI5NGQ5NjhkODg0OTA4YWMwNzQ3ODZlNjIwYjZkOTQ3YjBiN2M4
10
- MDY0NmNhODVmMjZjMjAwNzU1ZmJiMTIyZWQwYjkxZDczYjcxNmY2OTY5MjE5
11
- OTU1YmIwNDFkMWQyZGE1MWZkMmI0NjAxODk3MGIyZGNkNjhlZjY=
9
+ ZDNkZTUwYzAwMzMyZTk1OTBhMmI1YmVlZDYzMTI2Yzc4OTE5ODM1MDU5YTZi
10
+ MTcwN2Q5NWVkZmE5NzBiMzYyZGM3NjMyMWMzZTc1ZTE2YjFkODIxODA3OGU5
11
+ NDVhMmY5M2NlNGJlNTM2MjgwZTdlNDkyMWQ2MTZhNWFkNzMwOTY=
12
12
  data.tar.gz: !binary |-
13
- ODllM2VlYmM3ZDFiMmY3ZTdkODQwMjk1MWQ2YTMwMWQxNDY1YzMyMGEzNjQz
14
- NmVhYjBmYjU1ZDI4Mjk3NzM0NWQ2ZDQ0MjYwNWMwMDY2NTMzNmQyYWFlNmU1
15
- YTRmNTI1Nzk5ZTcyZDJkYmI0OWY0MTY4MWVhMWUyMDdmOGNiYTI=
13
+ MmYwY2I0ZTRlMjRhYTBjYTM2YjdmZjU4Yjk5YzNhNTkxMTdhMGU2YjkzNDdk
14
+ OWUwYThiYTcyZjExODE1MzUyMmM2OWE3ZjYwMjY3NzdiMGIzZmNjOTI2Mjgy
15
+ MTljMThhZGU2MjJkNzk0MzY3YTBlNzQ0MjRjMWUyNGU4OWZiZjk=
@@ -27,6 +27,7 @@ module RightConf
27
27
  'is writable by the current user or ~/cassandra otherwise by default'
28
28
  setting 'abort_on_failure','Whether to abort if Cassandra failed to install (false by default)'
29
29
  setting 'endpoint_snitch', 'Set custom endpoint snitch for installed cassandra'
30
+ setting 'partitioner', 'Set custom partitioner for installed cassandra'
30
31
 
31
32
  # Check whether Cassandra is installed
32
33
  #
@@ -54,6 +55,7 @@ module RightConf
54
55
  # === Return
55
56
  # true:: Always return true
56
57
  def run_linux
58
+ post_note ""
57
59
  install_path(default_install_path) if install_path.nil?
58
60
  abort_on_failure(true) if abort_on_failure.nil?
59
61
  report_check('Installing Cassandra')
@@ -61,7 +63,7 @@ module RightConf
61
63
  if File.exist?(install_path)
62
64
  FileUtils.rm_rf("#{install_path}_old")
63
65
  FileUtils.mv(install_path, "#{install_path}_old")
64
- post_note "Had to move #{install_path} to #{install_path}_old"
66
+ post_note(post_note + "Had to move #{install_path} to #{install_path}_old\n")
65
67
  end
66
68
  FileUtils.mkdir_p(install_path)
67
69
  Dir.chdir(install_path) do
@@ -70,18 +72,11 @@ module RightConf
70
72
  end
71
73
  bin_path = File.join(install_path, "apache-cassandra-#{version}", 'bin')
72
74
  if EnvironmentUpdater.update("PATH=$PATH:#{bin_path}", ['PATH'])
73
- post_note 'Cassandra was installed, please reload your shell to activate it and re-run rconf'
75
+ post_note(post_note + "Cassandra was installed, please reload your shell to activate it and re-run rconf\n")
74
76
  aborting(true)
75
77
  end
76
78
  report_success
77
- if (endpoint_snitch)
78
- report_check 'Change cassandra configuration.'
79
- config_path = File.join(install_path, "apache-cassandra-#{version}", 'conf', 'cassandra.yaml')
80
- backup_ext = '.orig'
81
- Command.execute('sed', '-i', backup_ext, '-e', "s%^endpoint_snitch: .*$%endpoint_snitch: #{endpoint_snitch}%", config_path)
82
- report_success
83
- post_note "Origin config file in #{config_path}#{backup_ext}"
84
- end
79
+ cassandra_configure({:endpoint_snitch => endpoint_snitch, :partitioner => partitioner})
85
80
  end
86
81
  alias :run_darwin :run_linux
87
82
 
@@ -137,6 +132,27 @@ module RightConf
137
132
  opts = abort_on_failure && { :abort_on_failure => message } || {}
138
133
  end
139
134
 
135
+ # Set custom values on the cassandra.yaml file for installed cassandra
136
+ #
137
+ # === Parameters
138
+ # settings(Hash):: key and value of the new settings
139
+ #
140
+ # === Return
141
+ # true:: Always return true
142
+ def cassandra_configure(settings)
143
+ first = true
144
+ report_check 'Change cassandra configuration.'
145
+ config_path = File.join(install_path, "apache-cassandra-#{version}", 'conf', 'cassandra.yaml')
146
+ settings.each do |key, value|
147
+ if (value)
148
+ backup_ext = if first then '.orig' else '' end
149
+ Command.execute('sed', '-i', backup_ext, '-e', "s%^#{key}: .*$%#{key}: #{value}%", config_path)
150
+ first = false
151
+ end
152
+ end
153
+ report_success
154
+ post_note(post_note + "Original config file in #{config_path}.orig\n")
155
+ end
140
156
  end
141
157
  end
142
158
 
@@ -106,10 +106,10 @@ module RightConf
106
106
  aborting(true)
107
107
  elsif rbenv_in_path
108
108
  # rbenv is installed and initialized; make sure we have a suitable version
109
- res.output =~ /^rbenv ([0-9]+)\.([0-9]+)\.([0-9]+)$/
110
- maj, min, build = [$1.to_i, $2.to_i, $3.to_i]
109
+ res.output =~ /^rbenv ([0-9]+)\.([0-9]+)\.([0-9]+)(\-.*)?$/
110
+ maj, min, build, subhash = [$1.to_i, $2.to_i, $3.to_i, $4]
111
111
  if maj == 0 && min < 4
112
- report_fatal("rconf requires rbenv version 0.4.0 or greater, you have #{maj}.#{min}.#{build} installed, "+
112
+ report_fatal("rconf requires rbenv version 0.4.0 or greater, you have #{maj}.#{min}.#{build}#{subhash} installed, "+
113
113
  "please upgrade (e.g. via 'brew upgrade rbenv') and try again")
114
114
  end
115
115
  else
@@ -80,7 +80,7 @@ module RightConf
80
80
  binding = blk.binding.eval('self')
81
81
  meth = blk.call
82
82
  target = dispatch_candidates(meth).detect do |candidate|
83
- binding.respond_to?(candidate)
83
+ binding.respond_to?(candidate, true)
84
84
  end
85
85
  raise "No platform dispatch target found in #{binding.class} for " +
86
86
  "'#{meth.inspect}', tried " + dispatch_candidates(meth).join(', ') unless target
@@ -13,7 +13,7 @@ module RightConf
13
13
 
14
14
  MAJOR = 1
15
15
  MINOR = 0
16
- BUILD = 11
16
+ BUILD = 12
17
17
 
18
18
  VERSION = [MAJOR, MINOR, BUILD].map(&:to_s).join('.')
19
19
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rconf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.11
4
+ version: 1.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raphael Simon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-22 00:00:00.000000000 Z
11
+ date: 2013-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec