ptero 1.0.3 → 1.0.4

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: 165c7c7850463518a58561f975ff4c863b628811
4
- data.tar.gz: f279bc9d3e83b175e0a375efd23f8d97db7538d0
3
+ metadata.gz: 3d4792a46c456252b457597f5c0a6ff05d3937d1
4
+ data.tar.gz: 922fcf8074aa76113104c1d07d4140bcef12a43c
5
5
  SHA512:
6
- metadata.gz: fa735b7f0551635eed1627275afcb2b36b58dffc0236912baa06b257079b24627a1dca74d20cee75df16b24543069395600b6a9b059da3c57e3116907047e952
7
- data.tar.gz: f3df3bfd2cb0ef71fb9c9885a00bb8f0580015a03663b1f0a39a1c89642841bfd7b99cf3c8bac371923c44cabe2496dec4b0a6ed114ef38ed0ee5b3a2d712bd2
6
+ metadata.gz: 50fabbb8af36688eab64319d0ce8bbdb4b1d3188e14be69539b33ddbc1a56eafb917a5f3f00e8560a6aab70735cd5566f32515db07c0ca36fb2fb47a15f53a71
7
+ data.tar.gz: b453ce63d1b3e6b2a456cbc23b7fbff9b1d8a7ed5eb99045d4dd28099022b427d9a99c705df9e74b3748e4a3a8d25289e3d0bff61770f32d9400445717cdc871
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
- ### Ptero
1
+ Ptero [![Gem Version](https://badge.fury.io/rb/ptero.svg)](http://badge.fury.io/rb/ptero)
2
+ =====
3
+
2
4
  Ptero is a fast and flexible model-view-controller framework for PHP. It allows you to generate models, views, controllers, and routes instantly over the command-line and automatically provides a strong, clean structure for running web apps.
3
5
 
4
6
  Think wearing a giant robot exo-skeleton with lasers and missile launchers while crushing the puny challenges of archaic PHP in a two-hour-long feature film directed by Michael Bay. It's that good.
@@ -15,11 +17,11 @@ Features include:
15
17
 
16
18
  ### It takes care of the bad stuff
17
19
  Don't worry about:
18
- * annoying PHP syntax errors
20
+ * PHP syntax errors
19
21
  * copy-pasting or otherwise repeating code
20
22
  * SQL, SQL injection, escaping strings, etc
21
- * URLs that look ugly
22
- * PHP being stupid in general
23
+ * Confusing URLs and query strings
24
+ * Frustrating design or structural problems
23
25
 
24
26
  ### How do I do it?
25
27
  To start using Ptero, make sure your PHP command-line tool is up-to-date, then run the following:
@@ -43,12 +43,22 @@ module Ptero
43
43
  Dir.chdir @dir do
44
44
  # Download code from the composer website
45
45
  # https://getcomposer.org
46
- Open3.popen3("php -r \"readfile('https://getcomposer.org/installer');\" | php") do |stdin,stdout,stderr|
46
+ command = "php -r \"readfile('https://getcomposer.org/installer');\" | php"
47
+ Open3.popen2(command,{:err => [:child, :out]}) do |stdin,stdout,wait_thr|
47
48
  print 'Downloading composer'
49
+ output = ''
48
50
  stdout.each_line do |line|
51
+ output << line
49
52
  print '.'
50
53
  end
54
+ exit_status = wait_thr.value
55
+
51
56
  puts
57
+
58
+ unless exit_status.success?
59
+ raise Ptero::Exception::ApplicationException, "Could not install Composer in Application #{self.dir} with command `#{command}`. Output was: \"#{output.chomp}\""
60
+ end
61
+
52
62
  puts 'Done!'
53
63
  end
54
64
  end
@@ -77,15 +87,26 @@ module Ptero
77
87
  def install_dependencies
78
88
  raise Ptero::Exception::ApplicationException, "Not a dinosaur root: #{Dir.pwd}" unless verify
79
89
  raise Ptero::Exception::ApplicationException, "PHP command-line tool failed, update your version of PHP" unless test_php
90
+ # get_composer unless has_composer?
80
91
  Dir.chdir @dir do
81
92
  # Install dependencies using Composer
82
93
  # https://getcomposer.org
83
- Open3.popen3('php composer.phar install') do |stdin,stdout,stderr|
94
+ command = 'php composer.phar install'
95
+ Open3.popen2(command,{:err => [:child, :out]}) do |stdin,stdout,wait_thr|
84
96
  print 'Installing dependencies'
97
+ output = ''
85
98
  stdout.each_line do |line|
99
+ output << line
86
100
  print '.'
87
101
  end
102
+
103
+ exit_status = wait_thr.value
104
+
88
105
  puts
106
+
107
+ unless exit_status.success?
108
+ raise Ptero::Exception::ApplicationException, "Could not install dependencies in Application #{self.dir} with command `#{command}`. Output was: \"#{output.chomp}\""
109
+ end
89
110
  puts 'Done!'
90
111
  end
91
112
  end
@@ -98,11 +119,26 @@ module Ptero
98
119
  def update_dependencies
99
120
  raise Ptero::Exception::ApplicationException, "Not a dinosaur root: #{Dir.pwd}" unless verify
100
121
  raise Ptero::Exception::ApplicationException, "PHP command-line tool failed, update your version of PHP" unless test_php
122
+ get_composer unless has_composer?
101
123
  Dir.chdir @dir do
102
124
  # Update dependencies using Composer
103
125
  # https://getcomposer.org
104
- Open3.popen3('php composer.phar update') do |stdin,stdout,stderr|
105
- stdout.read
126
+ command = 'php composer.phar update'
127
+ Open3.popen2(command,{:err => [:child, :out]}) do |stdin,stdout,wait_thr|
128
+ print 'Updating dependencies'
129
+ output = ''
130
+ stdout.each_line do |line|
131
+ output << line
132
+ print '.'
133
+ end
134
+ exit_status = wait_thr.value
135
+ puts
136
+
137
+ unless exit_status.success?
138
+ raise Ptero::Exception::ApplicationException, "Could not update dependencies in Application #{self.dir} with command `#{command}`. Output was: \"#{output.chomp}\""
139
+ end
140
+
141
+ puts 'Done!'
106
142
  end
107
143
  end
108
144
  self
@@ -30,7 +30,7 @@ class Ptero::CLI::Root < Ptero::CLI
30
30
  composer()
31
31
  install()
32
32
  end
33
- puts "Change your working directory to '#{Dir.pwd}/#{name}' and starting generating files with 'ptero generate' to start your application"
33
+ puts "Change your working directory to '#{Dir.pwd}/#{name}' and start generating files with 'ptero generate' to start your application"
34
34
  end
35
35
 
36
36
  desc 'seed NAME', 'Seed a new application'
@@ -166,7 +166,7 @@ class Ptero::CLI::Root < Ptero::CLI
166
166
 
167
167
  desc 'install', 'Install dependencies'
168
168
  long_desc <<-LONGDESC
169
- Use the composer.json file to install dependencies
169
+ Use the composer.json file to install dependencies. Install Composer if it is not already downloaded.
170
170
  LONGDESC
171
171
  # Call the appropriate Application methods on the current Application to install Composer dependencies.
172
172
  # If verify returns false, install quits with the ptero_dir_message text
@@ -176,6 +176,18 @@ class Ptero::CLI::Root < Ptero::CLI
176
176
  end
177
177
  end
178
178
 
179
+ desc 'update', 'Update dependencies'
180
+ long_desc <<-LONGDESC
181
+ Use the composer.json file to update dependencies. Install Composer if it is not already downloaded.
182
+ LONGDESC
183
+ # Call the appropriate Application methods to update Composer dependencies.
184
+ # If verify returns false, install quits with the ptero_dir_message text
185
+ def update
186
+ verify do
187
+ app.update_dependencies
188
+ end
189
+ end
190
+
179
191
  desc 'composer', 'Download composer.phar'
180
192
  long_desc <<-LONGDESC
181
193
  Download the compser.phar file in order to facilitate future downloads
@@ -1,4 +1,4 @@
1
1
  module Ptero
2
2
  # Do you I need to explain this?
3
- VERSION = "1.0.3"
3
+ VERSION = "1.0.4"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ptero
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - LuminousRubyist
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-24 00:00:00.000000000 Z
11
+ date: 2015-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler