Search code examples
rubyfastlanerexml

I want to use REXML in Fastfile, but when I include in Fastfile doesn't work


Using Rexml in Fastfile, but fastlane can't recognize include, so I can't include Rexml module.

here is the error:

[!] Could not find action, lane or variable 'include'. Check out the documentation for more details: https://docs.fastlane.tools/actions

here is my code in Fastfile

#!/usr/bin/ruby
require 'rexml/document'
include REXML

Solution

  • using:

    require "rexml/document"
    file = File.new( "movie.xml" )
    xmldoc = REXML::Document.new file
    

    instead of:

    #!/usr/bin/ruby -w
    require 'rexml/document' 
    
    # include REXML
    xmlfile = File.new("movie.xml")
    xmldoc = rexml.Document.new(xmlfile)
    

    solve my problem, but I still don't know why fastlane can't recognize include.