presspass 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/bin/presspass ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'presspass/cli'
@@ -0,0 +1,83 @@
1
+ require 'net/http'
2
+ require 'fileutils'
3
+ require 'optparse'
4
+
5
+ require 'presspass'
6
+
7
+ if ARGV.first == "new"
8
+ app_name = ARGV[1]
9
+
10
+ ARGV.shift(2)
11
+
12
+ options = {:php => "/usr/bin/php-cgi"}
13
+
14
+ OptionParser.new do |opts|
15
+ opts.banner = "Usage: presspass new <app_name> [options]"
16
+
17
+ opts.on("--php [OPTIONAL]", "Path to PHP CGI binary") do |php_path|
18
+ options[:php] = php_path
19
+ end
20
+ end.parse!
21
+
22
+ if Dir.exists?(app_name)
23
+ puts "A directory with name #{app_name} already exists."
24
+ else
25
+
26
+ if !File.exists?("wordpress-#{PressPass::WORDPRESS_VERSION}.tar.gz")
27
+ puts "Downloading wordpress-#{PressPass::WORDPRESS_VERSION}.tar.gz..."
28
+
29
+ Net::HTTP.start('wordpress.org') do |http|
30
+ resp = http.get("/wordpress-#{PressPass::WORDPRESS_VERSION}.tar.gz")
31
+ open("/tmp/wordpress-#{PressPass::WORDPRESS_VERSION}.tar.gz", 'w') do |file|
32
+ file.write(resp.body)
33
+ end
34
+ end
35
+ end
36
+
37
+ puts "wordpress-#{PressPass::WORDPRESS_VERSION}.tar.gz downloaded."
38
+
39
+ filestamp = Time.now.to_i
40
+ download_location = File.join('/tmp', "wordpress-#{PressPass::WORDPRESS_VERSION}.tar.gz")
41
+ tmp_dir = "/tmp/wordpress-latest-#{filestamp}"
42
+
43
+ Dir.mkdir(tmp_dir)
44
+ `cd #{tmp_dir}; tar -xzf #{download_location}`
45
+
46
+ FileUtils.mv("#{tmp_dir}/wordpress", app_name)
47
+ FileUtils.rm_r(tmp_dir)
48
+ FileUtils.rm(download_location)
49
+
50
+ config_ru = <<EOF
51
+ require 'rack'
52
+ require 'rack-legacy'
53
+ require 'rack-rewrite'
54
+
55
+ INDEXES = ['index.html','index.php', 'index.cgi']
56
+
57
+ ENV['SERVER_PROTOCOL'] = "HTTP/1.1"
58
+
59
+ use Rack::Rewrite do
60
+ rewrite %r{(.*/$)}, lambda {|match, rack_env|
61
+ INDEXES.each do |index|
62
+ if File.exists?(File.join(Dir.getwd, rack_env['PATH_INFO'], index))
63
+ return rack_env['PATH_INFO'] + index
64
+ end
65
+ end
66
+ rack_env['PATH_INFO']
67
+ }
68
+ end
69
+
70
+ use Rack::Legacy::Php, Dir.getwd, '#{options[:php]}'
71
+ use Rack::Legacy::Cgi, Dir.getwd
72
+ run Rack::File.new Dir.getwd
73
+ EOF
74
+
75
+ puts "Adding config.ru for usage with Pow."
76
+
77
+ File.open(File.join(app_name, "config.ru"), "w") do |file|
78
+ file.write(config_ru)
79
+ end
80
+
81
+ puts "WordPress installation created at #{app_name}."
82
+ end
83
+ end
@@ -0,0 +1,5 @@
1
+ class PressPass
2
+
3
+ WORDPRESS_VERSION = "3.4.2"
4
+
5
+ end
data/lib/presspass.rb CHANGED
@@ -1,5 +1 @@
1
- class PressPass
2
- def self.hi
3
- puts "Hello world!"
4
- end
5
- end
1
+ require 'presspass/presspass'
metadata CHANGED
@@ -1,62 +1,49 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: presspass
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 1
9
- version: 0.0.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Michiel Sikkes
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2012-09-15 00:00:00 +02:00
18
- default_executable:
12
+ date: 2012-09-15 00:00:00.000000000 Z
19
13
  dependencies: []
20
-
21
14
  description: PressPass makes doing WordPress development awesome
22
15
  email: michiel@firmhouse.com
23
- executables: []
24
-
16
+ executables:
17
+ - presspass
25
18
  extensions: []
26
-
27
19
  extra_rdoc_files: []
28
-
29
- files:
20
+ files:
30
21
  - lib/presspass.rb
31
- has_rdoc: true
32
- homepage: http://rubygems.org/gems/presspass
22
+ - lib/presspass/presspass.rb
23
+ - lib/presspass/cli.rb
24
+ - bin/presspass
25
+ homepage: http://github.com/firmhouse/presspass
33
26
  licenses: []
34
-
35
27
  post_install_message:
36
28
  rdoc_options: []
37
-
38
- require_paths:
29
+ require_paths:
39
30
  - lib
40
- required_ruby_version: !ruby/object:Gem::Requirement
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- segments:
45
- - 0
46
- version: "0"
47
- required_rubygems_version: !ruby/object:Gem::Requirement
48
- requirements:
49
- - - ">="
50
- - !ruby/object:Gem::Version
51
- segments:
52
- - 0
53
- version: "0"
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ none: false
33
+ requirements:
34
+ - - ! '>='
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ required_rubygems_version: !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ! '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
54
43
  requirements: []
55
-
56
44
  rubyforge_project:
57
- rubygems_version: 1.3.6
45
+ rubygems_version: 1.8.24
58
46
  signing_key:
59
47
  specification_version: 3
60
48
  summary: PressPass
61
49
  test_files: []
62
-