jackdempsey-beet 0.1.6 → 0.1.7
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/VERSION +1 -1
- data/beet.gemspec +1 -1
- data/bin/beet +3 -0
- data/lib/beet/execution.rb +15 -0
- data/lib/beet/executor.rb +6 -4
- data/lib/beet/recipes/passenger/vhost.rb +13 -12
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.7
|
data/beet.gemspec
CHANGED
data/bin/beet
CHANGED
@@ -9,6 +9,9 @@ end
|
|
9
9
|
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
10
10
|
require 'beet'
|
11
11
|
|
12
|
+
WIN32 = (RUBY_PLATFORM =~ /win32|mingw|bccwin|cygwin/) rescue nil
|
13
|
+
SUDO = (WIN32 || ENV['SUDOLESS']) ? '': 'sudo '
|
14
|
+
|
12
15
|
class BeetRunner < Thor
|
13
16
|
map "-g" => :generate
|
14
17
|
map "-j" => :just_recipe
|
data/lib/beet/execution.rb
CHANGED
@@ -13,6 +13,21 @@ module Beet
|
|
13
13
|
`#{command}`
|
14
14
|
end
|
15
15
|
|
16
|
+
# Executes a command with sudo
|
17
|
+
#
|
18
|
+
# ==== Example
|
19
|
+
#
|
20
|
+
# inside('vendor') do
|
21
|
+
# sudo('mkdir /var/log/something')
|
22
|
+
# end
|
23
|
+
#
|
24
|
+
def sudo(command, log_action = true)
|
25
|
+
command = "#{SUDO}#{command}"
|
26
|
+
|
27
|
+
log 'executing', "#{command} from #{Dir.pwd}" if log_action
|
28
|
+
`#{command}`
|
29
|
+
end
|
30
|
+
|
16
31
|
# Executes a ruby script (taking into account WIN32 platform quirks)
|
17
32
|
def run_ruby_script(command, log_action = true)
|
18
33
|
ruby_command = RUBY_PLATFORM=~ /win32/ ? 'ruby ' : ''
|
data/lib/beet/executor.rb
CHANGED
@@ -94,10 +94,12 @@ module Beet
|
|
94
94
|
private
|
95
95
|
|
96
96
|
def print_todo
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
97
|
+
unless todo_items.empty?
|
98
|
+
puts '#' * 30
|
99
|
+
puts "TODO Items:"
|
100
|
+
puts todo_items
|
101
|
+
puts '#' * 30
|
102
|
+
end
|
101
103
|
end
|
102
104
|
|
103
105
|
def calculate_project_root(project_name)
|
@@ -1,16 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
%{
|
1
|
+
file "#{project_name}.local.vhost.conf" do
|
2
|
+
%{
|
4
3
|
<VirtualHost *:80>
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
4
|
+
ServerName #{project_name}.local
|
5
|
+
DocumentRoot "#{root}/public"
|
6
|
+
RackEnv development
|
7
|
+
<directory "#{root}/public">
|
8
|
+
Order allow,deny
|
9
|
+
Allow from all
|
10
|
+
</directory>
|
12
11
|
</VirtualHost>
|
13
12
|
}.strip
|
14
|
-
end
|
15
|
-
run "sudo mv ./#{project_name}.local.vhost.conf /etc/apache2/passenger_pane_vhosts"
|
16
13
|
end
|
14
|
+
default_to = "/etc/apache2/passenger_pane_vhosts"
|
15
|
+
answer = ask "Write file to: [#{default_to} default]"
|
16
|
+
filename = answer.empty? ? default_to : answer
|
17
|
+
sudo "mv ./#{project_name}.local.vhost.conf #{filename}"
|