Skip to content

Commit 6f77343

Browse files
authored
Merge pull request #27 from loadsys/c/readme-gitignore-cleanup
Add a code of conduct, update the gitignore file and simplify the README.
2 parents c593e58 + 3637d13 commit 6f77343

File tree

6 files changed

+89
-21
lines changed

6 files changed

+89
-21
lines changed

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,17 @@ app/[Cc]onfig/core.php
66
app/[Cc]onfig/database.php
77
!empty
88
/vendor/*
9+
10+
# OS
11+
.DS_Store
12+
.AppleDouble
13+
.LSOverride
14+
Icon?
15+
._*
16+
.Spotlight-V100
17+
.Trashes
18+
.AppleDB
19+
.AppleDesktop
20+
Network Trash Folder
21+
Temporary Items
22+
.apdisk

CODE_OF_CONDUCT.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Contributor Code of Conduct
2+
3+
As contributors and maintainers of this project, and in the interest of
4+
fostering an open and welcoming community, we pledge to respect all people who
5+
contribute through reporting issues, posting feature requests, updating
6+
documentation, submitting pull requests or patches, and other activities.
7+
8+
We are committed to making participation in this project a harassment-free
9+
experience for everyone, regardless of level of experience, gender, gender
10+
identity and expression, sexual orientation, disability, personal appearance,
11+
body size, race, ethnicity, age, religion, or nationality.
12+
13+
Examples of unacceptable behavior by participants include:
14+
15+
* The use of sexualized language or imagery
16+
* Personal attacks
17+
* Trolling or insulting/derogatory comments
18+
* Public or private harassment
19+
* Publishing other's private information, such as physical or electronic
20+
addresses, without explicit permission
21+
* Other unethical or unprofessional conduct
22+
23+
Project maintainers have the right and responsibility to remove, edit, or
24+
reject comments, commits, code, wiki edits, issues, and other contributions
25+
that are not aligned to this Code of Conduct, or to ban temporarily or
26+
permanently any contributor for other behaviors that they deem inappropriate,
27+
threatening, offensive, or harmful.
28+
29+
By adopting this Code of Conduct, project maintainers commit themselves to
30+
fairly and consistently applying these principles to every aspect of managing
31+
this project. Project maintainers who do not follow or enforce the Code of
32+
Conduct may be permanently removed from the project team.
33+
34+
This Code of Conduct applies both within project spaces and in public spaces
35+
when an individual is representing the project or its community.
36+
37+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
38+
reported by contacting a project maintainer at conduct@loadsys.com. All
39+
complaints will be reviewed and investigated and will result in a response that
40+
is deemed necessary and appropriate to the circumstances. Maintainers are
41+
obligated to maintain confidentiality with regard to the reporter of an
42+
incident.
43+
44+
45+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
46+
version 1.3.0, available at
47+
[http://contributor-covenant.org/version/1/3/0/][version]
48+
49+
[homepage]: http://contributor-covenant.org
50+
[version]: http://contributor-covenant.org/version/1/3/0/

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ A CakePHP plugin that provides a Shell to read an app's Configure vars from the
1515

1616
## Requirements
1717

18-
* CakePHP 3.0.0+
18+
* CakePHP 3.1.0+
1919
* PHP 5.6+
2020

2121

@@ -50,7 +50,7 @@ To use this plugin, call it from the command line:
5050

5151
```shell
5252
$ cd path/to/app/
53-
$ ./bin/cake ConfigRead.ConfigRead Key.Name
53+
$ ./bin/cake config_read Key.Name
5454
'foo'
5555
```
5656

@@ -67,7 +67,7 @@ SECOND_KEY_THIRD='42'
6767
Note that this format is automatically used whenever more than one key is returned (unless the `--serialize` switch has been used). For example, if you request a key that contains an array, all values in the array will be returned sequentially. Alternatively, if you pass multiple keys on the command line, they will all be returned. The format can also be forced using the `-b` or `--bash` command line switch:
6868

6969
```shell
70-
$ ./bin/cake ConfigRead.ConfigRead -b Key.Name
70+
$ ./bin/cake config_read -b Key.Name
7171
KEY_NAME='foo'
7272
```
7373

@@ -80,7 +80,7 @@ Requesting multiple keys on the command line will produce an array of those keys
8080
This switch always overrides both the `--bash` switch and the Shell's automatic bash formatting.
8181

8282
```shell
83-
$ ./bin/cake ConfigRead.ConfigRead -s Key.Name Second.Key
83+
$ ./bin/cake config_read -s Key.Name Second.Key
8484
a:2:{s:8:"Key.Name";s:3:"foo";s:10:"Second.Key";a:3:{s:5:"First";s:3:"bar";s:6:"Second";s:3:"baz";s:5:"Third";i:42;}}
8585
# Check the result by piping into PHP and unserializing the result.
8686
$ ./bin/cake ConfigRead.ConfigRead -s Key.Name Second.Key | php -r 'print_r(unserialize(file_get_contents("php://stdin")));'
@@ -124,6 +124,10 @@ The "gotcha" here is that ConfigReadShell has to maintain a hard-coded list of C
124124

125125
## Contributing
126126

127+
### Code of Conduct
128+
129+
This project has adopted the Contributor Covenant as its [code of conduct](CODE_OF_CONDUCT.md). All contributors are expected to adhere to this code. [Translations are available](http://contributor-covenant.org/).
130+
127131
### Reporting Issues
128132

129133
Please use [GitHub Isuses](https://github.com/loadsys/CakePHP-ConfigReadShell/issues) for listing any known defects or issues.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
},
2222
"require": {
2323
"php": ">=5.4",
24-
"cakephp/cakephp": "~3.0",
24+
"cakephp/cakephp": "~3.1",
2525
"composer/installers": "~1.0",
2626
"psy/psysh": "@stable"
2727
},

src/Shell/ConfigReadShell.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ class ConfigReadShell extends Shell {
6767
public $specialKeys = [
6868
'Cache' => '\Cake\Cache\Cache::config',
6969
'Datasources' => '\Cake\Datasource\ConnectionManager::config',
70-
'EmailTransport' => '\Cake\Network\Email\Email::configTransport',
71-
'Email' => '\Cake\Network\Email\Email::config',
70+
'EmailTransport' => '\Cake\Mailer\Email::configTransport',
71+
'Email' => '\Cake\Mailer\Email::config',
7272
'Log' => '\Cake\Log\Log::config',
7373
'Security.salt' => 'self::securitySaltHelper',
7474
];
@@ -393,13 +393,13 @@ public function getOptionParser() {
393393
'short' => 'b',
394394
'boolean' => true,
395395
'default' => false,
396-
'help' => __('Always use bash variable deinfition formatting. When enabled, output will be formatted as `KEY_NAME=\'value\'`. This option is auto-enabled if multiple keys are provided on the command line, or if the value for the requested key is itself an array. When multiple values are returned, each will be output on its own line.')
396+
'help' => __('Always use bash variable deinfition formatting. When enabled, output will be formatted as `KEY_NAME=\'value\'`. This option is auto-enabled if multiple keys are provided on the command line, or if the value for the requested key is itself an array. When multiple values are returned, each will be output on its own line.'),
397397
])
398398
->addOption('serialize', [
399399
'short' => 's',
400400
'boolean' => true,
401401
'default' => false,
402-
'help' => __('Encode all output using PHP\'s `serialize()` method. Makes the Shell\'s output suitable for consumption by other PHP console scripts. Always overrides the --bash option. A single requested key will be serialized directly. Multiple requested keys will be combined into an associative array with the provided arguments as key names and then serialized.')
402+
'help' => __('Encode all output using PHP\'s `serialize()` method. Makes the Shell\'s output suitable for consumption by other PHP console scripts. Always overrides the --bash option. A single requested key will be serialized directly. Multiple requested keys will be combined into an associative array with the provided arguments as key names and then serialized.'),
403403
])
404404
->description(
405405
__('Provides CLI access to variables defined in the Configure class of the host CakePHP application. Will output the value of any keys passed as arguments. Equivelant to `Configure::read(\'Key.Name\')`. Unrecognized keys will produce empty string or `null` output.')

tests/TestCase/Shell/ConfigReadShellTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@
88
use Cake\Console\ConsoleOptionParser;
99
use Cake\Console\Shell;
1010
use Cake\Core\Configure;
11+
use Cake\Datasource\ConnectionManager;
1112
use Cake\TestSuite\TestCase;
13+
use Cake\Utility\Security;
1214
use ConfigRead\Shell\ConfigReadShell;
15+
use \StdClass;
1316

1417
/**
1518
* TestConfigReadShell class
@@ -43,23 +46,20 @@ public function printVal($key, $val) {
4346
*
4447
*/
4548
class ConfigReadShellTest extends TestCase {
46-
4749
/**
4850
* Fixtures used in this test case
4951
*
5052
* @var array
5153
*/
52-
public $fixtures = [
53-
];
54+
public $fixtures = [];
5455

5556
/**
5657
* Acts as an accumulator for output produced by the Shell.
5758
*
5859
* @var array
5960
* @see ::initSUIT()
6061
*/
61-
public $output = [
62-
];
62+
public $output = [];
6363

6464
public static $datasources = [
6565
'sample1' => [
@@ -88,10 +88,10 @@ class ConfigReadShellTest extends TestCase {
8888
*/
8989
public static function setUpBeforeClass() {
9090
// Prime the ConnectionManager with some configs.
91-
\Cake\Datasource\ConnectionManager::config(self::$datasources);
91+
ConnectionManager::config(self::$datasources);
9292

9393
// Prime the security salt.
94-
\Cake\Utility\Security::salt(self::$salt);
94+
Security::salt(self::$salt);
9595
}
9696

9797
/**
@@ -101,10 +101,10 @@ public static function setUpBeforeClass() {
101101
*/
102102
public static function tearDownAfterClass() {
103103
foreach (self::$datasources as $ds => $configs) {
104-
\Cake\Datasource\ConnectionManager::drop($ds);
104+
ConnectionManager::drop($ds);
105105
}
106106

107-
\Cake\Utility\Security::salt('');
107+
Security::salt('');
108108
}
109109

110110
/**
@@ -163,7 +163,7 @@ protected function getSUTClassName() {
163163
// -> ConfigRead\Test\TestCase\Shell\ConfigReadShellTest
164164

165165
$testingOverrideClass = preg_replace(
166-
'/^(.*)\\\([^\\\]+)Test$/',
166+
"/^(.*)\\\([^\\\]+)Test$/",
167167
'\1\\\Test\2',
168168
$testCaseClass
169169
); // -> ConfigRead\Test\TestCase\Shell\TestConfigReadShell
@@ -175,7 +175,7 @@ protected function getSUTClassName() {
175175
); // -> ConfigRead\Shell\ConfigReadShell
176176

177177
$this->classBasename = preg_replace(
178-
'/^.*\\\([^\\\]+)$/',
178+
"/^.*\\\([^\\\]+)$/",
179179
'\1',
180180
$testedClass
181181
); // -> ConfigReadShell
@@ -430,7 +430,7 @@ public function testMainSerializedIntegration($args, $expected, $msg = '') {
430430
'one' => 1,
431431
'two' => '2',
432432
3 => 'three',
433-
'stdClass' => (new \StdClass()),
433+
'stdClass' => (new StdClass()),
434434
],
435435
];
436436

0 commit comments

Comments
 (0)