rconf 0.6.11 → 0.6.13

Sign up to get free protection for your applications and to get access to all the features.
data/bin/rconf CHANGED
@@ -39,9 +39,9 @@ where [options] are:
39
39
  opt :verbose, 'Print debug output'
40
40
  end
41
41
  if opts[:config].nil? && !opts[:configurators]
42
- opts[:config] = Dir['./*.rc']
42
+ opts[:config] = Dir["./*#{CONFIG_EXTENSION}"]
43
43
  if opts[:config].empty?
44
- Trollop::die :config, "not used and could not find a '.rc' file in the working directory"
44
+ Trollop::die :config, "not used and could not find a '#{CONFIG_EXTENSION}' file in the working directory"
45
45
  else
46
46
  opts[:config] = opts[:config].first
47
47
  end
@@ -93,14 +93,21 @@ where [options] are:
93
93
  begin
94
94
  lang = Language.load(options[:config])
95
95
  report_fatal("Validation of configuration file failed:\n -#{lang.validation_errors.join("\n -").map(&:red)}") unless lang.validation_errors.empty?
96
+ aborted = false
96
97
  Dir.chdir(File.dirname(options[:config])) do
97
98
  lang.configurators.each do |c|
98
99
  c.run
99
- break if c.aborting
100
+ break if aborted = c.aborting
100
101
  c.post_process
101
102
  end
102
103
  end
103
- report("Successfully configured #{File.basename(options[:config], '.rc').blue} for #{Platform.family.to_s.blue}")
104
+ project = File.basename(options[:config], CONFIG_EXTENSION).blue
105
+ platform = Platform.family.to_s.blue
106
+ if aborted
107
+ report("Configuration of #{project} stopped, please follow instructions above to proceed")
108
+ else
109
+ report("Successfully configured #{project} for #{platform}")
110
+ end
104
111
  rescue Exception => e
105
112
  raise if e.is_a?(SystemExit)
106
113
  report_fatal("Execution failed with exception '#{e.message.red}'\n#{e.backtrace.join("\n").grey}")
@@ -5,5 +5,5 @@ ruby do
5
5
  gemset 'my_project'
6
6
  end
7
7
  bundler do
8
- bundler_version '1.0.7'
8
+ bundler_version '1.0.10'
9
9
  end
@@ -68,7 +68,7 @@ module RightConf
68
68
  # === Return
69
69
  # true:: Always return true
70
70
  def set_defaults
71
- right_site_src_path(Dir.getwd)
71
+ right_site_src_path(File.expand_path(Dir.getwd))
72
72
  library_src_path(File.expand_path(File.join(Dir.getwd, '..', 'library'))) if library_src_path.nil?
73
73
  gem_version(PASSENGER_GEM_VERSION) if gem_version.nil?
74
74
  install_path(default_install_path) if install_path.nil?
