asmodai 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,8 +22,6 @@ class Asmodai::CLI < Thor
22
22
  end
23
23
 
24
24
  desc "install", "Installs startup scripts to /etc/init.d"
25
- method_option :force, :type => :boolean,
26
- :desc => "Overwrite a given init.d-file"
27
25
  method_option :autostart,
28
26
  :type => :boolean,
29
27
  :desc => %{If you provide this, startup-links will be generated for the given runlevel. This is currently only supported on Debian/Ubuntu.}
@@ -36,17 +34,19 @@ class Asmodai::CLI < Thor
36
34
  if @info.rvm_environment?
37
35
  @asmodai=Pathname.new(@info.rvm_wrapper_path)
38
36
  if !@asmodai.exist?
39
- @info.execute_sudo_checked("rvm wrapper #{@info.rvm_ruby_string} bootup asmodai")
37
+ system "rvm wrapper #{@info.rvm_ruby_string} bootup asmodai"
40
38
  end
41
39
  end
40
+
42
41
  path = "/etc/init.d/#{@info.daemon_name}"
43
42
 
44
- if options[:force]
45
- FileUtils.rm_f(path)
43
+ IO.popen "sudo bash -c \"cat > #{path}; chmod a+x #{path}\"", "r+" do |io|
44
+ template_path = File.join(
45
+ File.dirname(__FILE__), "generator/templates/init_d.erb")
46
+
47
+ io.puts ERB.new(File.read(template_path)).result(binding)
48
+ io.close
46
49
  end
47
-
48
- template "templates/init_d.erb", path
49
- system "chmod a+x #{path}"
50
50
 
51
51
  if options[:autostart]
52
52
  if (update_bin=`which update-rc.d`.strip).blank?
@@ -26,7 +26,7 @@ class Asmodai::Info
26
26
  end
27
27
 
28
28
  def rvm_environment?
29
- !rvm_ruby_string.empty?
29
+ !rvm_ruby_string.empty? || ENV['GEM_PATH']
30
30
  end
31
31
 
32
32
  def rvm_ruby_string
@@ -1,3 +1,3 @@
1
1
  module Asmodai
2
- VERSION = "0.1.6"
3
- end
2
+ VERSION = "0.1.7"
3
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 6
9
- version: 0.1.6
8
+ - 7
9
+ version: 0.1.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Sebastian Morawietz
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-25 00:00:00 +01:00
17
+ date: 2011-01-27 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency