powder 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/CHANGELOG.md +9 -0
  2. data/Readme.md +34 -23
  3. data/bin/powder +42 -6
  4. data/lib/powder/version.rb +1 -1
  5. metadata +4 -20
@@ -1,3 +1,12 @@
1
+ ### 0.1.2 / TBA
2
+
3
+ * X minor changes
4
+
5
+ * add up and down commands
6
+ ([commit](https://github.com/Rodreegez/powder/commit/e8775c166da40fad16d55df0022a61fd5d5af69b))
7
+ * add applog command
8
+ ([commit](https://github.com/Rodreegez/powder/commit/36d8e04aea2eac618611eaffe78ce8eb55eccc51))
9
+
1
10
  ### 0.1.2 / 2011-04-14 ###
2
11
 
3
12
  * 6 minor changes
data/Readme.md CHANGED
@@ -6,6 +6,9 @@ powder manages [pow](http://pow.cx/)
6
6
 
7
7
  # Usage #
8
8
 
9
+
10
+ ### Linking apps in Pow ###
11
+
9
12
  $ powder
10
13
  => Link the current dir_name to ~/.pow/dir-name
11
14
  # if the dir_name has underscores in, powder changes them to hyphens
@@ -15,20 +18,26 @@ powder manages [pow](http://pow.cx/)
15
18
  # If the current directory doesn't look like an app that can be powed
16
19
  # by pow it will offer to download a basic config.ru for Rails 2
17
20
 
18
- $ powder list
19
- => List all the current apps linked in ~/.pow
20
- # aliased as powder -l
21
-
22
- $ powder restart
23
- => Restart the current app
24
- # aliased as powder -r
25
-
26
21
  $ powder remove
27
22
  => Unlink current_dir
28
23
 
29
24
  $ powder remove bacon
30
25
  => Unlink bacon
31
26
 
27
+ ### Working with Pow ###
28
+
29
+ $ powder applog
30
+ => tail the log of the current app
31
+
32
+ $ powder list
33
+ => List all the current apps linked in ~/.pow
34
+ # aliased as powder -l
35
+
36
+ $ powder log
37
+ => Tails the pow log.
38
+ # Not the application log, but the pow log, available at
39
+ # ~/Library/Logs/Pow/apps/app-name
40
+
32
41
  $ powder open
33
42
  => Opens the pow link in a browser
34
43
  # aliased as powder -o
@@ -37,16 +46,17 @@ powder manages [pow](http://pow.cx/)
37
46
  => Opens http://bacon.dev in a browser
38
47
  # if you have set up alternative top level domains in .powconfig,
39
48
  # then the first listed domain will be opened.
40
-
41
- $ powder log
42
- => Tails the pow log.
43
- # Not the application log, but the pow log, available at
44
- # ~/Library/Logs/Pow/apps/app-name
45
-
49
+
50
+ $ powder restart
51
+ => Restart the current app
52
+ # aliased as powder -r
53
+
46
54
  $ powder version
47
55
  => Returns the current powder version
48
56
  # aliased as powder -v
49
57
 
58
+ ### Install and uninstall Pow ###
59
+
50
60
  $ powder install
51
61
  => Installs pow server
52
62
  # (I know, "curl get.pow.cx | sh" isn't hard, but this is _even_ easier)
@@ -54,19 +64,20 @@ powder manages [pow](http://pow.cx/)
54
64
  $ powder uninstall
55
65
  => Uninstalls pow server
56
66
 
57
- # Contributors #
67
+ ### Enable and Disable Pow ###
58
68
 
59
- Built by [rodreegez](https://github.com/Rodreegez) and [philnash](https://github.com/philnash).
69
+ $ powder up
70
+ => Enable Pow
71
+
72
+ $ powder down
73
+ => Disable Pow
60
74
 
61
- With contributions from:
75
+ # Contributors #
62
76
 
63
- * [franciscoj](https://github.com/franciscoj)
64
- * [cjkihlbom](https://github.com/cjkihlbom)
65
- * [pengwynn](https://github.com/pengwynn).
66
- * [jmccartie](https://github.com/jmccartie)
67
- * [fschwahn](https://github.com/fschwahn)
68
- * [bob-p](https://github.com/bob-p)
77
+ Built by [rodreegez](https://github.com/Rodreegez) and [philnash](https://github.com/philnash).
69
78
 
79
+ Massive thanks to all our great
80
+ [contributors](https://github.com/Rodreegez/powder/contributors)
70
81
 
71
82
  ## Copyright ##
72
83
 
data/bin/powder CHANGED
@@ -16,15 +16,46 @@ module Powder
16
16
  map '-L' => 'link'
17
17
  map '-o' => 'open'
18
18
  map '-v' => 'version'
19
+ map 'update' => 'install'
19
20
 
20
- POWPATH = "#{`echo ~`.chomp}/.pow"
21
+ POW_PATH = "#{ENV['HOME']}/.pow"
22
+ POW_DAEMON_PLIST_PATH="#{ENV['HOME']}/Library/LaunchAgents/cx.pow.powd.plist"
23
+ POW_FIREWALL_PLIST_PATH = "/Library/LaunchDaemons/cx.pow.firewall.plist"
24
+
25
+ desc "up", "Enable pow"
26
+ def up
27
+ if File.exists? POW_FIREWALL_PLIST_PATH
28
+ %x{sudo launchctl load /Library/LaunchDaemons/cx.pow.firewall.plist}
29
+ else
30
+ say "Pow firewall configuration missing."
31
+ end
32
+ end
33
+
34
+ desc "down", "Disable pow"
35
+ def down
36
+ if File.exists? POW_FIREWALL_PLIST_PATH
37
+ if not %x{sudo launchctl list | grep cx.pow.firewall}.empty?
38
+ %x{sudo launchctl unload /Library/LaunchDaemons/cx.pow.firewall.plist}
39
+ end
40
+ if ports = File.open(POW_FIREWALL_PLIST_PATH).read.match(/fwd .*?,([\d]+).*?dst-port ([\d]+)/)
41
+ http_port, dst_port = ports[1..2]
42
+ end
43
+ end
44
+
45
+ http_port ||= 20559
46
+ dst_port ||= 80
47
+
48
+ if rule = %x{sudo ipfw show | grep ",#{http_port} .* dst-port #{dst_port} in"}.split.first
49
+ %x{sudo ipfw delete #{rule} && sudo sysctl -w net.inet.ip.forwarding=0}
50
+ end
51
+ end
21
52
 
22
53
  desc "link", "Link a pow"
23
54
  def link(name=nil)
24
55
  return unless is_powable?
25
56
  current_path = %x{pwd}.chomp
26
57
  name ||= current_dir_pow_name
27
- symlink_path = "#{POWPATH}/#{name}"
58
+ symlink_path = "#{POW_PATH}/#{name}"
28
59
  FileUtils.ln_s(current_path, symlink_path) unless File.exists?(symlink_path)
29
60
  say "Your application is now available at http://#{name}.#{domain}/"
30
61
  end
@@ -38,7 +69,7 @@ module Powder
38
69
 
39
70
  desc "list", "List current pows"
40
71
  def list
41
- Dir[POWPATH + "/*"].map { |a| say File.basename(a) }
72
+ Dir[POW_PATH + "/*"].map { |a| say File.basename(a) }
42
73
  end
43
74
 
44
75
  desc "open", "Open a pow in the browser"
@@ -49,7 +80,7 @@ module Powder
49
80
  desc "remove", "Remove a pow"
50
81
  def remove(name=nil)
51
82
  return unless is_powable?
52
- FileUtils.rm_f POWPATH + '/' + (name || current_dir_pow_name)
83
+ FileUtils.rm_f POW_PATH + '/' + (name || current_dir_pow_name)
53
84
  end
54
85
 
55
86
  desc "install", "Installs pow"
@@ -62,11 +93,16 @@ module Powder
62
93
  system "tail -f ~/Library/Logs/Pow/apps/#{name || current_dir_pow_name}.log"
63
94
  end
64
95
 
96
+ desc "applog", "Tails in current app"
97
+ def applog(env="development")
98
+ system "tail -f log/#{env}.log" if is_powable?
99
+ end
100
+
65
101
  desc "uninstall", "Uninstalls pow"
66
102
  def uninstall
67
103
  %x{curl get.pow.cx/uninstall.sh | sh}
68
104
  end
69
-
105
+
70
106
  desc "version", "Shows the version"
71
107
  def version
72
108
  say "powder #{Powder::VERSION}"
@@ -101,7 +137,7 @@ module Powder
101
137
  return false
102
138
  end
103
139
  end
104
-
140
+
105
141
  def is_rails2_app?
106
142
  File.exists?('config/environment.rb') && !`grep RAILS_GEM_VERSION config/environment.rb`.empty?
107
143
  end
@@ -1,3 +1,3 @@
1
1
  module Powder
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: powder
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 1
9
- - 2
10
- version: 0.1.2
4
+ prerelease:
5
+ version: 0.1.3
11
6
  platform: ruby
12
7
  authors:
13
8
  - Phil Nash
@@ -16,7 +11,7 @@ autorequire:
16
11
  bindir: bin
17
12
  cert_chain: []
18
13
 
19
- date: 2011-04-14 00:00:00 +01:00
14
+ date: 2011-05-20 00:00:00 +01:00
20
15
  default_executable:
21
16
  dependencies:
22
17
  - !ruby/object:Gem::Dependency
@@ -27,11 +22,6 @@ dependencies:
27
22
  requirements:
28
23
  - - ">="
29
24
  - !ruby/object:Gem::Version
30
- hash: 57
31
- segments:
32
- - 0
33
- - 11
34
- - 5
35
25
  version: 0.11.5
36
26
  type: :runtime
37
27
  version_requirements: *id001
@@ -69,23 +59,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
69
59
  requirements:
70
60
  - - ">="
71
61
  - !ruby/object:Gem::Version
72
- hash: 3
73
- segments:
74
- - 0
75
62
  version: "0"
76
63
  required_rubygems_version: !ruby/object:Gem::Requirement
77
64
  none: false
78
65
  requirements:
79
66
  - - ">="
80
67
  - !ruby/object:Gem::Version
81
- hash: 3
82
- segments:
83
- - 0
84
68
  version: "0"
85
69
  requirements: []
86
70
 
87
71
  rubyforge_project: powder
88
- rubygems_version: 1.3.7
72
+ rubygems_version: 1.5.2
89
73
  signing_key:
90
74
  specification_version: 3
91
75
  summary: Makes Pow even easier