Skip to content

Commit

Permalink
Merge pull request #5 from ortus-boxlang/development
Browse files Browse the repository at this point in the history
v1.3.0
  • Loading branch information
lmajano authored Sep 4, 2024
2 parents a5af055 + 27b6e78 commit 28c24ff
Show file tree
Hide file tree
Showing 15 changed files with 520 additions and 95 deletions.
41 changes: 24 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This workflow is used to build releases
# It can also be called by other workflows to reuse the release flow.
name: BoxLang Compat Module Release
name: Release

on:
# If you push to main this will trigger a stable release
Expand All @@ -22,11 +22,11 @@ on:
workflow_dispatch:

env:
MODULE_ID: bx-compat
SNAPSHOT: ${{ inputs.snapshot || false }}
MODULE_ID: ${{ github.event.repository.name }}
JDK: 21
GRADLE: 8.7
BUILD_ID: ${{ github.run_number }}
SNAPSHOT: ${{ inputs.snapshot || false }}

jobs:
#############################################
Expand Down Expand Up @@ -64,9 +64,16 @@ jobs:
id: current_version
run: |
# Read Version from gradle.properties
echo "VERSION=`grep '^version=' gradle.properties | cut -d'=' -f2`" >> $GITHUB_ENV
TMPVERSION=$(grep '^version=' gradle.properties | cut -d'=' -f2)
# Replace existing prerelease identifier with -snapshot or append -snapshot if none exists
# If we are on the development branch, we always append -snapshot
if [[ "${{ github.ref }}" == "refs/heads/development" ]]; then
TMPVERSION=$(echo $TMPVERSION | sed 's/-.*$//')-snapshot
fi
# Set the version in the environment
echo "VERSION=$TMPVERSION" >> $GITHUB_ENV
# Branche
# Branch
echo "Github Ref is $GITHUB_REF"
echo "BRANCH=main" >> $GITHUB_ENV
Expand All @@ -87,8 +94,8 @@ jobs:
run: |
npm install -g markdownlint-cli
markdownlint changelog.md --fix
./gradlew downloadBoxLang
./gradlew build -x test --stacktrace --console=plain
gradle downloadBoxLang
gradle build -x test --stacktrace --console=plain
- name: Commit Changelog [unreleased] with latest version
uses: EndBug/add-and-commit@v9.1.4
Expand Down Expand Up @@ -127,16 +134,16 @@ jobs:
SOURCE_DIR: "build/distributions"
DEST_DIR: "ortussolutions/boxlang-modules/${{ env.MODULE_ID }}/${{ env.VERSION }}"

# - name: Upload API Docs to S3
# uses: jakejarvis/s3-sync-action@master
# with:
# args: --acl public-read
# env:
# AWS_S3_BUCKET: "apidocs.ortussolutions.com"
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_SECRET }}
# SOURCE_DIR: "build-coldbox/apidocs"
# DEST_DIR: ""
- name: Upload API Docs to S3
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read
env:
AWS_S3_BUCKET: "apidocs.ortussolutions.com"
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_SECRET }}
SOURCE_DIR: "build/docs/javadoc"
DEST_DIR: "boxlang-modules/${{ env.MODULE_ID }}/${{ env.VERSION }}"

- name: Publish to ForgeBox
run: |
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Before submitting your contribution, please make sure to take a moment and read

## Code Of Conduct

This project is open source, and as such, the maintainers give their free time to build and maintain the source code held within. They make the code freely available in the hope that it will be of use to other developers and/or businesses. Please be considerate towards maintainers when raising issues or presenting pull requests. **We all follow the Golden Rule: Do to others as you want them to do to you.**
This project is open-source, and as such, the maintainers give their free time to build and maintain the source code held within. They make the code freely available in the hope that it will be of use to other developers and/or businesses. Please be considerate towards maintainers when raising issues or presenting pull requests. **We all follow the Golden Rule: Do to others as you want them to do to you.**

