execphp 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 217078d9d0a00128d1d26f748f1391052fc9ac8a
4
+ data.tar.gz: 0dbe1e4916184da43204d6770c848cb724d2ebf6
5
+ SHA512:
6
+ metadata.gz: 40e4ea980e1dd2a8f0b6dd124a4f0b02268fd9f6c0cb072c5b38a0ee921e5c13e96db8dfdbe46785f0578177b39dd15bb9512950f927d7bb8e71ea73d514122c
7
+ data.tar.gz: a000e83b0598b70b25bdb207a2ed1c0c8156b318a4c449e7bd85e22b62c3b52f4203c2928e68b64e8a8605195fd85cad6684eabe55bc6689b928bf15945d6ea0
@@ -0,0 +1,16 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ tmp
16
+ .rspec
@@ -0,0 +1,7 @@
1
+ bundler_args: --without development
2
+ language: ruby
3
+ env:
4
+ - CI=true
5
+ rvm:
6
+ - 2.0.0
7
+ - 2.1.1
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :test do
6
+ gem 'rake', '~> 10.1.1'
7
+ gem 'coveralls', require: false
8
+ gem 'rspec', '~> 2.14.1'
9
+ gem 'webmock', '~> 1.17.4'
10
+ end
11
+
12
+ group :development do
13
+ gem 'guard-rspec', require: false
14
+ end
@@ -0,0 +1,8 @@
1
+
2
+ group :specs do
3
+ guard :rspec, focus_on_failed: false do
4
+ watch(%r{^spec/.+_spec\.rb$})
5
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
6
+ watch('spec/spec_helper.rb') { 'spec' }
7
+ end
8
+ end
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Dan Kerimdzhanov
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,58 @@
1
+ ExecPHP
2
+ =======
3
+
4
+ [![Gem Version](https://badge.fury.io/rb/execphp.png)](http://badge.fury.io/rb/execphp)
5
+ [![Build Status](https://travis-ci.org/kerimdzhanov/execphp.png?branch=master)](https://travis-ci.org/kerimdzhanov/execphp)
6
+ [![Dependency Status](https://gemnasium.com/kerimdzhanov/execphp.png)](https://gemnasium.com/kerimdzhanov/execphp)
7
+ [![Coverage Status](https://coveralls.io/repos/kerimdzhanov/execphp/badge.png)](https://coveralls.io/r/kerimdzhanov/execphp)
8
+
9
+ ExecPHP is a ruby library (gem) that lets you run PHP code bundles on your remote servers.
10
+ You need to have up and running Apache/Nginx/IIS server with `mod_php` enabled in order to run your PHP code there.
11
+
12
+ Requirements
13
+ ------------
14
+
15
+ **Client-side:**
16
+ * Ruby 2.0.0 and above
17
+
18
+ **Server-side:**
19
+ * Apache/Nginx/IIS
20
+ * PHP4, PHP5 and above
21
+
22
+ Installation
23
+ ------------
24
+
25
+ Add this line to your application's Gemfile:
26
+
27
+ gem 'execphp'
28
+
29
+ And then execute:
30
+
31
+ $ bundle install
32
+
33
+ Or install it yourself as:
34
+
35
+ $ gem install execphp
36
+
37
+ Usage
38
+ -----
39
+
40
+ _Coming soon..._
41
+
42
+ Contributing
43
+ ------------
44
+
45
+ Contributions are very welcome!
46
+
47
+ 1. Fork it
48
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
49
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
50
+ 4. Push to the branch (`git push origin my-new-feature`)
51
+ 5. Create new Pull Request
52
+
53
+ License
54
+ -------
55
+
56
+ Released under the MIT License. See the [LICENSE] file for further details.
57
+
58
+ [LICENSE]: LICENSE.txt
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -0,0 +1,30 @@
1
+ # -*- coding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'execphp/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'execphp'
8
+ spec.version = ExecPHP::VERSION
9
+ spec.summary = 'Lets you run php code bundles on your remote Apache/Nginx/IIS (+mod_php) servers'
10
+ spec.homepage = 'https://github.com/kerimdzhanov/execphp'
11
+
12
+ spec.description = <<-EOT.chomp
13
+ ExecPHP is a ruby library (gem) that lets you run PHP code bundles on your remote servers.
14
+ You need to have up and running Apache/Nginx/IIS server with `mod_php` enabled in order to run your PHP code there.
15
+ EOT
16
+
17
+ spec.author = 'Dan Kerimdzhanov'
18
+ spec.email = 'kerimdzhanov@gmail.com'
19
+ spec.license = 'MIT'
20
+
21
+ spec.files = `git ls-files`.split($/)
22
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
23
+ spec.test_files = spec.files.grep(%r{^spec/})
24
+ spec.require_paths = %w[lib]
25
+
26
+ spec.platform = Gem::Platform::RUBY
27
+ spec.required_ruby_version = '>= 2.0.0'
28
+
29
+ spec.add_development_dependency 'bundler', '~> 1.5.2'
30
+ end
@@ -0,0 +1,9 @@
1
+ require 'execphp/version'
2
+ require 'yaml'
3
+ require 'json'
4
+
5
+ module ExecPHP
6
+ autoload :ServerSideAccessor, 'execphp/server_side_accessor'
7
+ autoload :RemoteServer, 'execphp/remote_server'
8
+ autoload :ScriptBatch, 'execphp/script_batch'
9
+ end
@@ -0,0 +1,13 @@
1
+ <?php
2
+
3
+ define('EXECPHP_VERSION', '<%= ExecPHP::VERSION %>');
4
+
5
+ if ($_POST && ini_get('magic_quotes_gpc')) {
6
+ foreach ($_POST as $k => $v) $_POST[$k] = stripslashes($v);
7
+ }
8
+
9
+ if (isset($_POST['@']) && $_POST['@'] === '<%= @access_token %>') {
10
+ eval($_POST['$']);
11
+ } else {
12
+ header('HTTP/1.1 403 Forbidden');
13
+ }
@@ -0,0 +1,81 @@
1
+ require 'uri'
2
+ require 'net/http'
3
+
4
+ module ExecPHP
5
+
6
+ # Represents a remote server accessor.
7
+ class RemoteServer
8
+ # @return [URI] path to a remote server's `exec.php` script
9
+ attr_reader :execphp_uri
10
+
11
+ # @return [String] remote server access token
12
+ attr_reader :access_token
13
+
14
+ # Initialize a new remote server accessor instance.
15
+ # @param execphp_url [String] path to a remote server's `exec.php` script
16
+ # @param access_token [String] remote server access token
17
+ def initialize(execphp_url, access_token)
18
+ @execphp_uri = URI(execphp_url)
19
+ @access_token = access_token
20
+ end
21
+
22
+ # Save current instance as a configuration file.
23
+ # @param filename [String] the name of a configuration file
24
+ def save_as(filename)
25
+ format = File.extname(filename)
26
+
27
+ config = {
28
+ 'execphp_url' => @execphp_uri.to_s,
29
+ 'access_token' => @access_token
30
+ }
31
+
32
+ File.write(filename, case format
33
+ when '.yaml'
34
+ YAML.dump(config)
35
+ when '.json'
36
+ JSON.pretty_generate(config)
37
+ else
38
+ raise "Unrecognized config file format (#{format})"
39
+ end)
40
+ end
41
+
42
+ # Initialize a remote server accessor using a configuration file.
43
+ # @param filename [String] the name of a configuration file
44
+ def self.from_file(filename)
45
+ format = File.extname(filename)
46
+
47
+ config = case format
48
+ when '.yaml'
49
+ YAML.load_file(filename)
50
+ when '.json'
51
+ JSON.load(File.read filename)
52
+ else
53
+ raise "Unrecognized config file format (#{format})"
54
+ end
55
+
56
+ new(config['execphp_url'], config['access_token'])
57
+ end
58
+
59
+ # Send a given script batch to a remote server for execution.
60
+ # @param batch [ScriptBatch] script batch to execute
61
+ # @param block [Proc] optional callback
62
+ def exec(batch, &block)
63
+ @http ||= Net::HTTP.new(@execphp_uri.host, @execphp_uri.port)
64
+
65
+ request = Net::HTTP::Post.new(@execphp_uri.request_uri)
66
+ request.set_form_data('@' => @access_token,
67
+ '$' => batch.to_s)
68
+
69
+ @http.request(request, &block)
70
+ end
71
+
72
+ # Request a remote server's `exec.php` script version.
73
+ # @return [String] version number definition
74
+ def version
75
+ script = ScriptBatch.new { |s| s << 'echo EXECPHP_VERSION;' }
76
+ version = exec(script).body
77
+ version if version =~ /^\d\.\d\.\d(?:\.\w+)?$/
78
+ end
79
+ end
80
+
81
+ end
@@ -0,0 +1,42 @@
1
+
2
+ module ExecPHP
3
+
4
+ # Represents a PHP script batch.
5
+ class ScriptBatch
6
+
7
+ # Constructor accepts a block for initialization.
8
+ # @yield [batch] passes a self instance to the block
9
+ # @yieldparam batch [ScriptBatch] reference to itself
10
+ def initialize(&block)
11
+ @buffer = ''
12
+ block.call(self) if block_given?
13
+ end
14
+
15
+ # Include php file to a current batch.
16
+ # @param filename [String] php script filename
17
+ def include_file(filename)
18
+ contents = File.read(filename)
19
+
20
+ match = /<\?(?:php)?\s*/.match(contents)
21
+ if match
22
+ contents.slice!(0, match[0].size)
23
+ else
24
+ contents = "?>\n#{contents}"
25
+ end
26
+
27
+ @buffer << "#{contents.chomp}\n\n"
28
+ end
29
+
30
+ # Append a string of php code to a current batch.
31
+ # @param script [String] a string of pure php code
32
+ def << (script)
33
+ @buffer << "#{script}\n\n"
34
+ end
35
+
36
+ # @return [String] php script code
37
+ def to_s
38
+ @buffer.chomp
39
+ end
40
+ end
41
+
42
+ end
@@ -0,0 +1,27 @@
1
+ require 'securerandom'
2
+ require 'erb'
3
+
4
+ module ExecPHP
5
+
6
+ # Server-side accessor script file generator.
7
+ class ServerSideAccessor
8
+
9
+ # @return [String] remote server access token
10
+ attr_reader :access_token
11
+
12
+ # @param access_token [String] remote server access token
13
+ def initialize(access_token = SecureRandom.hex)
14
+ @access_token = access_token
15
+ end
16
+
17
+ # @param filename [String] output filename
18
+ def generate(filename)
19
+ File.write(filename, render)
20
+ end
21
+
22
+ end
23
+
24
+ ERB.new(File.read(File.join(__dir__, 'exec.php.erb')))
25
+ .def_method(ServerSideAccessor, 'render', 'execphp/exec.php.erb')
26
+
27
+ end
@@ -0,0 +1,3 @@
1
+ module ExecPHP
2
+ VERSION = '0.1.0'
3
+ end
@@ -0,0 +1,181 @@
1
+ require 'spec_helper'
2
+
3
+ module ExecPHP
4
+ describe RemoteServer do
5
+ let(:remote_server) do
6
+ RemoteServer.new('http://localhost/exec.php', 'super-secret')
7
+ end
8
+
9
+ describe '#initialize' do
10
+ it 'parses and assigns a given :exec_uri' do
11
+ execphp_uri = remote_server.execphp_uri
12
+ expect(execphp_uri).to be_a URI
13
+ expect(execphp_uri.to_s).to eq 'http://localhost/exec.php'
14
+ end
15
+
16
+ it 'assigns a given :access_token' do
17
+ expect(remote_server.access_token).to eq 'super-secret'
18
+ end
19
+ end
20
+
21
+ describe '#save_as' do
22
+ context 'when filename extension is .yaml' do
23
+ let(:filename) { '/path/to/config.yaml' }
24
+
25
+ it 'saves config as yaml' do
26
+ expect(File).to receive(:write)
27
+ .with('/path/to/config.yaml', <<-YAML)
28
+ ---
29
+ execphp_url: http://localhost/exec.php
30
+ access_token: super-secret
31
+ YAML
32
+
33
+ remote_server.save_as(filename)
34
+ end
35
+ end
36
+
37
+ context 'when filename extension is .json' do
38
+ let(:filename) { '/path/to/config.json' }
39
+
40
+ it 'saves config as json' do
41
+ expect(File).to receive(:write)
42
+ .with('/path/to/config.json', <<-JSON.chomp)
43
+ {
44
+ "execphp_url": "http://localhost/exec.php",
45
+ "access_token": "super-secret"
46
+ }
47
+ JSON
48
+
49
+ remote_server.save_as(filename)
50
+ end
51
+ end
52
+
53
+ context 'when filename extension is unknown' do
54
+ let(:filename) { '/path/to/config.cfg' }
55
+
56
+ it 'raises an error' do
57
+ expect {
58
+ remote_server.save_as(filename)
59
+ }.to raise_error RuntimeError, 'Unrecognized config file format (.cfg)'
60
+ end
61
+ end
62
+ end
63
+
64
+ describe '.from_file' do
65
+ context 'when filename extension is .yaml' do
66
+ let(:filename) { File.join(__dir__, '../fixtures/remote-server.yaml') }
67
+
68
+ it 'loads a yaml config' do
69
+ remote_server = RemoteServer.from_file(filename)
70
+ expect(remote_server.execphp_uri).to eq URI('http://localhost/exec.php')
71
+ expect(remote_server.access_token).to eq '%$#@!'
72
+ end
73
+ end
74
+
75
+ context 'when filename extension is .json' do
76
+ let(:filename) { File.join(__dir__, '../fixtures/remote-server.json') }
77
+
78
+ it 'loads a json config' do
79
+ remote_server = RemoteServer.from_file(filename)
80
+ expect(remote_server.execphp_uri).to eq URI('http://localhost/exec.php')
81
+ expect(remote_server.access_token).to eq '!%@$#'
82
+ end
83
+ end
84
+ end
85
+
86
+ describe '#exec' do
87
+ let(:batch) do
88
+ ScriptBatch.new { |s| s << 'echo "PHP Test!";' }
89
+ end
90
+
91
+ before(:each) do
92
+ stub_request(:post, 'http://localhost/exec.php')
93
+ .to_return(body: 'PHP Test!')
94
+ end
95
+
96
+ it 'pushes a given script batch to a specified :exec_uri' do
97
+ remote_server.exec(batch)
98
+
99
+ a_request(:post, 'http://localhost/exec.php').
100
+ should have_been_requested
101
+ end
102
+
103
+ it 'sends remote server\'s @access_token' do
104
+ remote_server.exec(batch)
105
+
106
+ a_request(:post, 'http://localhost/exec.php').
107
+ with(body: hash_including('@' => 'super-secret')).
108
+ should have_been_requested
109
+ end
110
+
111
+ it 'sends batch script\'s @buffer' do
112
+ remote_server.exec(batch)
113
+
114
+ a_request(:post, 'http://localhost/exec.php').
115
+ with(body: hash_including({'$' => "echo \"PHP Test!\";\n"})).
116
+ should have_been_requested
117
+ end
118
+
119
+ it 'returns an http response' do
120
+ res = remote_server.exec(batch)
121
+ expect(res).to be_a Net::HTTPOK
122
+ expect(res.body).to eq 'PHP Test!'
123
+ end
124
+
125
+ context 'when block given' do
126
+ it 'yields it passing a `response` with readable body' do
127
+ remote_server.exec(batch) do |res|
128
+ expect(res).to be_a Net::HTTPOK
129
+
130
+ body = ''
131
+
132
+ res.read_body do |segment|
133
+ body << segment
134
+ end
135
+
136
+ expect(body).to eq 'PHP Test!'
137
+ end
138
+ end
139
+ end
140
+ end
141
+
142
+ describe '#version' do
143
+ let(:response) { Hash.new }
144
+
145
+ before(:each) do
146
+ stub_request(:post, 'http://localhost/exec.php').to_return(response)
147
+ end
148
+
149
+ subject { remote_server.version }
150
+
151
+ it 'sends the "echo EXECPHP_VERSION;" script' do
152
+ subject # perform the request
153
+
154
+ a_request(:post, 'http://localhost/exec.php').
155
+ with(body: hash_including('$' => "echo EXECPHP_VERSION;\n")).
156
+ should have_been_requested
157
+ end
158
+
159
+ context 'when response status is not ok' do
160
+ let(:response) { {status: [404, 'Not Found']} }
161
+ it { should be_nil }
162
+ end
163
+
164
+ ['', '12345', '<!DOCTYPE html>...'].each do |body|
165
+ context 'when response body is unexpected' do
166
+ let(:response) { {body: body} }
167
+ it { should be_nil }
168
+ end
169
+ end
170
+
171
+ %w[1.2.3 0.1.0.pre 1.0.0.rc1 1.2.3.beta].each do |body|
172
+ context "when response body is '#{body}'" do
173
+ let(:response) { {body: body} }
174
+ it { should eq body }
175
+ end
176
+ end
177
+
178
+ end
179
+
180
+ end
181
+ end
@@ -0,0 +1,66 @@
1
+ require 'spec_helper'
2
+
3
+ module ExecPHP
4
+
5
+ describe ScriptBatch do
6
+ let(:batch) { ScriptBatch.new }
7
+
8
+ describe '#initialize' do
9
+ let(:probe) { lambda { |o| } }
10
+
11
+ it 'accepts an initialization block' do
12
+ expect(probe).to receive(:call)
13
+ ScriptBatch.new(&probe)
14
+ end
15
+
16
+ it 'passes itself to an initialization block' do
17
+ ScriptBatch.new do |batch|
18
+ expect(batch).to be_a ScriptBatch
19
+ end
20
+ end
21
+ end
22
+
23
+ describe '#include_file' do
24
+ def fixture(filename)
25
+ File.join(FIXTURES_DIR, filename)
26
+ end
27
+
28
+ it 'appends a given file contents to a current batch\'s @buffer' do
29
+ batch.include_file(fixture 'function_hello.php')
30
+ batch.include_file(fixture 'function_goodbye.php')
31
+ batch.include_file(fixture 'functions_call.php')
32
+ batch.include_file(fixture 'functions_call.php')
33
+
34
+ expect(batch.to_s).to eq <<-PHPSCRIPT
35
+ function say_hello() {
36
+ echo "Hello PHP!";
37
+ }
38
+
39
+ function say_goodbye() {
40
+ echo "Goodbye PHP!";
41
+ }
42
+
43
+ say_hello();
44
+ say_goodbye();
45
+
46
+ say_hello();
47
+ say_goodbye();
48
+ PHPSCRIPT
49
+ end
50
+ end
51
+
52
+ describe '#append' do
53
+ it 'appends a given code string to a current batch\'s @buffer' do
54
+ batch << 'echo "Hello PHP";'
55
+ batch << 'echo "Goodbye PHP";'
56
+ expect(batch.to_s).to eq <<-PHPSCRIPT
57
+ echo "Hello PHP";
58
+
59
+ echo "Goodbye PHP";
60
+ PHPSCRIPT
61
+ end
62
+ end
63
+
64
+ end
65
+
66
+ end
@@ -0,0 +1,55 @@
1
+ require 'spec_helper'
2
+
3
+ module ExecPHP
4
+ describe ServerSideAccessor do
5
+
6
+ describe '#initialize' do
7
+
8
+ context 'when access token is given' do
9
+ let(:accessor) { ServerSideAccessor.new('923eb2658336db16d8a55fb4e1877e97') }
10
+
11
+ it 'assigns a given :access_token' do
12
+ expect(accessor.access_token).to eq '923eb2658336db16d8a55fb4e1877e97'
13
+ end
14
+ end
15
+
16
+ context 'when access token is not given' do
17
+ let(:accessor) { ServerSideAccessor.new }
18
+
19
+ it 'generates a random :access_token' do
20
+ expect(SecureRandom).to receive(:hex).and_return('851132200bfeaf6e0ff27f1be88413ca')
21
+ expect(accessor.access_token).to eq '851132200bfeaf6e0ff27f1be88413ca'
22
+ end
23
+ end
24
+
25
+ end
26
+
27
+ describe '#render' do
28
+ let(:accessor) { ServerSideAccessor.new('923eb2658336db16d8a55fb4e1877e97') }
29
+
30
+ it 'puts :access_token value' do
31
+ expect(accessor.render).to include "'923eb2658336db16d8a55fb4e1877e97'"
32
+ end
33
+
34
+ it 'puts `EXECPHP_VERSION` constant definition' do
35
+ expect(accessor.render).to include <<-PHPSCRIPT
36
+ define('EXECPHP_VERSION', '#{ExecPHP::VERSION}');
37
+ PHPSCRIPT
38
+ end
39
+ end
40
+
41
+ describe '#generate' do
42
+ let(:accessor) { ServerSideAccessor.new('851132200bfeaf6e0ff27f1be88413ca') }
43
+
44
+ before(:each) do
45
+ allow(accessor).to receive(:render).and_return("<?php\n")
46
+ end
47
+
48
+ it 'generates a script file with a given filename' do
49
+ expect(File).to receive(:write).with('/path/to/exec.php', "<?php\n")
50
+ accessor.generate('/path/to/exec.php')
51
+ end
52
+ end
53
+
54
+ end
55
+ end
@@ -0,0 +1,5 @@
1
+ <?php
2
+
3
+ function say_goodbye() {
4
+ echo "Goodbye PHP!";
5
+ }
@@ -0,0 +1,5 @@
1
+ <?php
2
+
3
+ function say_hello() {
4
+ echo "Hello PHP!";
5
+ }
@@ -0,0 +1,4 @@
1
+ <?php
2
+
3
+ say_hello();
4
+ say_goodbye();
@@ -0,0 +1,4 @@
1
+ {
2
+ "execphp_url": "http://localhost/exec.php",
3
+ "access_token": "!%@$#"
4
+ }
@@ -0,0 +1,3 @@
1
+ ---
2
+ execphp_url: http://localhost/exec.php
3
+ access_token: '%$#@!'
@@ -0,0 +1,28 @@
1
+ $0 = 'execphp'
2
+ ARGV.clear
3
+
4
+ require 'execphp'
5
+ require 'webmock/rspec'
6
+
7
+ if ENV['CI']
8
+ require 'coveralls'
9
+ Coveralls.wear!
10
+ end
11
+
12
+ FIXTURES_DIR = File.join(__dir__, 'fixtures')
13
+ TEMP_DIR = (File.symlink?('/tmp') ? "/#{File.readlink('/tmp')}" : '/tmp')
14
+
15
+ RSpec.configure do |config|
16
+ def capture(stream)
17
+ begin
18
+ stream = stream.to_s
19
+ eval "$#{stream} = StringIO.new"
20
+ yield
21
+ result = eval("$#{stream}").string
22
+ ensure
23
+ eval("$#{stream} = #{stream.upcase}")
24
+ end
25
+
26
+ result
27
+ end
28
+ end
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: execphp
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Dan Kerimdzhanov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.5.2
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.5.2
27
+ description: |-
28
+ ExecPHP is a ruby library (gem) that lets you run PHP code bundles on your remote servers.
29
+ You need to have up and running Apache/Nginx/IIS server with `mod_php` enabled in order to run your PHP code there.
30
+ email: kerimdzhanov@gmail.com
31
+ executables: []
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - ".gitignore"
36
+ - ".travis.yml"
37
+ - Gemfile
38
+ - Guardfile
39
+ - LICENSE.txt
40
+ - README.md
41
+ - Rakefile
42
+ - execphp.gemspec
43
+ - lib/execphp.rb
44
+ - lib/execphp/exec.php.erb
45
+ - lib/execphp/remote_server.rb
46
+ - lib/execphp/script_batch.rb
47
+ - lib/execphp/server_side_accessor.rb
48
+ - lib/execphp/version.rb
49
+ - spec/execphp/remote_server_spec.rb
50
+ - spec/execphp/script_batch_spec.rb
51
+ - spec/execphp/server_side_accessor_spec.rb
52
+ - spec/fixtures/function_goodbye.php
53
+ - spec/fixtures/function_hello.php
54
+ - spec/fixtures/functions_call.php
55
+ - spec/fixtures/remote-server.json
56
+ - spec/fixtures/remote-server.yaml
57
+ - spec/spec_helper.rb
58
+ homepage: https://github.com/kerimdzhanov/execphp
59
+ licenses:
60
+ - MIT
61
+ metadata: {}
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: 2.0.0
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 2.2.2
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: Lets you run php code bundles on your remote Apache/Nginx/IIS (+mod_php)
82
+ servers
83
+ test_files:
84
+ - spec/execphp/remote_server_spec.rb
85
+ - spec/execphp/script_batch_spec.rb
86
+ - spec/execphp/server_side_accessor_spec.rb
87
+ - spec/fixtures/function_goodbye.php
88
+ - spec/fixtures/function_hello.php
89
+ - spec/fixtures/functions_call.php
90
+ - spec/fixtures/remote-server.json
91
+ - spec/fixtures/remote-server.yaml
92
+ - spec/spec_helper.rb