powder 0.0.3 → 0.0.4

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.
Files changed (6) hide show
  1. data/LICENSE +20 -0
  2. data/Readme.md +16 -1
  3. data/bin/pow +36 -15
  4. data/lib/powder/version.rb +1 -1
  5. data/powder.gemspec +1 -1
  6. metadata +5 -8
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Adam Rogers and Phil Nash
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Readme.md CHANGED
@@ -8,9 +8,12 @@ Powder manages [Pow](http://pow.cx/)
8
8
 
9
9
  $ pow
10
10
  => link the current dir_name to ~/.pow/dir_name
11
+ # if the dir_name has underscores in, powder changes them to hyphens
11
12
 
12
13
  $ pow link bacon
13
14
  => link the current dir to ~/.pow/bacon
15
+ # If the current directory doesn't look like an app that can be powered
16
+ # by pow it will offer to download a basic config.ru for Rails 2
14
17
 
15
18
  $ pow list
16
19
  => list all the current apps linked in ~/.pow
@@ -25,9 +28,21 @@ Powder manages [Pow](http://pow.cx/)
25
28
 
26
29
  $ pow remove bacon
27
30
  => unlink bacon
31
+
32
+ $ pow open
33
+ => opens the pow link in a browser
34
+ # aliased as pow -o
35
+
36
+ $ pow open bacon
37
+ => opens http://bacon.dev in a browser
28
38
 
29
39
  $ pow install
30
40
  => installs pow server (I know, "curl get.pow.cx | sh" isn't hard, but this is _even_ easier)
31
41
 
32
42
  $ pow uninstall
33
- => uninstalls pow server
43
+ => uninstalls pow server
44
+
45
+
46
+ ## Copyright ##
47
+
48
+ Copyright (c) 2011 Adam Rogers and Phil Nash. See LICENSE for details.
data/bin/pow CHANGED
@@ -3,37 +3,47 @@
3
3
  require 'rubygems'
4
4
  require 'thor'
5
5
  require 'fileutils'
6
+ require "net/https"
6
7
 
7
8
  class Pow < Thor
9
+ include Thor::Actions
8
10
  default_task :link
9
11
 
10
12
  map '-r' => 'restart'
11
13
  map '-l' => 'list'
12
14
  map '-L' => 'link'
15
+ map '-o' => 'open'
13
16
 
14
17
  POWPATH = "/Users/#{`whoami`.chomp}/.pow"
15
18
 
16
- desc "link", "link a pow"
19
+ desc "link", "Link a pow"
17
20
  def link(name=nil)
18
21
  return unless is_powable?
19
22
  current_path = %x{pwd}.chomp
20
- symink_path = "#{POWPATH}/#{name || File.basename(current_path)}"
21
- FileUtils.ln_s(current_path, symink_path) unless File.exists?(symink_path)
23
+ name ||= current_dir_pow_name
24
+ symlink_path = "#{POWPATH}/#{name}"
25
+ FileUtils.ln_s(current_path, symlink_path) unless File.exists?(symlink_path)
26
+ say "Your application is now available at http://#{name}.dev/"
22
27
  end
23
-
24
- desc "restart", "restart current pow"
28
+
29
+ desc "restart", "Restart current pow"
25
30
  def restart
26
31
  return unless is_powable?
27
32
  FileUtils.mkdir_p('tmp')
28
33
  %x{touch tmp/restart.txt}
29
34
  end
30
35
 
31
- desc "list", "list current pows"
36
+ desc "list", "List current pows"
32
37
  def list
33
- Dir[POWPATH + "/*"].map { |a| $stdout.puts File.basename(a) }
38
+ Dir[POWPATH + "/*"].map { |a| say File.basename(a) }
39
+ end
40
+
41
+ desc "open", "Open a pow in the browser"
42
+ def open(name=nil)
43
+ %x{open http://#{name || current_dir_pow_name}.dev}
34
44
  end
35
45
 
36
- desc "remove", "remove a pow"
46
+ desc "remove", "Remove a pow"
37
47
  def remove(name=nil)
38
48
  return unless is_powable?
39
49
  FileUtils.rm POWPATH + '/' + (name || File.basename(%x{pwd}.chomp))
@@ -43,22 +53,33 @@ class Pow < Thor
43
53
  def install
44
54
  %x{curl get.pow.cx | sh}
45
55
  end
46
-
56
+
47
57
  desc "uninstall", "Uninstalls pow"
48
58
  def uninstall
49
- %x{curl get.pow.cx/uninstall.sh | sh}
59
+ %x{curl get.pow.cx/uninstall.sh | sh}
50
60
  end
51
61
 
52
- private
62
+ private
63
+
64
+ def current_dir_pow_name
65
+ File.basename(%x{pwd}.chomp).tr('_', '-')
66
+ end
53
67
 
54
68
  def is_powable?
55
69
  if File.exists?('config.ru') || File.exists?('public/index.html')
56
70
  true
57
71
  else
58
- $stdout.puts "This does not appear to be a rack app as there is no config.ru."
59
- $stdout.puts "If you are in a Rails 2 application, try https://gist.github.com/909308"
60
- $stdout.puts "Pow can also host static apps if there is an index.html in public/"
61
- false
72
+ say "This does not appear to be a rack app as there is no config.ru."
73
+ say "Pow can also host static apps if there is an index.html in public/"
74
+ say "If you are in a Rails 2 application, you need a config.ru file"
75
+ if yes? "Do you want to autogenerate a basic config.ru for Rails 2?"
76
+ uri = URI.parse("https://gist.github.com/909308.txt")
77
+ http = Net::HTTP.new(uri.host, uri.port)
78
+ http.use_ssl = true
79
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
80
+ request = Net::HTTP::Get.new(uri.request_uri)
81
+ create_file "config.ru", http.request(request).body
82
+ end
62
83
  end
63
84
  end
64
85
  end
@@ -1,3 +1,3 @@
1
1
  module Powder
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/powder.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.email = ["no"]
11
11
  s.homepage = "http://github.com/Rodreegez/powder"
12
12
  s.summary = %q{Makes Pow even easier}
13
- s.description = %q{Makes Pow even easier. I mean seriously, really really ridiculously easy.}
13
+ s.description = %q{Makes Pow even easier. I mean really, really, ridiculously easy.}
14
14
 
15
15
  s.rubyforge_project = "powder"
16
16
 
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: powder
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 0
9
- - 3
10
- version: 0.0.3
8
+ - 4
9
+ version: 0.0.4
11
10
  platform: ruby
12
11
  authors:
13
12
  - Phil Nash
@@ -16,7 +15,7 @@ autorequire:
16
15
  bindir: bin
17
16
  cert_chain: []
18
17
 
19
- date: 2011-04-08 00:00:00 +01:00
18
+ date: 2011-04-10 00:00:00 +01:00
20
19
  default_executable:
21
20
  dependencies:
22
21
  - !ruby/object:Gem::Dependency
@@ -27,7 +26,6 @@ dependencies:
27
26
  requirements:
28
27
  - - ">="
29
28
  - !ruby/object:Gem::Version
30
- hash: 63
31
29
  segments:
32
30
  - 0
33
31
  - 9
@@ -35,7 +33,7 @@ dependencies:
35
33
  version: 0.9.2
36
34
  type: :runtime
37
35
  version_requirements: *id001
38
- description: Makes Pow even easier. I mean seriously, really really ridiculously easy.
36
+ description: Makes Pow even easier. I mean really, really, ridiculously easy.
39
37
  email:
40
38
  - "no"
41
39
  executables:
@@ -47,6 +45,7 @@ extra_rdoc_files: []
47
45
  files:
48
46
  - .gitignore
49
47
  - Gemfile
48
+ - LICENSE
50
49
  - Rakefile
51
50
  - Readme.md
52
51
  - bin/pow
@@ -67,7 +66,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
67
66
  requirements:
68
67
  - - ">="
69
68
  - !ruby/object:Gem::Version
70
- hash: 3
71
69
  segments:
72
70
  - 0
73
71
  version: "0"
@@ -76,7 +74,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
74
  requirements:
77
75
  - - ">="
78
76
  - !ruby/object:Gem::Version
79
- hash: 3
80
77
  segments:
81
78
  - 0
82
79
  version: "0"