presspass 1.0.0 → 1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e3ad883ad634232b0298b8c7ab428e778b081838
4
- data.tar.gz: d1cad8acf5daaa04bbcf248cea0d607d870c903e
3
+ metadata.gz: 8d4149b7a214d6de9162f38b0c66b77c314cc21f
4
+ data.tar.gz: cc657c5b9284c25ad331e3507775371a24387e32
5
5
  SHA512:
6
- metadata.gz: ad1ff6ef9706903c604b565354fb3998ed2e8e6ceeada9393e040b20a8d65de987a80d208f74eabf7b966a4c1412febe1d9e5794bb5e03e9ffcd8f6cb5e69b25
7
- data.tar.gz: 920b6ab521d0d0f9c0ad3abf0079702f12146ac3ac109364d4766aed222f35fbab8714b02b0a6502426a0c494b3c588bee9295358edc26194ede57ffccd152f8
6
+ metadata.gz: 9ea980b9f1d4fb1fd2196d105d6e78f9c04fbdca7a64030bc8cc60075cd254266a874f7dab50e0dfef1a44bb8032cae7e863319f75c4f669781da416d538336d
7
+ data.tar.gz: c5995909e88f48732010ba4764740d6aa6fc960c403b88641472bfb28149ffcf72d7c18131bbb5d57414a3c046e36e247d206df9b22f1509b9ff40dbeed5c051
@@ -1,4 +1,5 @@
1
1
  require 'erb'
2
+ require 'open-uri'
2
3
 
3
4
  module PressPass
4
5
  module Cli
@@ -6,15 +7,15 @@ module PressPass
6
7
  class NewProjectGenerator
7
8
 
8
9
  def initialize(command = "new")
9
- @options = {:path_to_php => nil}
10
+ @options = {:php_port => 8000}
10
11
 
11
12
  @app_name = ARGV.first
12
13
 
13
14
  OptionParser.new do |opts|
14
15
  opts.banner = "Usage: presspass #{command} <app_name> [options]"
15
16
 
16
- opts.on("--php PATH", "Path to PHP binary") do |php_path|
17
- @options[:path_to_php] = php_path
17
+ opts.on("--port NUMBER", "Port to run PHP on") do |php_port|
18
+ @options[:php_port] = php_port
18
19
  end
19
20
 
20
21
  end.parse!(ARGV)
@@ -28,30 +29,19 @@ module PressPass
28
29
 
29
30
  extract_wordpress_into_project_directory
30
31
 
31
- init
32
+ install_foreman(php_port: @options[:php_port])
32
33
 
33
34
  puts "WordPress installation created at #{@app_name}."
34
35
  end
35
36
 
36
- def init
37
- add_rack_config(:path_to_php => @options[:path_to_php])
38
-
39
- set_default_config
40
- end
41
-
42
37
  private
43
38
 
44
- def set_default_config
39
+ def install_foreman(php_port: 8000)
40
+ foreman_config = "web: php -S 0.0.0.0:#{php_port}\n"
45
41
 
46
- config_file = File.join(File.expand_path('~'), '.presspass.yml')
47
-
48
- config = {}
49
- config["installation_dir"] = File.expand_path(@app_name)
50
-
51
- File.open( config_file, "w+") do |file|
52
- file.write(YAML.dump(config))
42
+ File.open(File.join(@app_name, "Procfile"), "w+") do |f|
43
+ f.write(foreman_config)
53
44
  end
54
-
55
45
  end
56
46
 
57
47
  def create_project_directory
@@ -65,11 +55,9 @@ module PressPass
65
55
  if !File.exists?("/tmp/wordpress-#{PressPass::WORDPRESS_VERSION}.tar.gz")
66
56
  puts "Downloading wordpress-#{PressPass::WORDPRESS_VERSION}.tar.gz..."
67
57
 
68
- Net::HTTP.start('wordpress.org') do |http|
69
- resp = http.get("/wordpress-#{PressPass::WORDPRESS_VERSION}.tar.gz")
70
- open("/tmp/wordpress-#{PressPass::WORDPRESS_VERSION}.tar.gz", 'w') do |file|
71
- file.write(resp.body)
72
- end
58
+ resp = open("https://wordpress.org/wordpress-#{PressPass::WORDPRESS_VERSION}.tar.gz")
59
+ open("/tmp/wordpress-#{PressPass::WORDPRESS_VERSION}.tar.gz", 'w') do |file|
60
+ file.write(resp.read)
73
61
  end
74
62
  end
75
63
 
@@ -88,26 +76,6 @@ module PressPass
88
76
  FileUtils.rm_r(tmp_dir)
89
77
  end
90
78
 
