powder 0.2.2 → 0.3.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -3
  3. data/bin/powder +44 -17
  4. data/lib/powder/version.rb +1 -1
  5. metadata +6 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 47afc8f55946584943545f9d35a8a591fc397370
4
- data.tar.gz: f6c11ffca56fe7318abba5a9a91f4922e470eec6
3
+ metadata.gz: cfdbbad992ebcd320ce4f12389c1a09241cfdada
4
+ data.tar.gz: 08462e02316255b300c6e907c795efb971f6fa2e
5
5
  SHA512:
6
- metadata.gz: 87a8f6197da9a67f3c1cbaab3e835a84f352c1c4ca816e22426c1613958ac964c4aacb81bf99fcbad2964c9c66f0c12bddc173d1e920e20e769521c5cd00488f
7
- data.tar.gz: 681e4dd3cc812ec016b2cb797b4ff61ad1b5f2bfa2b5355b5a2a87dc3ded1a05c0b18ae46ef7b2016a6725d0d655f94973d41ce63dc6db087747544b7433675d
6
+ metadata.gz: c2d9cb7c30bbeefc83accae12db8805d93e9e6804d11832d85518309ae810300958fb9db3cdd5fa039d7d57578f435c99475030a699060f386a90ff9d0b95a53
7
+ data.tar.gz: 729300ebd70dbfac68187c4474c36605a7ae0ff4519d935d01f52a96ff79dbf7b11ff585cf9f564f6fe3585ddca9d9dad5eb1df9759a2aa0f4c55f89dbcf0c60
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ### 0.3.0.pre / 2014-10-22 ###
2
+
3
+ * 1 minor change
4
+
5
+ * Support for OS X Yosemite. Pow no longer uses the ipfw firewall,
6
+ which was deprecated in OS X 10.9 and removed in 10.10. Port
7
+ redirection is now handled by the pf packet filter.
8
+ Powder reflects the same changes.
9
+
1
10
  ### 0.2.2 / 2014-10-22 ###
2
11
 
3
12
  * 1 minor change
@@ -18,11 +27,9 @@
18
27
  * Updates gist URLs
