Skip to content

Commit 68f162e

Browse files
committed
allowing multiple input values
1 parent 1492235 commit 68f162e

File tree

12 files changed

+2805
-2825
lines changed

12 files changed

+2805
-2825
lines changed

README.md

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
![Banner](banner.png)
22

3+
![Coverage](./badges/coverage.svg)
4+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5+
[![Releases](https://img.shields.io/github/v/release/MuriloChianfa/ioncube-encoder-action)](https://github.com/MuriloChianfa/ioncube-encoder-action/releases)
36
[![CI](https://github.com/MuriloChianfa/ioncube-encoder-action/actions/workflows/ci.yml/badge.svg)](https://github.com/MuriloChianfa/ioncube-encoder-action/actions/workflows/ci.yml)
47
[![GitHub Super-Linter](https://github.com/MuriloChianfa/ioncube-encoder-action/actions/workflows/linter.yml/badge.svg)](https://github.com/MuriloChianfa/ioncube-encoder-action/actions/workflows/linter.yml)
58
[![CodeQL](https://github.com/MuriloChianfa/ioncube-encoder-action/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/MuriloChianfa/ioncube-encoder-action/actions/workflows/codeql-analysis.yml)
6-
![Coverage](./badges/coverage.svg)
79

810
Automate and streamline IonCube encoding for your PHP project under Laravel,
911
Joomla, WordPress frameworks with this powerful GitHub Action. Encode your
@@ -118,11 +120,12 @@ jobs:
118120
- **_php-target-version_**: The PHP encoded files target version. _(default:
119121
8.2)_
120122
- **_arch_**: Architecture of target environment runner. _(default: 64)_
121-
- **_allow-reflection_**: Name or glob to funcions or classes for allow the
122-
reflection API. _(default: false)_
123+
- **_allow-reflection_**: Names or globs for functions or classes to allow the
124+
reflection API. Supports multiple values (space-separated). _(default: false)_
123125
- **_allow-reflection-all_**: Allow the reflection API at all the PHP code.
124126
_(default: false)_
125-
- **_encrypt_**: Name or glob to files to encrypt. _(default: false)_
127+
- **_encrypt_**: Names or globs to files to encrypt. Supports multiple values
128+
(space-separated). _(default: false)_
126129
- **_binary_**: Encode files in binary format. _(default: false)_
127130
- **_optimize_**: Level of encoding performance. _(default: more)_
128131
- **_no-doc-comments_**: Not allow doc comments on encoded files. _(default:
@@ -143,16 +146,47 @@ jobs:
143146
_(default: false)_
144147
- **_replace-target_**: Mode to replace target file/directory if not exists.
145148
_(default: false)_
146-
- **_copy_**: Path of files to just copy without encrypt or encode. _(default:
147-
'')_
148-
- **_ignore_**: Path of files to just ignore on ioncube walkthrough. _(default:
149-
'')_
150-
- **_skip_**: Path of files to just skip on ioncube walkthrough. _(default: '')_
149+
- **_copy_**: Patterns of files to copy without encrypt or encode. Supports
150+
multiple values (space-separated). _(default: '')_
151+
- **_ignore_**: Patterns of files to ignore on ioncube walkthrough. Supports
152+
multiple values (space-separated). _(default: '')_
153+
- **_skip_**: Patterns of files to skip on ioncube walkthrough. Supports
154+
multiple values (space-separated). _(default: '')_
151155
- **_obfuscate_**: PHP entities to obfuscate:
152156
all,locals,functions,methods,classes,linenos,none. _(default: 'none')_
153157
- **_obfuscation-key_**: Key to obfuscation method to apply on PHP entities.
154158
_(default: '')_
155159
160+
#### Using Multiple Values
161+
162+
Several inputs support multiple values (`copy`, `ignore`, `skip`, `encrypt`,
163+
`allow-reflection`). You can provide multiple patterns using different formats:
164+
165+
**Newline-separated (YAML multiline syntax):**
166+
167+
```yaml
168+
with:
169+
copy: |
170+
*.txt
171+
*.md
172+
*.json
173+
ignore: |
174+
*/cache/*
175+
*/logs/*
176+
*/temp/*
177+
```
178+
179+
**Comma-separated:**
180+
181+
```yaml
182+
with:
183+
copy: '*.txt,*.md,*.json'
184+
ignore: '*/cache/*,*/logs/*'
185+
```
186+
187+
When multiple values are provided, each pattern is passed as a separate flag to
188+
the IonCube encoder.
189+
156190
<hr>
157191

158192
> [!IMPORTANT]

__tests__/command.test.js

Lines changed: 82 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,21 @@ describe('Command Generation Tests', () => {
235235
}, 200000)
236236

237237
it('properly quotes copy pattern', async () => {
238+
mocks.getInputMock.mockImplementation(name => {
239+
if (name === 'trial') return 'true'
240+
if (name === 'copy') return '*.txt'
241+
return ''
242+
})
243+
244+
await main.run()
245+
246+
const encodingCommand = capturedCommands.find(cmd =>
247+
cmd.includes('ioncube_encoder')
248+
)
249+
expect(encodingCommand).toContain('--copy "*.txt"')
250+
}, 200000)
251+
252+
it('generates multiple --copy flags for space-separated patterns', async () => {
238253
mocks.getInputMock.mockImplementation(name => {
239254
if (name === 'trial') return 'true'
240255
if (name === 'copy') return '*.txt *.md'
@@ -246,7 +261,56 @@ describe('Command Generation Tests', () => {
246261
const encodingCommand = capturedCommands.find(cmd =>
247262
cmd.includes('ioncube_encoder')
248263
)
249-
expect(encodingCommand).toContain('--copy "*.txt *.md"')
264+
expect(encodingCommand).toContain('--copy "*.txt"')
265+
expect(encodingCommand).toContain('--copy "*.md"')
266+
}, 200000)
267+
268+
it('generates multiple --encrypt flags for space-separated patterns', async () => {
269+
mocks.getInputMock.mockImplementation(name => {
270+
if (name === 'trial') return 'true'
271+
if (name === 'encrypt') return '*.blade.php *.env.example'
272+
return ''
273+
})
274+
275+
await main.run()
276+
277+
const encodingCommand = capturedCommands.find(cmd =>
278+
cmd.includes('ioncube_encoder')
279+
)
280+
expect(encodingCommand).toContain('--encrypt "*.blade.php"')
281+
expect(encodingCommand).toContain('--encrypt "*.env.example"')
282+
}, 200000)
283+
284+
it('generates multiple --ignore flags for space-separated patterns', async () => {
285+
mocks.getInputMock.mockImplementation(name => {
286+
if (name === 'trial') return 'true'
287+
if (name === 'ignore') return '*/cache/* */logs/*'
288+
return ''
289+
})
290+
291+
await main.run()
292+
293+
const encodingCommand = capturedCommands.find(cmd =>
294+
cmd.includes('ioncube_encoder')
295+
)
296+
expect(encodingCommand).toContain('--ignore "*/cache/*"')
297+
expect(encodingCommand).toContain('--ignore "*/logs/*"')
298+
}, 200000)
299+
300+
it('generates multiple --skip flags for space-separated patterns', async () => {
301+
mocks.getInputMock.mockImplementation(name => {
302+
if (name === 'trial') return 'true'
303+
if (name === 'skip') return '*/vendor/* */node_modules/*'
304+
return ''
305+
})
306+
307+
await main.run()
308+
309+
const encodingCommand = capturedCommands.find(cmd =>
310+
cmd.includes('ioncube_encoder')
311+
)
312+
expect(encodingCommand).toContain('--skip "*/vendor/*"')
313+
expect(encodingCommand).toContain('--skip "*/node_modules/*"')
250314
}, 200000)
251315

252316
it('properly quotes ignore pattern', async () => {
@@ -439,7 +503,7 @@ describe('Command Generation Tests', () => {
439503
expect(encodingCommand).toContain('--allow-reflection-all')
440504
}, 200000)
441505

442-
it('includes --allow-reflection with pattern', async () => {
506+
it('includes --allow-reflection with single pattern', async () => {
443507
mocks.getInputMock.mockImplementation(name => {
444508
if (name === 'trial') return 'true'
445509
if (name === 'allow-reflection') return 'MyClass::*'
@@ -453,6 +517,22 @@ describe('Command Generation Tests', () => {
453517
)
454518
expect(encodingCommand).toContain('--allow-reflection MyClass::*')
455519
}, 200000)
520+
521+
it('generates multiple --allow-reflection flags for space-separated patterns', async () => {
522+
mocks.getInputMock.mockImplementation(name => {
523+
if (name === 'trial') return 'true'
524+
if (name === 'allow-reflection') return 'MyClass::* AnotherClass::method'
525+
return ''
526+
})
527+
528+
await main.run()
529+
530+
const encodingCommand = capturedCommands.find(cmd =>
531+
cmd.includes('ioncube_encoder')
532+
)
533+
expect(encodingCommand).toContain('--allow-reflection MyClass::*')
534+
expect(encodingCommand).toContain('--allow-reflection AnotherClass::method')
535+
}, 200000)
456536
})
457537

458538
describe('License Flags', () => {

0 commit comments

Comments
 (0)