@@ -212,7 +212,7 @@ http {
212
212
  ssi on;
213
213
  listen 8080;
214
214
  server_name right-site.rightscale.local;
215
- root /Users/raphael/src/right_site/public;
215
+ root #{File.join(right_site_src_path, 'public')};
216
216
  passenger_enabled on;
217
217
  rails_env development;
218
218
 
@@ -69,8 +69,6 @@ module RightConf
69
69
  report_check("Creating gemset #{gemset} for #{version}")
70
70
  Command.execute('rvm', version, 'gemset', 'create', gemset,
71
71
  :abort_on_failure => "Failed to create gemset '#{gemset}'")
72
- Command.execute('rvm', "#{version}@#{gemset}", 'exec', 'gem', 'install', 'rconf',
73
- :abort_on_failure => "Failed to install rconf gem in #{version}@#{gemset}")
74
72
  report_success
75
73
  end
76
74
  report_check("Switching to gemset #{gemset}")
@@ -146,8 +144,9 @@ module RightConf
146
144
  def install_ruby(ruby)
147
145
  Platform.dispatch(ruby) { :install_ruby_prerequesites }
148
146
  report_check("Installing #{ruby} (this will take a while, please be patient)")
149
- res = Command.execute('rvm', 'install', ruby)
150
- report_result(res.success?)
147
+ Command.execute('rvm', 'install', ruby, :abort_on_failure => 'Failed to install ruby')
148
+ Command.execute("rvm #{version}@#{gemset} exec -- gem install rconf")
149
+ report_success
151
150
  res.output
152
151
  end
153
152
 
@@ -204,7 +203,7 @@ module RightConf
204
203
  end
205
204
  Command.execute('rvm', "#{version}@#{gemset}", 'trust', 'rvmrc')
206
205
  report_success
207
- post_note "Configuration required switching the active ruby\nPlease run " + 'cd ..;cd -'.blue + ' to activate it and re-run rconf'
206
+ post_note "Configuration required switching the active ruby\nPlease run " + 'cd ..;cd -'.blue + ' to activate it and finish configuration'.green
208
207
  rescue Exception => e
209
208
  report_failure
210
209
  report_error(e.message)
data/lib/rconf/profile.rb CHANGED
@@ -13,6 +13,9 @@ require 'yaml'
13
13
 
14
14
  module RightConf
15
15
 
16
+ # rconf configuration file extension
17
+ CONFIG_EXTENSION = '.rconf'
18
+
16
19
  class Profile
17
20
 
18
21
  include Singleton
@@ -76,7 +79,7 @@ module RightConf
76
79
  # === Return
77
80
  # path(String):: Profile file path
78
81
  def profile_path
79
- profile_path = ENV['RCONF_PROFILE'] || File.join(ENV['HOME'], '.rconf')
82
+ profile_path = ENV['RCONF_PROFILE'] || File.join(ENV['HOME'], CONFIG_EXTENSION)
80
83
  end
81
84
 
82
85
  # Persist profile to file
data/lib/rconf/version.rb CHANGED
@@ -13,18 +13,18 @@ module RightConf
13
13
 
14
14
  MAJOR = 0
15
15
  MINOR = 6
16
- BUILD = 11
16
+ BUILD = 13
17
17
 
18
18
  VERSION = [MAJOR, MINOR, BUILD].map(&:to_s).join('.')
19
19
 
20
20
  DESCRIPTION = <<-EOS
21
21
  rconf configures the environment for a given application. rconf reads
22
- the content of an application configuration file (.rc) and installs and/or
22
+ the content of an application configuration file and installs and/or
23
23
  configures the required tools for running or developing the corresponding
24
24
  application. rconf can easily be extended to configure new tools and makes
25
25
  it easy to support multiple platforms.
26
26
  Consult the README.rdoc file for information on how to write rconf
27
- configuration files (.rc).
27
+ configuration files.
28
28
  EOS
29
29
 
30
30
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rconf
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.6.11
5
+ version: 0.6.13
6
6
  platform: ruby
7
7
  authors:
8
8
  - Raphael Simon
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-03-12 00:00:00 -08:00
13
+ date: 2011-03-12 23:00:00 -08:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -37,12 +37,12 @@ dependencies:
37
37
  version_requirements: *id002
38
38
  description: |
39
39
  rconf configures the environment for a given application. rconf reads
40
- the content of an application configuration file (.rc) and installs and/or
40
+ the content of an application configuration file and installs and/or
41
41
  configures the required tools for running or developing the corresponding
42
42
  application. rconf can easily be extended to configure new tools and makes
43
43
  it easy to support multiple platforms.
44
44
  Consult the README.rdoc file for information on how to write rconf
45
- configuration files (.rc).
45
+ configuration files.
46
46
 
47
47
  email:
48
48
  - raphael@rightscale.com
@@ -57,7 +57,7 @@ files:
57
57
  - README.rdoc
58
58
  - Rakefile
59
59
  - bin/rconf
60
- - examples/sample.rc
60
+ - examples/sample.rconf
61
61
  - lib/rconf.rb
62
62
  - lib/rconf/command.rb
63
63
  - lib/rconf/configurator.rb