freyr 0.5.1 → 0.5.2
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.
- data/Freyrfile +2 -0
- data/VERSION +1 -1
- data/lib/freyr/command.rb +26 -11
- data/lib/freyr/pid_file.rb +1 -1
- data/lib/freyr/rvm.rb +4 -9
- metadata +4 -4
data/Freyrfile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.2
|
data/lib/freyr/command.rb
CHANGED
@@ -24,11 +24,12 @@ module Freyr
|
|
24
24
|
|
25
25
|
total_time = Time.now
|
26
26
|
|
27
|
+
Freyr.logger.debug("attempting to run command") {command.inspect}
|
28
|
+
|
27
29
|
pid = spawn(command)
|
28
30
|
|
29
|
-
|
30
|
-
str =
|
31
|
-
OUT.puts '',"Starting #{info.name} with #{command.inspect}", '='*str.length
|
31
|
+
str = "Starting #{info.name} with #{command.inspect}"
|
32
|
+
OUT.puts '',str, '='*str.length
|
32
33
|
Process.detach(pid)
|
33
34
|
|
34
35
|
pid = service.pid_file.wait_for_pid
|
@@ -83,19 +84,33 @@ module Freyr
|
|
83
84
|
raise AdminRequired if info.sudo && !Freyr.is_root?
|
84
85
|
end
|
85
86
|
|
86
|
-
def chdir
|
87
|
-
|
87
|
+
def chdir &blk
|
88
|
+
if block_given?
|
89
|
+
Dir.chdir(File.expand_path(info.dir),&blk)
|
90
|
+
else
|
91
|
+
Dir.chdir(File.expand_path(info.dir))
|
92
|
+
end
|
88
93
|
end
|
89
94
|
|
90
95
|
def spawn(command)
|
91
96
|
if info.rvm && RVM.installed?
|
92
|
-
Freyr.logger.debug(
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
97
|
+
Freyr.logger.debug("rvm insalled")
|
98
|
+
chdir do
|
99
|
+
if File.exist? '.rvmrc'
|
100
|
+
Freyr.logger.debug('adding rvmrc to source')
|
101
|
+
command = "source .rvmrc && #{command}"
|
102
|
+
Freyr.logger.debug('changed command to') {command}
|
103
|
+
else
|
104
|
+
Freyr.logger.debug('attempting to set rvm') {info.rvm}
|
105
|
+
if RVM.installed?(info.rvm)
|
106
|
+
command = "rvm #{info.rvm} exec #{command}"
|
107
|
+
Freyr.logger.debug('changed command to') {command}
|
108
|
+
else
|
109
|
+
abort("must setup rvm correctly, run: rvm --install --create #{info.rvm}")
|
110
|
+
end
|
111
|
+
end
|
98
112
|
end
|
113
|
+
|
99
114
|
elsif info.rvm
|
100
115
|
Freyr.logger.debug("rvm not installed so can't switch to") {info.rvm}
|
101
116
|
end
|
data/lib/freyr/pid_file.rb
CHANGED
data/lib/freyr/rvm.rb
CHANGED
@@ -14,22 +14,17 @@ module Freyr
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def rubies
|
17
|
-
@rubies ||= `rvm list`.
|
18
|
-
next unless line =~ /^(\s{3}|=)/
|
19
|
-
line.strip.sub(/\=\>\s/,'').sub(/\s\[.+\]$/,'')
|
20
|
-
end.compact
|
17
|
+
@rubies ||= `rvm list strings`.chomp.split("\n")
|
21
18
|
end
|
22
19
|
|
23
20
|
def gemsets_for ruby
|
24
21
|
@gemsets_for ||= Hash.new do |h,ruby|
|
25
|
-
output = `rvm #{ruby} exec rvm gemset list`.
|
26
|
-
output.shift
|
22
|
+
output = `rvm #{ruby} exec rvm gemset list strings`.chomp.split("\n")
|
27
23
|
h[ruby] = output.collect do |line|
|
28
|
-
|
29
|
-
line.strip.sub(/\=\>\s/,'')
|
24
|
+
line.strip.sub(/\s\(.+\)/,'')
|
30
25
|
end.compact
|
31
26
|
end
|
32
27
|
@gemsets_for[ruby]
|
33
28
|
end
|
34
29
|
end
|
35
|
-
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: freyr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 2
|
10
|
+
version: 0.5.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tal Atlas
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-09-
|
18
|
+
date: 2011-09-28 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rspec
|