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 CHANGED
@@ -1 +1 @@
1
- 0.1.6
1
+ 0.1.7
data/beet.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{beet}
5
- s.version = "0.1.6"
5
+ s.version = "0.1.7"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Jack Dempsey"]
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
@@ -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
- puts '#' * 30
98
- puts "TODO Items:"
99
- puts todo_items
100
- puts '#' * 30
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
- in_root do
2
- file "#{project_name}.local.vhost.conf" do
3
- %{
1
+ file "#{project_name}.local.vhost.conf" do
2
+ %{
4
3
  <VirtualHost *:80>
5
- ServerName #{project_name}.local
6
- DocumentRoot "#{root}/public"
7
- RackEnv development
8
- <directory "#{root}/public">
9
- Order allow,deny
10
- Allow from all
11
- </directory>
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}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jackdempsey-beet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Dempsey