@@ -1027,6 +1027,62 @@ exports.issueCommand = issueCommand;
1027
1027
1028
1028
module . exports = require ( "child_process" ) ;
1029
1029
1030
+ /***/ } ) ,
1031
+
1032
+ /***/ 335 :
1033
+ /***/ ( function ( __unusedmodule , exports , __webpack_require__ ) {
1034
+
1035
+ "use strict" ;
1036
+
1037
+ var __createBinding = ( this && this . __createBinding ) || ( Object . create ? ( function ( o , m , k , k2 ) {
1038
+ if ( k2 === undefined ) k2 = k ;
1039
+ Object . defineProperty ( o , k2 , { enumerable : true , get : function ( ) { return m [ k ] ; } } ) ;
1040
+ } ) : ( function ( o , m , k , k2 ) {
1041
+ if ( k2 === undefined ) k2 = k ;
1042
+ o [ k2 ] = m [ k ] ;
1043
+ } ) ) ;
1044
+ var __setModuleDefault = ( this && this . __setModuleDefault ) || ( Object . create ? ( function ( o , v ) {
1045
+ Object . defineProperty ( o , "default" , { enumerable : true , value : v } ) ;
1046
+ } ) : function ( o , v ) {
1047
+ o [ "default" ] = v ;
1048
+ } ) ;
1049
+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
1050
+ if ( mod && mod . __esModule ) return mod ;
1051
+ var result = { } ;
1052
+ if ( mod != null ) for ( var k in mod ) if ( k !== "default" && Object . prototype . hasOwnProperty . call ( mod , k ) ) __createBinding ( result , mod , k ) ;
1053
+ __setModuleDefault ( result , mod ) ;
1054
+ return result ;
1055
+ } ;
1056
+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
1057
+ exports . getVersionFromPodfile = exports . getVersionFromPodfileLine = void 0 ;
1058
+ const fs = __importStar ( __webpack_require__ ( 747 ) ) ;
1059
+ const path = __importStar ( __webpack_require__ ( 622 ) ) ;
1060
+ const os_1 = __webpack_require__ ( 87 ) ;
1061
+ const podVersionRegex = / ^ C O C O A P O D S : ( [ \d . ] + ( b e t a | r c ) ? \. ? \d * ) $ / i;
1062
+ exports . getVersionFromPodfileLine = ( line ) => {
1063
+ const match = line . match ( podVersionRegex ) ;
1064
+ if ( match && match . length >= 2 ) {
1065
+ return match [ 1 ] . trim ( ) ;
1066
+ }
1067
+ return null ;
1068
+ } ;
1069
+ exports . getVersionFromPodfile = ( podfilePath ) => {
1070
+ const absolutePath = path . resolve ( podfilePath ) ;
1071
+ if ( ! fs . existsSync ( absolutePath ) ) {
1072
+ throw new Error ( `Podfile is not found on path '${ absolutePath } '` ) ;
1073
+ }
1074
+ const fileContent = fs . readFileSync ( absolutePath ) ;
1075
+ const podLines = fileContent . toString ( ) . split ( os_1 . EOL ) ;
1076
+ for ( const podLine of podLines ) {
1077
+ const matchedVersion = exports . getVersionFromPodfileLine ( podLine ) ;
1078
+ if ( matchedVersion ) {
1079
+ return matchedVersion ;
1080
+ }
1081
+ }
1082
+ throw new Error ( `Podfile '${ absolutePath } ' doesn't contain COCOAPODS version.` ) ;
1083
+ } ;
1084
+
1085
+
1030
1086
/***/ } ) ,
1031
1087
1032
1088
/***/ 357 :
@@ -1623,9 +1679,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
1623
1679
} ;
1624
1680
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
1625
1681
exports . CocoapodsInstaller = void 0 ;
1626
- const fs = __importStar ( __webpack_require__ ( 747 ) ) ;
1627
- const path = __importStar ( __webpack_require__ ( 622 ) ) ;
1628
- const os_1 = __webpack_require__ ( 87 ) ;
1629
1682
const exec = __importStar ( __webpack_require__ ( 986 ) ) ;
1630
1683
const core = __importStar ( __webpack_require__ ( 470 ) ) ;
1631
1684
class CocoapodsInstaller {
@@ -1643,21 +1696,6 @@ class CocoapodsInstaller {
1643
1696
await exec . exec ( "gem" , [ "install" , "cocoapods" , ...versionArguments , "--no-document" ] ) ;
1644
1697
core . info ( `Cocoapods ${ versionSpec } has been installed successfully` ) ;
1645
1698
}
1646
- static getVersionFromPodfile ( podfilePath ) {
1647
- const absolutePath = path . resolve ( podfilePath ) ;
1648
- if ( ! fs . existsSync ( absolutePath ) ) {
1649
- throw new Error ( `Podfile is not found on path '${ absolutePath } '` ) ;
1650
- }
1651
- const fileContent = fs . readFileSync ( absolutePath ) ;
1652
- const podLines = fileContent . toString ( ) . split ( os_1 . EOL ) ;
1653
- for ( const podLine of podLines ) {
1654
- const match = podLine . match ( this . podVersionRegex ) ;
1655
- if ( match && match . length >= 2 ) {
1656
- return match [ 1 ] . trim ( ) ;
1657
- }
1658
- }
1659
- throw new Error ( `Podfile '${ absolutePath } ' doesn't contain COCOAPODS version.` ) ;
1660
- }
1661
1699
static async getInstalledVersion ( ) {
1662
1700
let stdOutput = "" ;
1663
1701
const options = {
@@ -1675,7 +1713,6 @@ class CocoapodsInstaller {
1675
1713
}
1676
1714
}
1677
1715
exports . CocoapodsInstaller = CocoapodsInstaller ;
1678
- CocoapodsInstaller . podVersionRegex = / ^ C O C O A P O D S : ( [ \d . ] + ) $ / i;
1679
1716
1680
1717
1681
1718
/***/ } ) ,
@@ -1707,6 +1744,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
1707
1744
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
1708
1745
const core = __importStar ( __webpack_require__ ( 470 ) ) ;
1709
1746
const installer_1 = __webpack_require__ ( 749 ) ;
1747
+ const podfile_parser_1 = __webpack_require__ ( 335 ) ;
1710
1748
const run = async ( ) => {
1711
1749
try {
1712
1750
if ( process . platform !== "darwin" && process . platform !== "linux" ) {
@@ -1715,11 +1753,11 @@ const run = async () => {
1715
1753
let versionSpec = core . getInput ( "version" , { required : false } ) ;
1716
1754
const podfilePath = core . getInput ( "podfile-path" , { required : false } ) ;
1717
1755
if ( ! ! versionSpec === ! ! podfilePath ) {
1718
- throw new Error ( "Invalid input parameters usage. Only 'version' or 'podfile-path' should be defined " ) ;
1756
+ throw new Error ( "Invalid input parameters usage. Either 'version' or 'podfile-path' should be specified. Not the both ones. " ) ;
1719
1757
}
1720
1758
if ( ! versionSpec ) {
1721
1759
core . debug ( "Reading Podfile to determine the version of Cocoapods..." ) ;
1722
- versionSpec = installer_1 . CocoapodsInstaller . getVersionFromPodfile ( podfilePath ) ;
1760
+ versionSpec = podfile_parser_1 . getVersionFromPodfile ( podfilePath ) ;
1723
1761
core . info ( `Podfile points to the Cocoapods ${ versionSpec } ` ) ;
1724
1762
}
1725
1763
await installer_1 . CocoapodsInstaller . install ( versionSpec ) ;
0 commit comments