powder 0.1.1 → 0.1.2

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/.gitignore CHANGED
@@ -3,3 +3,4 @@
3
3
  Gemfile.lock
4
4
  pkg/*
5
5
  tmp
6
+ .rvmrc
@@ -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
- => link the current dir_name to ~/.pow/dir-name
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
- => link the current dir to ~/.pow/bacon
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
- => list all the current apps linked in ~/.pow
19
+ => List all the current apps linked in ~/.pow
20
20
  # aliased as powder -l
21
21
 
22
22
  $ powder restart
23
- => restart the current app
23
+ => Restart the current app
24
24
  # aliased as powder -r
25
25
 
26
26
  $ powder remove
27
- => unlink current_dir
27
+ => Unlink current_dir
28
28
 
29
29
  $ powder remove bacon
30
- => unlink bacon
30
+ => Unlink bacon
31
31
 
32
32
  $ powder open
33
- => opens the pow link in a browser
33
+ => Opens the pow link in a browser
34
34
  # aliased as powder -o
35
35
 
36
36
  $ powder open bacon
37
- => opens http://bacon.dev in a browser
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
- => installs pow server
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
- => uninstalls pow server
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 [franciscoj](https://github.com/franciscoj), [cjkihlbom](https://github.com/cjkihlbom) and [pengwynn](https://github.com/pengwynn).
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 "net/https"
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
- desc "restart", "Restart current pow"
30
- def restart
31
- return unless is_powable?
32
- FileUtils.mkdir_p('tmp')
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
- desc "list", "List current pows"
37
- def list
38
- Dir[POWPATH + "/*"].map { |a| say File.basename(a) }
39
- end
14
+ map '-r' => 'restart'
15
+ map '-l' => 'list'
16
+ map '-L' => 'link'
17
+ map '-o' => 'open'
18
+ map '-v' => 'version'
40
19
 
41
- desc "open", "Open a pow in the browser"
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
- desc "remove", "Remove a pow"
47
- def remove(name=nil)
48
- return unless is_powable?
49
- FileUtils.rm POWPATH + '/' + (name || current_dir_pow_name)
50
- end
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
- desc "install", "Installs pow"
53
- def install
54
- %x{curl get.pow.cx | sh}
55
- end
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
- desc "uninstall", "Uninstalls pow"
58
- def uninstall
59
- %x{curl get.pow.cx/uninstall.sh | sh}
60
- end
39
+ desc "list", "List current pows"
40
+ def list
41
+ Dir[POWPATH + "/*"].map { |a| say File.basename(a) }
42
+ end
61
43
 
62
- private
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
- def current_dir_pow_name
65
- File.basename(%x{pwd}.chomp).tr('_', '-')
66
- end
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
- def is_powable?
69
- if File.exists?('config.ru') || File.exists?('public/index.html')
70
- true
71
- else
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
- return true
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 "Did not create config.ru"
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
- end
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
- def domain
91
- if File.exists? '~/.powconfig'
92
- returned_domain = %x{source ~/.powconfig; echo $POW_DOMAINS}.gsub("\n", "").split(",").first
93
- returned_domain = %x{source ~/.powconfig; echo $POW_DOMAIN}.gsub("\n", "") if returned_domain.nil? || returned_domain.empty?
94
- returned_domain = 'dev' if returned_domain.nil? || returned_domain.empty?
95
- returned_domain
96
- else
97
- 'dev'
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
@@ -1,3 +1,3 @@
1
1
  module Powder
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -19,5 +19,5 @@ Gem::Specification.new do |s|
19
19
  s.executables = ["powder"]
20
20
  s.require_paths = ["lib"]
21
21
 
22
- s.add_dependency 'thor', '>=0.9.2'
22
+ s.add_dependency 'thor', '>=0.11.5'
23
23
  end
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: powder
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.1.1
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-11 00:00:00 +01:00
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
- version: 0.9.2
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.5.2
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