powder 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/CHANGELOG.md +37 -0
- data/Readme.md +27 -11
- data/bin/powder +99 -79
- data/lib/powder/version.rb +1 -1
- data/powder.gemspec +1 -1
- metadata +22 -6
- data/CHANGELOG +0 -19
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
### 0.1.2 / 2011-04-14 ###
|
2
|
+
|
3
|
+
* 6 minor changes
|
4
|
+
|
5
|
+
* add log command
|
6
|
+
([commit](https://github.com/Rodreegez/powder/commit/140ef1fef456e3cbe266a2df61b03f3e9c403aeb))
|
7
|
+
* fix error when calling remove on a pow that does not exist
|
8
|
+
([commit](https://github.com/Rodreegez/powder/commit/948f7251153afaab7c881b312b094d9843919dcb))
|
9
|
+
* properly recognise rails 2 apps and display note accordingly
|
10
|
+
([commit](https://github.com/Rodreegez/powder/commit/0445eb652ec824a7f84d12567539a7c2515341a2))
|
11
|
+
* bump dependency on Thor
|
12
|
+
([commit](https://github.com/Rodreegez/powder/commit/493a8f84c27b94fcd24dc84168a47a7c399a9ba1))
|
13
|
+
* improve how we determin home dir
|
14
|
+
([commit](https://github.com/Rodreegez/powder/commit/b2e70ca790420a06c21a7f4fc466c167c65fb173))
|
15
|
+
* adds version command
|
16
|
+
([commit](https://github.com/Rodreegez/powder/commit/3bb995e2ce5ee2f62735b681b2c15418438f2df4))
|
17
|
+
|
18
|
+
### 0.1.1 / 2011-04-11 ###
|
19
|
+
|
20
|
+
* 1 minor change
|
21
|
+
|
22
|
+
* We won't try reading ~/.powconfig if it doesn't exist
|
23
|
+
|
24
|
+
### 0.1.0 / 2011-04-11 ###
|
25
|
+
|
26
|
+
* 1 Major change
|
27
|
+
|
28
|
+
* The command has changed from pow to powder to allow pow to use the command
|
29
|
+
([issue](https://github.com/Rodreegez/powder/issues/5))
|
30
|
+
|
31
|
+
* 1 minor change
|
32
|
+
|
33
|
+
* open and link now honour domains specified in .powconfig
|
34
|
+
|
35
|
+
### 0.0.4 / 2011-04-08 ###
|
36
|
+
|
37
|
+
* Early release with link, list, restart, remove, open, install and uninstall commands
|
data/Readme.md
CHANGED
@@ -7,49 +7,65 @@ powder manages [pow](http://pow.cx/)
|
|
7
7
|
# Usage #
|
8
8
|
|
9
9
|
$ powder
|
10
|
-
=>
|
10
|
+
=> Link the current dir_name to ~/.pow/dir-name
|
11
11
|
# if the dir_name has underscores in, powder changes them to hyphens
|
12
12
|
|
13
13
|
$ powder link bacon
|
14
|
-
=>
|
14
|
+
=> Link the current dir to ~/.pow/bacon
|
15
15
|
# If the current directory doesn't look like an app that can be powed
|
16
16
|
# by pow it will offer to download a basic config.ru for Rails 2
|
17
17
|
|
18
18
|
$ powder list
|
19
|
-
=>
|
19
|
+
=> List all the current apps linked in ~/.pow
|
20
20
|
# aliased as powder -l
|
21
21
|
|
22
22
|
$ powder restart
|
23
|
-
=>
|
23
|
+
=> Restart the current app
|
24
24
|
# aliased as powder -r
|
25
25
|
|
26
26
|
$ powder remove
|
27
|
-
=>
|
27
|
+
=> Unlink current_dir
|
28
28
|
|
29
29
|
$ powder remove bacon
|
30
|
-
=>
|
30
|
+
=> Unlink bacon
|
31
31
|
|
32
32
|
$ powder open
|
33
|
-
=>
|
33
|
+
=> Opens the pow link in a browser
|
34
34
|
# aliased as powder -o
|
35
35
|
|
36
36
|
$ powder open bacon
|
37
|
-
=>
|
37
|
+
=> Opens http://bacon.dev in a browser
|
38
38
|
# if you have set up alternative top level domains in .powconfig,
|
39
39
|
# 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
|
+
|
46
|
+
$ powder version
|
47
|
+
=> Returns the current powder version
|
48
|
+
# aliased as powder -v
|
40
49
|
|
41
50
|
$ powder install
|
42
|
-
=>
|
51
|
+
=> Installs pow server
|
43
52
|
# (I know, "curl get.pow.cx | sh" isn't hard, but this is _even_ easier)
|
44
53
|
|
45
54
|
$ powder uninstall
|
46
|
-
=>
|
55
|
+
=> Uninstalls pow server
|
47
56
|
|
48
57
|
# Contributors #
|
49
58
|
|
50
59
|
Built by [rodreegez](https://github.com/Rodreegez) and [philnash](https://github.com/philnash).
|
51
60
|
|
52
|
-
With contributions from
|
61
|
+
With contributions from:
|
62
|
+
|
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)
|
53
69
|
|
54
70
|
|
55
71
|
## Copyright ##
|
data/bin/powder
CHANGED
@@ -3,99 +3,119 @@
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'thor'
|
5
5
|
require 'fileutils'
|
6
|
-
require
|
7
|
-
|
8
|
-
class Powder < Thor
|
9
|
-
include Thor::Actions
|
10
|
-
default_task :link
|
11
|
-
|
12
|
-
map '-r' => 'restart'
|
13
|
-
map '-l' => 'list'
|
14
|
-
map '-L' => 'link'
|
15
|
-
map '-o' => 'open'
|
16
|
-
|
17
|
-
POWPATH = "/Users/#{`whoami`.chomp}/.pow"
|
18
|
-
|
19
|
-
desc "link", "Link a pow"
|
20
|
-
def link(name=nil)
|
21
|
-
return unless is_powable?
|
22
|
-
current_path = %x{pwd}.chomp
|
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}.#{domain}/"
|
27
|
-
end
|
6
|
+
require 'net/https'
|
7
|
+
require 'powder/version'
|
28
8
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
%x{touch tmp/restart.txt}
|
34
|
-
end
|
9
|
+
module Powder
|
10
|
+
class CLI < Thor
|
11
|
+
include Thor::Actions
|
12
|
+
default_task :link
|
35
13
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
14
|
+
map '-r' => 'restart'
|
15
|
+
map '-l' => 'list'
|
16
|
+
map '-L' => 'link'
|
17
|
+
map '-o' => 'open'
|
18
|
+
map '-v' => 'version'
|
40
19
|
|
41
|
-
|
42
|
-
def open(name=nil)
|
43
|
-
%x{open http://#{name || current_dir_pow_name}.#{domain}}
|
44
|
-
end
|
20
|
+
POWPATH = "#{`echo ~`.chomp}/.pow"
|
45
21
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
22
|
+
desc "link", "Link a pow"
|
23
|
+
def link(name=nil)
|
24
|
+
return unless is_powable?
|
25
|
+
current_path = %x{pwd}.chomp
|
26
|
+
name ||= current_dir_pow_name
|
27
|
+
symlink_path = "#{POWPATH}/#{name}"
|
28
|
+
FileUtils.ln_s(current_path, symlink_path) unless File.exists?(symlink_path)
|
29
|
+
say "Your application is now available at http://#{name}.#{domain}/"
|
30
|
+
end
|
51
31
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
32
|
+
desc "restart", "Restart current pow"
|
33
|
+
def restart
|
34
|
+
return unless is_powable?
|
35
|
+
FileUtils.mkdir_p('tmp')
|
36
|
+
%x{touch tmp/restart.txt}
|
37
|
+
end
|
56
38
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
39
|
+
desc "list", "List current pows"
|
40
|
+
def list
|
41
|
+
Dir[POWPATH + "/*"].map { |a| say File.basename(a) }
|
42
|
+
end
|
61
43
|
|
62
|
-
|
44
|
+
desc "open", "Open a pow in the browser"
|
45
|
+
def open(name=nil)
|
46
|
+
%x{open http://#{name || current_dir_pow_name}.#{domain}}
|
47
|
+
end
|
63
48
|
|
64
|
-
|
65
|
-
|
66
|
-
|
49
|
+
desc "remove", "Remove a pow"
|
50
|
+
def remove(name=nil)
|
51
|
+
return unless is_powable?
|
52
|
+
FileUtils.rm_f POWPATH + '/' + (name || current_dir_pow_name)
|
53
|
+
end
|
67
54
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
55
|
+
desc "install", "Installs pow"
|
56
|
+
def install
|
57
|
+
%x{curl get.pow.cx | sh}
|
58
|
+
end
|
59
|
+
|
60
|
+
desc "log", "Tails the Pow log"
|
61
|
+
def log(name=nil)
|
62
|
+
system "tail -f ~/Library/Logs/Pow/apps/#{name || current_dir_pow_name}.log"
|
63
|
+
end
|
64
|
+
|
65
|
+
desc "uninstall", "Uninstalls pow"
|
66
|
+
def uninstall
|
67
|
+
%x{curl get.pow.cx/uninstall.sh | sh}
|
68
|
+
end
|
69
|
+
|
70
|
+
desc "version", "Shows the version"
|
71
|
+
def version
|
72
|
+
say "powder #{Powder::VERSION}"
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
def current_dir_pow_name
|
78
|
+
File.basename(%x{pwd}.chomp).tr('_', '-')
|
79
|
+
end
|
80
|
+
|
81
|
+
def is_powable?
|
82
|
+
if File.exists?('config.ru') || File.exists?('public/index.html')
|
83
|
+
true
|
84
|
+
elsif is_rails2_app?
|
85
|
+
say "This appears to be a Rails 2 applicaton. You need a config.ru file."
|
86
|
+
if yes? "Do you want to autogenerate a basic config.ru for Rails 2?"
|
87
|
+
uri = URI.parse("https://gist.github.com/909308.txt")
|
88
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
89
|
+
http.use_ssl = true
|
90
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
91
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
92
|
+
create_file "config.ru", http.request(request).body
|
93
|
+
return true
|
94
|
+
else
|
95
|
+
say "Did not create config.ru"
|
96
|
+
return false
|
97
|
+
end
|
83
98
|
else
|
84
|
-
say "
|
99
|
+
say "This does not appear to be a rack app as there is no config.ru."
|
100
|
+
say "Pow can also host static apps if there is an index.html in public/"
|
85
101
|
return false
|
86
102
|
end
|
87
103
|
end
|
88
|
-
|
104
|
+
|
105
|
+
def is_rails2_app?
|
106
|
+
File.exists?('config/environment.rb') && !`grep RAILS_GEM_VERSION config/environment.rb`.empty?
|
107
|
+
end
|
89
108
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
109
|
+
def domain
|
110
|
+
if File.exists? '~/.powconfig'
|
111
|
+
returned_domain = %x{source ~/.powconfig; echo $POW_DOMAINS}.gsub("\n", "").split(",").first
|
112
|
+
returned_domain = %x{source ~/.powconfig; echo $POW_DOMAIN}.gsub("\n", "") if returned_domain.nil? || returned_domain.empty?
|
113
|
+
returned_domain = 'dev' if returned_domain.nil? || returned_domain.empty?
|
114
|
+
returned_domain
|
115
|
+
else
|
116
|
+
'dev'
|
117
|
+
end
|
98
118
|
end
|
99
119
|
end
|
100
120
|
end
|
101
|
-
Powder.start
|
121
|
+
Powder::CLI.start
|
data/lib/powder/version.rb
CHANGED
data/powder.gemspec
CHANGED
metadata
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: powder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
4
|
+
hash: 31
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- Phil Nash
|
@@ -11,7 +16,7 @@ autorequire:
|
|
11
16
|
bindir: bin
|
12
17
|
cert_chain: []
|
13
18
|
|
14
|
-
date: 2011-04-
|
19
|
+
date: 2011-04-14 00:00:00 +01:00
|
15
20
|
default_executable:
|
16
21
|
dependencies:
|
17
22
|
- !ruby/object:Gem::Dependency
|
@@ -22,7 +27,12 @@ dependencies:
|
|
22
27
|
requirements:
|
23
28
|
- - ">="
|
24
29
|
- !ruby/object:Gem::Version
|
25
|
-
|
30
|
+
hash: 57
|
31
|
+
segments:
|
32
|
+
- 0
|
33
|
+
- 11
|
34
|
+
- 5
|
35
|
+
version: 0.11.5
|
26
36
|
type: :runtime
|
27
37
|
version_requirements: *id001
|
28
38
|
description: Makes Pow even easier. I mean really, really, ridiculously easy.
|
@@ -36,7 +46,7 @@ extra_rdoc_files: []
|
|
36
46
|
|
37
47
|
files:
|
38
48
|
- .gitignore
|
39
|
-
- CHANGELOG
|
49
|
+
- CHANGELOG.md
|
40
50
|
- Gemfile
|
41
51
|
- LICENSE
|
42
52
|
- Rakefile
|
@@ -59,17 +69,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
59
69
|
requirements:
|
60
70
|
- - ">="
|
61
71
|
- !ruby/object:Gem::Version
|
72
|
+
hash: 3
|
73
|
+
segments:
|
74
|
+
- 0
|
62
75
|
version: "0"
|
63
76
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
77
|
none: false
|
65
78
|
requirements:
|
66
79
|
- - ">="
|
67
80
|
- !ruby/object:Gem::Version
|
81
|
+
hash: 3
|
82
|
+
segments:
|
83
|
+
- 0
|
68
84
|
version: "0"
|
69
85
|
requirements: []
|
70
86
|
|
71
87
|
rubyforge_project: powder
|
72
|
-
rubygems_version: 1.
|
88
|
+
rubygems_version: 1.3.7
|
73
89
|
signing_key:
|
74
90
|
specification_version: 3
|
75
91
|
summary: Makes Pow even easier
|
data/CHANGELOG
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
=== 0.1.1 / 2011-04-11
|
2
|
-
|
3
|
-
* 1 minor change
|
4
|
-
* We won't try reading ~/.powconfig if it doesn't exist
|
5
|
-
|
6
|
-
=== 0.1.0 / 2011-04-11
|
7
|
-
|
8
|
-
* 1 Major change
|
9
|
-
|
10
|
-
* The command has changed from pow to powder to allow pow to use the command
|
11
|
-
(https://github.com/Rodreegez/powder/issues/5)
|
12
|
-
|
13
|
-
* 1 minor change
|
14
|
-
|
15
|
-
* open and link now honour domains specified in .powconfig
|
16
|
-
|
17
|
-
=== 0.0.4 / 2011-04-08
|
18
|
-
|
19
|
-
* Early release with link, list, restart, remove, open, install and uninstall commands
|