fastlane / fastfile-parser

Convert the Fastfile to a JSON file
https://fastlane.tools
MIT License
7 stars 5 forks source link

Lint n Parse #2

Closed hjanuschka closed 6 years ago

hjanuschka commented 7 years ago

BASED on https://github.com/fastlane/fastlane/pull/7448

TODO:

if this should be merged back, don't forget to fix import_from_git -> https://github.com/fastlane/fastlane/pull/7448/files#diff-11aee09f56b948ea1bed26eec91ee153

run with:

bundle exec ruby cli.rb examples/Fastfile1

bildschirmfoto 2017-03-14 um 11 22 23

json:

Example fastfile uses ${variables} like:

asdf = 123
fastlane_version "2.0.0 #{asdf} #{asdf+232}"
{
  "lint": {
    "info": [
      {
        "linenr": "Fastfile:21",
        "note": "Name of the lane `appstore` already taken by action `appstore`"
      }
    ],
    "error": [
      {
        "linenr": "Fastfile:22",
        "note": "'slack'  failed with:  `Could not find option 'something' in the list of available options: message, channel, use_webhook_configured_username_and_icon, slack_url, username, icon_url, payload, default_payloads, attachment_properties, success`"
      },
      {
        "linenr": "Fastfile:13",
        "note": "'gym'  failed with:  `Could not find option 'force' in the list of available options: workspace, project, scheme, clean, output_directory, output_name, configuration, silent, codesigning_identity, include_symbols, include_bitcode, use_legacy_build_api, export_method, export_options, export_xcargs, skip_build_archive, build_path, archive_path, derived_data_path, result_bundle, buildlog_path, sdk, toolchain, provisioning_profile_path, destination, export_team_id, xcargs, xcconfig, suppress_xcode_output, disable_xcpretty, xcpretty_test_format, xcpretty_formatter, xcpretty_report_junit, xcpretty_report_html, xcpretty_report_json, xcpretty_utf`"
      }
    ]
  },
  "map": {
    "default": {
      "default": {
        "actions": [
          {
            "action": "fastlane_version",
            "parameters": "2.0.0 $__dynamic__0$ $__dynamic__1$"
          },
          {
            "action": "git_pull",
            "parameters": null
          }
        ]
      },
      "beta": {
        "actions": [
          {
            "action": "sigh",
            "parameters": null
          },
          {
            "action": "gym",
            "parameters": {
              "scheme": "Example",
              "force": true,
              "some": "$__dynamic__2$"
            }
          }
        ]
      }
    },
    "ios": {
      "beta": {
        "actions": [
          {
            "action": "cocoapods",
            "parameters": null
          }
        ]
      },
      "appstore": {
        "actions": [
          {
            "action": "slack",
            "parameters": {
              "something": true,
              "more": "$__dynamic__3$"
            }
          },
          {
            "action": "slack",
            "parameters": null
          },
          {
            "action": "slack",
            "parameters": {
              "success": false
            }
          }
        ]
      }
    },
    "android": {
      "play": {
        "actions": [
          {
            "action": "gradle",
            "parameters": {
              "task": "yolo"
            }
          }
        ]
      }
    }
  },
  "variables": {
    "$__dynamic__0$": "direct",
    "$__dynamic__1$": "direct",
    "$__dynamic__2$": "some",
    "$__dynamic__3$": "more"
  }
}
hjanuschka commented 7 years ago

updated the pull to handle dynamic variables :) to be able to substitute them later on via json.

see updated body.

hjanuschka commented 7 years ago

@KrauseFx how'd we proceed with that?

googlebot commented 7 years ago

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.

googlebot commented 7 years ago

CLAs look good, thanks!

KrauseFx commented 6 years ago

Closing this for now, as this is already in master now, thanks @hjanuschka 👍

hjanuschka commented 6 years ago

@KrauseFx you sure? - doesn't look like if you look at parser.rb compared to the PR. there was quiet some stuff in it with variable dict. and so on. let me know if i should continue this?! and make it mergeable.