91
- def add_rack_config(opts = {})
92
- options = { :path_to_php => nil }
93
- options.merge!(opts)
94
-
95
- config_ru = <<EOF
96
- require 'rack'
97
- require 'rack-legacy'
98
-
99
- use Rack::Legacy::Index
100
- use Rack::Legacy::Php<% if options[:path_to_php] %>, '<%= options[:path_to_php] %>' <% end %>
101
- run Rack::File.new Dir.getwd
102
- EOF
103
- config_ru_template = ERB.new(config_ru)
104
-
105
- puts "Adding config.ru for usage with Pow."
106
-
107
- File.open(File.join(@app_name, "config.ru"), "w") do |file|
108
- file.write(config_ru_template.result(binding))
109
- end
110
- end
111
79
  end
112
80
  end
113
- end
81
+ end
data/lib/presspass/cli.rb CHANGED
@@ -4,7 +4,6 @@ require 'optparse'
4
4
 
5
5
  require 'presspass'
6
6
  require 'presspass/cli/new_project_generator'
7
- require 'presspass/cli/linker'
8
7
 
9
8
  if ARGV.first == "new"
10
9
  ARGV.shift
@@ -28,4 +27,4 @@ elsif ARGV.first == "link"
28
27
  ARGV.shift
29
28
 
30
29
  PressPass::Cli::Linker.run(ARGV)
31
- end
30
+ end
@@ -1,6 +1,6 @@
1
1
  module PressPass
2
2
 
3
- WORDPRESS_VERSION = "3.8.1"
4
- VERSION = "1.0.0"
3
+ WORDPRESS_VERSION = "4.1.1"
4
+ VERSION = "1.1"
5
5
 
6
- end
6
+ end
metadata CHANGED
@@ -1,43 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: presspass
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: '1.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michiel Sikkes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-08 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rack
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: rack-legacy
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
11
+ date: 2015-04-02 00:00:00.000000000 Z
12
+ dependencies: []
41
13
  description: |2
42
14
  PressPass is a command-line tool that helps you do WordPress development.
43
15
 
@@ -56,7 +28,6 @@ files:
56
28
  - bin/presspass
57
29
  - lib/presspass.rb
58
30
  - lib/presspass/cli.rb
59
- - lib/presspass/cli/linker.rb
60
31
  - lib/presspass/cli/new_project_generator.rb
61
32
  - lib/presspass/presspass.rb
62
33
  homepage: http://github.com/firmhouse/presspass
@@ -67,7 +38,13 @@ post_install_message: |2+
67
38
  Thank you for installing PressPass! Now get started with setting up a
68
39
  WordPress installation in your current directory:
69
40
 
70
- presspass new my_blog
41
+ $ presspass new my_blog
42
+
43
+ This command will download WordPress and extract it into the *my_blog
44
+ directory. Then, start a local development server on localhost:8000 with:
45
+
46
+ $ foreman start
47
+ $ open http://localhost:8000
71
48
 
72
49
  If you need help, please create an issue at
73
50
  https://github.com/firmhouse/presspass/issues
@@ -87,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
64
  version: '0'
88
65
  requirements: []
89
66
  rubyforge_project:
90
- rubygems_version: 2.2.0
67
+ rubygems_version: 2.2.2
91
68
  signing_key:
92
69
  specification_version: 4
93
70
  summary: PressPass makes doing WordPress development awesome
@@ -1,62 +0,0 @@
1
- require 'yaml'
2
-
3
- module PressPass
4
-
5
- module Cli
6
-
7
- class Linker
8
-
9
- def self.run(arguments = nil)
10
-
11
- config_file = File.join(Dir.home, '.presspass.yml')
12
-
13
- config = {}
14
-
15
- File.open( config_file, "r+") do |file|
16
- config = YAML.load(file)
17
- end
18
-
19
- if config["installation_dir"].nil?
20
- puts <<-EOF
21
-
22
- You don't have a local PressPass-enabled WordPress installation yet.
23
-
24
- Install one using:
25
-
26
- presspass new <directory>
27
-
28
- EOF
29
- return
30
- end
31
-
32
- if arguments.empty?
33
- if directory_is_theme?(Dir.pwd)
34
- link(Dir.pwd, File.expand_path(config["installation_dir"]))
35
- end
36
- end
37
-
38
- end
39
-
40
- def self.directory_is_theme?(path)
41
- File.exists?(File.join(path, 'style.css'))
42
- end
43
-
44
- def self.link(theme_path, installation_path)
45
-
46
- link_path = File.join(installation_path, 'wp-content', 'themes', File.basename(theme_path))
47
-
48
- if File.symlink?(link_path)
49
- puts "Theme directory #{theme_path} is already linked in #{link_path}"
50
- return
51
- end
52
-
53
- puts "Linking #{theme_path} into #{link_path}"
54
- File.symlink(theme_path, link_path)
55
-
56
- end
57
-
58
- end
59
-
60
- end
61
-
62
- end