- As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
- Participants will be tolerant of opposing views.
Expand Down
10 changes: 9 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ ext {
branch = System.getenv( 'BRANCH' ) ?: 'development'
}

if (branch == 'development') {
// If the branch is 'development', ensure the version ends with '-snapshot'
// This replaces any existing prerelease identifier with '-snapshot'
version = version.contains('-') ? version.replaceAll(/-.*/, '-snapshot') : "${version}-snapshot"
boxlangVersion = boxlangVersion.contains('-') ? boxlangVersion.replaceAll(/-.*/, '-snapshot') : "${boxlangVersion}-snapshot"
}

repositories {
mavenLocal()
mavenCentral()
Expand All @@ -32,10 +39,11 @@ dependencies {
// Until BoxLang is published to Maven Central
// Look for it in the local build directory
// You must run `./gradle build -x test` in the BoxLang project
compileOnly files( '../../boxlang/build/distributions/boxlang-' + boxlangVersion + '-all.jar' )
compileOnly files( '../boxlang/build/libs/boxlang-' + boxlangVersion + '-all.jar' )
compileOnly files( 'src/test/resources/libs/boxlang-' + boxlangVersion + '-all.jar' )

// Testing Dependencies
testImplementation files( '../boxlang/build/libs/boxlang-' + boxlangVersion + '-all.jar' )
testImplementation files( 'src/test/resources/libs/boxlang-' + boxlangVersion + '-all.jar' )
testImplementation "org.junit.jupiter:junit-jupiter:5.+"
testImplementation "org.mockito:mockito-core:5.+"
Expand Down
23 changes: 23 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- BL-491 New module settings:

```js
// The CF -> BL AST transpiler settings
// The transpiler is in the core, but will eventually live in this module, so the settings are here.
transpiler = {
// Turn foo.bar into foo.BAR
upperCaseKeys = true,
// Add output=true to functions and classes
forceOutputTrue = true,
// Merged doc comments into actual function, class, and property annotations
mergeDocsIntoAnnotations = true
}
```

- BL-449 preserve single quotes
- Added more docs
- Added new BIFS: `getVariable()`, `setVariable()`, `getComponentMetadata()`, `getMetaData()`, `deleteClientVariable()`, `getClientVariablesList()`

## [1.2.0] - 2024-08-09

### Added

- Module should coerce null values to empty string if the `queryNullToEmpty` is set to true, which is the default
- `objectLoad(), and objectSave()` aliases for `objectSerialize()` and `objectDeserialize()` respectively.

Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Gradle Properties
version=1.2.0
group=io.boxlang
#Fri Aug 09 20:10:30 UTC 2024
boxlangVersion=1.0.0-beta9
jdkVersion=21
version=1.3.0
group=io.boxlang
8 changes: 6 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ The valid engines are `adobe` or `lucee`. By default the engine is `lucee`. Al

Depending on which engine you select an interceptor will be loaded that will seed the `server` scope with the appropriate engine details.

## Contributed Functions
## Contributed BIFs

The compat module will contribute the following functions globally:
The compat module will contribute the following built-in functions globally:

* `cacheClear` - Learn more here: https://cfdocs.org/cacheClear
* `cacheCount` - Learn more here: https://cfdocs.org/cacheCount
Expand All @@ -73,8 +73,12 @@ The compat module will contribute the following functions globally:
* `cacheRemove` - Learn more here: https://cfdocs.org/cacheRemove
* `cacheRemoveAll` - Learn more here: https://cfdocs.org/cacheRemoveAll
* `cacheSetProperties` - Learn more here: https://cfdocs.org/cacheSetProperties
* `deleteClientVariable` - Learn more here: https://cfdocs.org/deleteClientVariable
* `getClientVariablesList` - Learn more here: https://cfdocs.org/getClientVariablesList
* `getComponentMetadata` - Learn more here: https://cfdocs.org/getComponentMetadata
* `getMetaData` - Learn more here: https://cfdocs.org/getMetaData
* `getVariable` - Learn more here: https://cfdocs.org/getVariable
* `setVariable` - Learn more here: https://cfdocs.org/setVariable
* `systemOutput` - Learn more here: https://cfdocs.org/systemOutput


Expand Down
70 changes: 0 additions & 70 deletions src/build/SetupTemplate.cfc

This file was deleted.

12 changes: 11 additions & 1 deletion src/main/bx/ModuleConfig.bx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,17 @@
isAdobe = false,
// This simulates the query to empty value that Adobe/Lucee do when NOT in full null support
// We default it to true to simulate Adobe/Lucee behavior
queryNullToEmpty = true
queryNullToEmpty = true,
// The CF -> BL AST transpiler settings
// The transpiler is in the core, but will eventually live in this module, so the settings are here.
transpiler = {
// Turn foo.bar into foo.BAR
upperCaseKeys = true,
// Add output=true to functions and classes
forceOutputTrue = true,
// Merged doc comments into actual function, class, and property annotations
mergeDocsIntoAnnotations = true
}
};

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/**
* [BoxLang]
*
* Copyright [2023] [Ortus Solutions, Corp]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ortus.boxlang.modules.compat.bifs.struct;

import java.util.Set;

import ortus.boxlang.runtime.bifs.BIF;
import ortus.boxlang.runtime.bifs.BoxBIF;
import ortus.boxlang.runtime.context.IBoxContext;
import ortus.boxlang.runtime.scopes.ArgumentsScope;
import ortus.boxlang.runtime.scopes.IScope;
import ortus.boxlang.runtime.scopes.Key;
import ortus.boxlang.runtime.types.Argument;
import ortus.boxlang.runtime.validation.Validator;

@BoxBIF
public class DeleteClientVariable extends BIF {

/**
* Name of client scope
*/
private static final Key clientKey = Key.of( "client" );

/**
* Constructor
*/
public DeleteClientVariable() {
super();
declaredArguments = new Argument[] {
new Argument( true, Argument.STRING, Key._NAME, Set.of( Validator.NON_EMPTY ) )
};
}

/**
* Deletes a client variable. Returns true if variable was successfully deleted; false if it was not deleted.
*
* @param context The context in which the BIF is being invoked.
* @param arguments Argument scope for the BIF.
*
* @argument.name The name of the variable to delete.
*
*/
public Object _invoke( IBoxContext context, ArgumentsScope arguments ) {
Key name = Key.of( arguments.getAsString( Key._NAME ) );

IScope clientScope = context.getScope( clientKey );
boolean existed = clientScope.containsKey( name );
clientScope.remove( name );
return existed;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* [BoxLang]
*
* Copyright [2023] [Ortus Solutions, Corp]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ortus.boxlang.modules.compat.bifs.struct;

import java.util.stream.Collectors;

import ortus.boxlang.runtime.bifs.BIF;
import ortus.boxlang.runtime.bifs.BoxBIF;
import ortus.boxlang.runtime.context.IBoxContext;
import ortus.boxlang.runtime.scopes.ArgumentsScope;
import ortus.boxlang.runtime.scopes.IScope;
import ortus.boxlang.runtime.scopes.Key;

@BoxBIF
public class GetClientVariablesList extends BIF {

/**
* Name of client scope
*/
private static final Key clientKey = Key.of( "client" );

/**
* Finds the client variables to which a page has write access. Comma-delimited list of non-read-only client variables
*
* @param context The context in which the BIF is being invoked.
* @param arguments Argument scope for the BIF.
*
*/
public Object _invoke( IBoxContext context, ArgumentsScope arguments ) {
IScope clientScope = context.getScope( clientKey );
return clientScope.getKeysAsStrings().stream().collect( Collectors.joining( "," ) );
}

}
Loading

0 comments on commit 28c24ff

Please sign in to comment.