Commit 2ddaf532 authored by Nick Poulden's avatar Nick Poulden
Browse files

Use Touch source and examples from parent directory when building in 'export' mode

parent c62f9ee7
Loading
Loading
Loading
Loading
+25 −1
Original line number Diff line number Diff line
@@ -254,6 +254,29 @@ class JsDuckRunner
    @options += extract_jsb_build_files("#{@sdk_dir}/touch/touch.jsb3")
  end

  def set_touch2_src
    relative_touch_path = "../"
    touch_iframe = "template-min/touchIframe.html";

    ["template-min/touchIframe.html", "template-min/touch-welcome.html"].each do |file|
      html = IO.read(file);

      touch_src_re = /((src|href)="touch)/m
      out = []

      html.each_line do |line|
        out << line.sub(/((src|href)="touch\/)/, '\2="' + relative_touch_path)
      end

      File.open(file, 'w') {|f| f.write(out) }
    end

    @options += [
      "--welcome", "template-min/touch-welcome.html",
      "--body-html", '<script type="text/javascript">Docs.exampleBaseUrl = "' + relative_touch_path + 'examples/";</script>'
    ]
  end

  def add_animator
    head_html = <<-EOHTML
      <link rel="canonical" href="http://docs.sencha.com/animator/1-0/" />
@@ -468,10 +491,11 @@ task :touch2, [:mode] => :sass do |t, args|
  runner.add_touch2
  runner.add_debug if mode == "debug"
  runner.add_touch2_export_notice if mode == "export"
  runner.set_touch2_src if mode == "export"
  runner.add_seo if mode == "debug" || mode == "live"
  runner.run

  runner.copy_touch2_build
  runner.copy_touch2_build if mode != "export"
end

desc "Run JSDuck JSON Export (for internal use at Sencha)\n" +
+3 −1
Original line number Diff line number Diff line
@@ -14,7 +14,9 @@ Ext.define('Docs.view.examples.Index', {

    initComponent: function() {
        this.cls += Docs.touchExamplesUi ? " touch-examples-ui" : "";
        var baseUrl = Docs.touchExamplesUi ? "touch/examples" : "extjs/examples/shared/screens";
        var touchExampleRoot = Docs.exampleBaseUrl ? Docs.exampleBaseUrl : "touch/examples";

        var baseUrl = Docs.touchExamplesUi ? touchExampleRoot : "extjs/examples/shared/screens";

        this.items = [
            { xtype: 'container', html: '<h1 class="eg">Examples</h1>' },
+6 −1
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ Ext.define('Docs.view.examples.TouchContainer', {
    cls: 'example-container iScroll',
    autoScroll: true,
    bodyPadding: '10 0 5 0',
    exampleBaseUrl: "touch/examples/",

    initComponent: function() {
        this.dockedItems = [{
@@ -39,6 +40,10 @@ Ext.define('Docs.view.examples.TouchContainer', {
            ].join('')
        }];

        if (Docs.exampleBaseUrl) {
            this.exampleBaseUrl = Docs.exampleBaseUrl;
        }

        this.callParent(arguments);
    },

@@ -49,7 +54,7 @@ Ext.define('Docs.view.examples.TouchContainer', {
    load: function(example) {
        this.title = example.text + " Example";
        this.device = Ext.create('Docs.view.examples.Device', {
            url: "touch/examples/" + example.url,
            url: this.exampleBaseUrl + example.url,
            device: example.device || "phone",
            orientation: example.orientation || "landscape"
        });