skadategems-dev 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/.travis.yml +12 -0
- data/Gemfile +13 -0
- data/Guardfile +8 -0
- data/LICENSE.txt +22 -0
- data/README.md +74 -0
- data/Rakefile +6 -0
- data/bin/skadate +9 -0
- data/bin/skadategems-dev +18 -0
- data/integration/README.md +97 -0
- data/integration/cli/skadate_init_spec.rb +86 -0
- data/integration/cli/skadate_spec.rb +50 -0
- data/integration/cli/spec_helper.rb +23 -0
- data/integration/lib/remote/download_file_spec.rb +136 -0
- data/integration/spec_helper.rb +101 -0
- data/lib/skadategems/dev/bundle.rb +115 -0
- data/lib/skadategems/dev/cli/remote.rb +364 -0
- data/lib/skadategems/dev/cli/skadate.rb +184 -0
- data/lib/skadategems/dev/remote.rb +170 -0
- data/lib/skadategems/dev/remote/clone_logger.rb +118 -0
- data/lib/skadategems/dev/remote/configs.rb +97 -0
- data/lib/skadategems/dev/remote/directory.rb +88 -0
- data/lib/skadategems/dev/remote/file.rb +157 -0
- data/lib/skadategems/dev/remote/includes/mysql_connect.php +8 -0
- data/lib/skadategems/dev/skadate.rb +30 -0
- data/lib/skadategems/dev/software_version.rb +66 -0
- data/lib/skadategems/dev/source_controller.rb +101 -0
- data/lib/skadategems/dev/version.rb +5 -0
- data/skadategems-dev.gemspec +33 -0
- data/spec/skadategems/dev/bundle_spec.rb +268 -0
- data/spec/skadategems/dev/cli/remote_spec.rb +623 -0
- data/spec/skadategems/dev/cli/skadate_spec.rb +182 -0
- data/spec/skadategems/dev/remote/clone_logger_spec.rb +324 -0
- data/spec/skadategems/dev/remote/directory_spec.rb +117 -0
- data/spec/skadategems/dev/remote/file_spec.rb +74 -0
- data/spec/skadategems/dev/remote_spec.rb +95 -0
- data/spec/skadategems/dev/skadate_spec.rb +62 -0
- data/spec/skadategems/dev/software_version_spec.rb +92 -0
- data/spec/skadategems/dev/source_controller_spec.rb +243 -0
- data/spec/spec_helper.rb +32 -0
- metadata +153 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b8e33edde9f192e2f7ae332814071a43999948b7
|
4
|
+
data.tar.gz: c2649b9b7712b0101d723bab3652a9a6616d8e9d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d856f40cc708bf6df51218e1f3aae1fda23e79e0ae09874b43a1ed1397e1116edeaf31c04f104fed8d62cb21a08cdb164e0541a76803b610666712e6e86ec413
|
7
|
+
data.tar.gz: 904a9029cf3b8039176b14811b9af3af05593d44da7c61483dc069cf09500564de3d6c0fb777e61f85edd0b9a48e33cb2239f4cec628ca9dd57f66681ef19da0
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
data/LICENSE.txt
ADDED
@@ -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.
|
data/README.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
Skadate Development Toolkit
|
2
|
+
===========================
|
3
|
+
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/skadategems-dev.png)](http://badge.fury.io/rb/skadategems-dev)
|
5
|
+
[![Build Status](https://travis-ci.org/skadategems/skadategems-dev.png?branch=master)](https://travis-ci.org/skadategems/skadategems-dev)
|
6
|
+
[![Dependency Status](https://gemnasium.com/skadategems/skadategems-dev.png)](https://gemnasium.com/skadategems/skadategems-dev)
|
7
|
+
[![Coverage Status](https://coveralls.io/repos/skadategems/skadategems-dev/badge.png)](https://coveralls.io/r/skadategems/skadategems-dev)
|
8
|
+
|
9
|
+
`skadategems-dev` is a command line tool that is created and maintained by the [SkadateGems][skadategems] development team to increase their productivity and code quality.
|
10
|
+
If you are not familiar with Skadate development, this tool will give you a basic understandings of Skadate-specific framework architecture and will be a good kick-start to begin to extend and modify your Skadate Software.
|
11
|
+
|
12
|
+
> _Please note that this tool is currently under development, more features and usage docs will come soon..._
|
13
|
+
|
14
|
+
[skadategems]: http://skadategems.com/
|
15
|
+
|
16
|
+
Development stack requirements
|
17
|
+
------------------------------
|
18
|
+
|
19
|
+
* Linux/OS X
|
20
|
+
* LAMP Stack (as required by [Skadate Software][skadate-server-requirements])
|
21
|
+
* Ruby MRI v2.0.0 or above
|
22
|
+
|
23
|
+
[skadate-server-requirements]: http://www.skadate.com/server_requirements.php
|
24
|
+
|
25
|
+
Supported Skadate software versions
|
26
|
+
-----------------------------------
|
27
|
+
|
28
|
+
* skadate-9.0.2500 (Skadate 9)
|
29
|
+
* skadate-9.0.2555 ...
|
30
|
+
* skadate-9.2.2657 ...
|
31
|
+
* skadate-9.2.2960 (Master)
|
32
|
+
* skadate-9.3.3144 (Master II)
|
33
|
+
|
34
|
+
Installation
|
35
|
+
------------
|
36
|
+
|
37
|
+
Once you have [Ruby][ruby] installed you can install the tool itself.
|
38
|
+
|
39
|
+
To install from publicly available rubygems repository, use:
|
40
|
+
|
41
|
+
$ gem install skadategems-dev
|
42
|
+
|
43
|
+
Alternatively, you can download the source tarball and install from the sources:
|
44
|
+
|
45
|
+
$ tar -xzf skadategems-dev-x.x.x.tar.gz
|
46
|
+
$ cd skadategems-dev-x.x.x/
|
47
|
+
$ rake install
|
48
|
+
|
49
|
+
[ruby]: https://www.ruby-lang.org/en/downloads/
|
50
|
+
|
51
|
+
Usage and documentation
|
52
|
+
-----------------------
|
53
|
+
|
54
|
+
Please see the [wiki] for basic usage and other documentation on using the tool.
|
55
|
+
You can also checkout the [official homepage][homepage].
|
56
|
+
|
57
|
+
[wiki]: https://github.com/skadategems/skadategems-dev/wiki
|
58
|
+
[homepage]: http://skadategems.com/dev-toolkit
|
59
|
+
|
60
|
+
Contributing
|
61
|
+
------------
|
62
|
+
|
63
|
+
1. Fork it
|
64
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
65
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
66
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
67
|
+
5. Create new Pull Request
|
68
|
+
|
69
|
+
License
|
70
|
+
-------
|
71
|
+
|
72
|
+
Released under the MIT License. See the [LICENSE] file for further details.
|
73
|
+
|
74
|
+
[LICENSE]: LICENSE.txt
|
data/Rakefile
ADDED
data/bin/skadate
ADDED
data/bin/skadategems-dev
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'skadategems/dev/version'
|
3
|
+
|
4
|
+
def line; '-' * 70 end
|
5
|
+
|
6
|
+
puts line,
|
7
|
+
|
8
|
+
"Skadate Development Toolkit (skadategems-dev)\n" <<
|
9
|
+
"https://skadategems.com/dev-toolkit\n" <<
|
10
|
+
"version #{SkadateGems::Dev::VERSION}",
|
11
|
+
|
12
|
+
line
|
13
|
+
|
14
|
+
File.open File.join(__dir__, '../LICENSE.txt') do |file|
|
15
|
+
puts file.read
|
16
|
+
end
|
17
|
+
|
18
|
+
puts line
|
@@ -0,0 +1,97 @@
|
|
1
|
+
Remote integration tests
|
2
|
+
========================
|
3
|
+
|
4
|
+
LAMP Stack
|
5
|
+
----------
|
6
|
+
|
7
|
+
In order to run remote integration tests you need to have up and running LAMP stack
|
8
|
+
as specified in official Skadate software site (http://skadate.com/requirement.php).
|
9
|
+
|
10
|
+
Skadate source directory
|
11
|
+
------------------------
|
12
|
+
|
13
|
+
You need to specify path to Skadate software sources directory
|
14
|
+
defining the `SKADATE_SOURCE_DIR` environment variable, for example:
|
15
|
+
|
16
|
+
```
|
17
|
+
$> export SKADATE_SOURCE_DIR=/home/skadate/release-versions/9.3.3144
|
18
|
+
```
|
19
|
+
|
20
|
+
Temporary deployment directory
|
21
|
+
------------------------------
|
22
|
+
|
23
|
+
Configure your Apache server so that you will be able to
|
24
|
+
access the `/tmp/skadate/local` and `/tmp/skadate/remote` directories
|
25
|
+
through `http://skadate-local-test/` and `http://skadate-remote-test/` accordingly.
|
26
|
+
|
27
|
+
In order to do this, you need to put the following into your Apache's `httpd-vhosts.conf`:
|
28
|
+
|
29
|
+
```
|
30
|
+
<Directory "/tmp/skadate">
|
31
|
+
Options Indexes FollowSymLinks
|
32
|
+
AllowOverride All
|
33
|
+
|
34
|
+
Order allow,deny
|
35
|
+
Allow from all
|
36
|
+
</Directory>
|
37
|
+
|
38
|
+
<VirtualHost 127.0.0.1:80>
|
39
|
+
DocumentRoot "/tmp/skadate/local"
|
40
|
+
ServerName skadate-local-test
|
41
|
+
</VirtualHost>
|
42
|
+
|
43
|
+
<VirtualHost 127.0.0.1:80>
|
44
|
+
DocumentRoot "/tmp/skadate/remote"
|
45
|
+
ServerName skadate-remote-test
|
46
|
+
</VirtualHost>
|
47
|
+
```
|
48
|
+
|
49
|
+
And the following into your `/etc/hosts`:
|
50
|
+
|
51
|
+
```
|
52
|
+
127.0.0.1 skadate-local-test skadate-remote-test
|
53
|
+
```
|
54
|
+
|
55
|
+
Environment variables
|
56
|
+
---------------------
|
57
|
+
|
58
|
+
You can redefine the following environment variables:
|
59
|
+
|
60
|
+
* `SKADATE_LOCAL_DIR` default: `"/tmp/skadate/local"`
|
61
|
+
* `SKADATE_LOCAL_HOST` default: `"skadate-local-test"`
|
62
|
+
* `SKADATE_REMOTE_DIR` default: `"/tmp/skadate/remote"`
|
63
|
+
* `SKADATE_REMOTE_HOST` default: `"skadate-remote-test"`
|
64
|
+
|
65
|
+
Debugging
|
66
|
+
---------
|
67
|
+
|
68
|
+
Set the `VERBOSE` environment variable to `true` to see what's happening in the background.
|
69
|
+
|
70
|
+
Big files downloading stress-test
|
71
|
+
---------------------------------
|
72
|
+
|
73
|
+
When running `lib/remote/download_file_spec.rb` you can also
|
74
|
+
define your own (probably very big) file to run this tests with.
|
75
|
+
|
76
|
+
> Warning: be careful, this may seriously hit your filesystem!
|
77
|
+
|
78
|
+
To do this, define `SKADATE_BIG_FILE_PATH` environment variable specifying
|
79
|
+
the full path to a big file in your filesystem.
|
80
|
+
|
81
|
+
For example:
|
82
|
+
|
83
|
+
```
|
84
|
+
$> export SKADATE_BIG_FILE_PATH="$HOME/Movies/Terminator IV - Salvation.mkv"
|
85
|
+
```
|
86
|
+
|
87
|
+
Then, run the test:
|
88
|
+
|
89
|
+
```
|
90
|
+
$> rspec -f d integration/lib/remote/download_file_spec.rb
|
91
|
+
```
|
92
|
+
|
93
|
+
To return the default behaviour, simply `unset` the variable:
|
94
|
+
|
95
|
+
```
|
96
|
+
$> unset SKADATE_BIG_FILE_PATH
|
97
|
+
```
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require File.expand_path('../spec_helper', __dir__)
|
2
|
+
require 'skadategems/dev/cli/skadate'
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
module SkadateGems::Dev
|
6
|
+
|
7
|
+
describe '$> skadate init' do
|
8
|
+
|
9
|
+
def skadate_init!(arguments)
|
10
|
+
puts "skadate init #{arguments.join ' '}" if verbose?
|
11
|
+
@stdout = capture(:stdout) do
|
12
|
+
CLI::Skadate.start( %w[init].concat(arguments) )
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
before(:each) do
|
17
|
+
FileUtils.mkdir_p(skadate_local_dir, verbose: verbose?) unless File.exists?(skadate_local_dir)
|
18
|
+
FileUtils.cd(skadate_local_dir, verbose: verbose?)
|
19
|
+
end
|
20
|
+
|
21
|
+
let(:dev_dir_path) { File.join(skadate_local_dir, '.dev') }
|
22
|
+
|
23
|
+
context '(without an arguments)' do
|
24
|
+
it 'creates a `.dev/` directory if not exists' do
|
25
|
+
expect do
|
26
|
+
skadate_init! []
|
27
|
+
end.to change { File.exists? dev_dir_path }.to true
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'generates a `.dev/.htaccess` file with the "Deny from all" instruction' do
|
31
|
+
htaccess_file_path = File.join(dev_dir_path, '.htaccess')
|
32
|
+
|
33
|
+
expect do
|
34
|
+
skadate_init! []
|
35
|
+
end.to change { File.exists? htaccess_file_path }.to true
|
36
|
+
|
37
|
+
expect(File.read(htaccess_file_path)).to eq <<-HTACCESS
|
38
|
+
Order Deny,Allow
|
39
|
+
Deny from all
|
40
|
+
HTACCESS
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context '--remote-url REMOTE_URL' do
|
45
|
+
it 'generates a `.dev/remote-server.json` configuration file' do
|
46
|
+
remote_server_config_path = File.join(dev_dir_path, 'remote-server.json')
|
47
|
+
|
48
|
+
expect do
|
49
|
+
skadate_init! ['-r', "http://#{skadate_remote_host}/"]
|
50
|
+
end.to change { File.exists? remote_server_config_path }.to true
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'generates an `exec.php` (server-side script runner) file' do
|
54
|
+
execphp_script_path = File.join(skadate_local_dir, 'exec.php')
|
55
|
+
|
56
|
+
expect do
|
57
|
+
skadate_init! ['-r', "http://#{skadate_remote_host}/"]
|
58
|
+
end.to change { File.exists? execphp_script_path }.to true
|
59
|
+
end
|
60
|
+
|
61
|
+
context 'when the `exec.php` file is uploaded to a remote server' do
|
62
|
+
before(:each) do
|
63
|
+
skadate_init! ['-r', "http://#{skadate_remote_host}/"]
|
64
|
+
FileUtils.mkdir(skadate_remote_dir, verbose: verbose?) unless File.exists?(skadate_remote_dir)
|
65
|
+
FileUtils.mv('exec.php', skadate_remote_dir, verbose: verbose?)
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'makes `skadate remote ping` invoke successful' do
|
69
|
+
puts 'skadate remote ping' if verbose?
|
70
|
+
|
71
|
+
output = capture(:stdout) do
|
72
|
+
CLI::Remote.start %w[ping]
|
73
|
+
end
|
74
|
+
|
75
|
+
expect(output).to eq <<-STDOUT
|
76
|
+
=> http://#{skadate_remote_host}/exec.php
|
77
|
+
#> 200 [OK]
|
78
|
+
>> pong!
|
79
|
+
STDOUT
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require File.join(__dir__, 'spec_helper')
|
2
|
+
require 'skadategems/cli/skadate'
|
3
|
+
|
4
|
+
module SkadateGems
|
5
|
+
module CLI
|
6
|
+
|
7
|
+
describe Skadate do
|
8
|
+
before(:all) { FileUtils.cd(SKADATE_STUB_DIR) }
|
9
|
+
|
10
|
+
describe '$> skadate software about' do
|
11
|
+
it 'prints out a Skadate software version information' do
|
12
|
+
stdout = capture(:stdout) { Skadate.start %w[software about] }
|
13
|
+
expect(stdout).to match /^Skadate Software \d\.\d\.\d{4} \(\w+\) \[\w+\]$/
|
14
|
+
expect(stdout).to match /^Release date: \w{3,9} \d{1,2}, 20\d{2}$/
|
15
|
+
expect(stdout).to include "Copyright (c) 2004-#{Date.today.year} Skalfa LLC\n"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe '$> skadate software version' do
|
20
|
+
it 'prints out a Skadate software version number' do
|
21
|
+
stdout = capture(:stdout) { Skadate.start %w[software version] }
|
22
|
+
expect(stdout).to match /^\d\.\d\.\d{4}$/
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '$> skadate software build' do
|
27
|
+
it 'prints out a Skadate software build number' do
|
28
|
+
stdout = capture(:stdout) { Skadate.start %w[software build] }
|
29
|
+
expect(stdout).to match /^\d{4}$/
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '$> skadate software release-date' do
|
34
|
+
it 'prints out a Skadate version release date' do
|
35
|
+
stdout = capture(:stdout) { Skadate.start %w[software release-date] }
|
36
|
+
expect(stdout).to match /^\w{3,9} \d{1,2}, 20\d{2}$/
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe '$> skadate software copyright' do
|
41
|
+
it 'prints out Skadate copyrights' do
|
42
|
+
stdout = capture(:stdout) { Skadate.start %w[software copyright] }
|
43
|
+
expect(stdout).to eq "Copyright (c) 2004-#{Date.today.year} Skalfa LLC\n"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# integration/cli/spec_helper.rb
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
unless ENV['SKADATE_STUB_DIR']
|
6
|
+
puts 'Error: `SKADATE_STUB_DIR` is not specified'
|
7
|
+
exit -1
|
8
|
+
end
|
9
|
+
|
10
|
+
require File.join(__dir__, '../../spec/spec_helper')
|
11
|
+
|
12
|
+
SKADATE_STUB_DIR = ENV['SKADATE_STUB_DIR']
|
13
|
+
|
14
|
+
TEMP_DIR = (File.symlink?('/tmp') ? "/#{File.readlink('/tmp')}" : '/tmp')
|
15
|
+
SKADATE_TEMP_DIR = File.join(TEMP_DIR, 'skadate')
|
16
|
+
|
17
|
+
RSpec.configure do |config|
|
18
|
+
config.before(:all) do
|
19
|
+
FileUtils.mkdir_p(SKADATE_TEMP_DIR) unless File.directory?(SKADATE_TEMP_DIR)
|
20
|
+
end
|
21
|
+
|
22
|
+
# config.before(:each) { FileUtils.rm_rf Dir.glob("#{SKADATE_TEMP_DIR}/*") }
|
23
|
+
end
|