19
28
  ([commit](https://github.com/rodreegez/powder/commit/96af4fae93bd35a47a6cf0baa99f85aa739d0835))
20
29
 
21
-
22
-
23
30
  ### 0.2.0 / 2013-03-12 ###
24
31
 
25
- * 7 minor change
32
+ * 7 minor changes
26
33
 
27
34
  * fix debug command: rdebug connection errors
28
35
  ([commit](https://github.com/Rodreegez/powder/commit/3ea0a1bc68bd9517e5673cc64d8bf25f41a5e2de))
data/bin/powder CHANGED
@@ -21,6 +21,12 @@ module Powder
21
21
  map '-o' => 'open'
22
22
  map '-v' => 'version'
23
23
 
24
+ MAC_OS_X_VERSION_REGEXP = /^(?<major_version>\d+)\.(?<minor_version>\d+)\.(?<patch_version>\d+)/
25
+ MAC_OS_X_MINOR_VERSION = begin
26
+ version_string = %x{sw_vers -productVersion}
27
+ version_string.match(MAC_OS_X_VERSION_REGEXP)[:minor_version].to_i
28
+ end
29
+
24
30
  POWDER_CONFIG = ".powder"
25
31
  POW_ENV = ".powenv"
26
32
  POW_PATH = "#{ENV['HOME']}/.pow"
@@ -65,15 +71,10 @@ module Powder
65
71
 
66
72
  desc "up", "Enable pow"
67
73
  def up
68
- if File.exists? POW_FIREWALL_PLIST_PATH
69
- %x{sudo launchctl load #{POW_FIREWALL_PLIST_PATH}}
70
- else
71
- say "Pow firewall configuration missing."
72
- end
73
- if File.exists? POW_DAEMON_PLIST_PATH
74
- %x{launchctl load #{POW_DAEMON_PLIST_PATH}}
74
+ if MAC_OS_X_MINOR_VERSION >= 10
75
+ start_on_yosemite
75
76
  else
76
- say "Pow daemon configuration missing."
77
+ start_on_mavericks
77
78
  end
78
79
  end
79
80
 
@@ -86,20 +87,29 @@ module Powder
86
87
  if not %x{sudo launchctl list | grep cx.pow.firewall}.empty?
87
88
  %x{sudo launchctl unload #{POW_FIREWALL_PLIST_PATH}}
88
89
  end
89
- if ports = File.open(POW_FIREWALL_PLIST_PATH).read.match(/fwd .*?,([\d]+).*?dst-port ([\d]+)/)
90
- http_port, dst_port = ports[1..2]
91
- end
92
90
  end
93
91
 
94
92
  if File.exists? POW_DAEMON_PLIST_PATH
95
93
  %x{launchctl unload #{POW_DAEMON_PLIST_PATH}}
96
94
  end
97
95
 
98
- http_port ||= 20559
99
- dst_port ||= 80
96
+ if MAC_OS_X_MINOR_VERSION < 10
97
+ if File.exists? POW_FIREWALL_PLIST_PATH
98
+ if ports = File.open(POW_FIREWALL_PLIST_PATH).read.match(/fwd .*?,([\d]+).*?dst-port ([\d]+)/)
99
+ http_port, dst_port = ports[1..2]
100
+ end
101
+ end
102
+
103
+ http_port ||= 20559
104
+ dst_port ||= 80
105
+
106
+ if rule = %x{sudo ipfw show | grep ",#{http_port} .* dst-port #{dst_port} in"}.split.first
107
+ %x{sudo ipfw delete #{rule} && sudo sysctl -w net.inet.ip.forwarding=0}
108
+ end
109
+ end
100
110
 
101
- if rule = %x{sudo ipfw show | grep ",#{http_port} .* dst-port #{dst_port} in"}.split.first
102
- %x{sudo ipfw delete #{rule} && sudo sysctl -w net.inet.ip.forwarding=0}
111
+ if MAC_OS_X_MINOR_VERSION >= 10
112
+ %{sudo pfctl -a "com.apple/250.PowFirewall" -F all}
103
113
  end
104
114
  end
105
115
 
@@ -165,7 +175,6 @@ module Powder
165
175
  FileUtils.rm_f Dir.glob('tmp/*restart.txt')
166
176
  end
167
177
 
168
-
169
178
  desc "respawn", "Restart the pow process"
170
179
  def respawn
171
180
  %x{launchctl stop cx.pow.powd}
@@ -328,7 +337,7 @@ module Powder
328
337
  desc "status", "Shows current pow status"
329
338
  def status
330
339
  http_port = ":" + configured_pow_http_port.to_s
331
- results = %x{curl --silent -H host:pow localhost#{http_port}/status.json}.gsub(':','=>')
340
+ results = %x{curl --silent -H host:pow 127.0.0.1#{http_port}/status.json}.gsub(':','=>')
332
341
  return say("Error: Cannot get Pow status. Pow may be down. Try 'powder up' first.") if results.empty? || !(results =~ /^\{/)
333
342
  json = eval results
334
343
  json.each {|k,v| say "#{k.ljust(12, ' ')} #{v}"}
@@ -518,6 +527,24 @@ module Powder
518
527
  request = Net::HTTP::Get.new(uri.request_uri)
519
528
  http.request(request).body
520
529
  end
530
+
531
+ def start_on_yosemite
532
+ return say "Pow daemon configuration missing." unless File.exists?(POW_DAEMON_PLIST_PATH)
533
+ %x{launchctl bootstrap gui/"$UID" #{POW_DAEMON_PLIST_PATH}}
534
+
535
+ %x{launchctl enable gui/"$UID"/cx.pow.powd}
536
+ %x{launchctl kickstart -k gui/"$UID"/cx.pow.powd}
537
+ end
538
+
539
+ def start_on_mavericks
540
+ return say "Pow firewall configuration missing." unless File.exists?(POW_FIREWALL_PLIST_PATH)
541
+ %x{launchctl load #{POW_FIREWALL_PLIST_PATH}}
542
+
543
+ return say "Pow daemon configuration missing." unless File.exists?(POW_DAEMON_PLIST_PATH)
544
+ %x{launchctl load #{POW_DAEMON_PLIST_PATH}}
545
+ end
546
+
521
547
  end
522
548
  end
549
+
523
550
  Powder::CLI.start
@@ -1,3 +1,3 @@
1
1
  module Powder
2
- VERSION = "0.2.2"
2
+ VERSION = "0.3.0.pre"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: powder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phil Nash
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-10-21 00:00:00.000000000 Z
12
+ date: 2014-10-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -74,13 +74,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
74
74
  version: '0'
75
75
  required_rubygems_version: !ruby/object:Gem::Requirement
76
76
  requirements:
77
- - - ">="
77
+ - - ">"
78
78
  - !ruby/object:Gem::Version
79
- version: '0'
79
+ version: 1.3.1
80
80
  requirements: []
81
81
  rubyforge_project: powder
82
- rubygems_version: 2.2.2
82
+ rubygems_version: 2.4.1
83
83
  signing_key:
84
84
  specification_version: 4
85
85
  summary: Makes Pow even easier
86
86
  test_files: []
87
+ has_rdoc: