Uploaded image for project: 'Alloy'
  1. Alloy
  2. ALOY-783

Alloy: config.json environment-specific global values are ignored, always returning the env:development value

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: Alloy 1.2.0, 2013 Sprint 17
    • Fix Version/s: Alloy 1.2.0, 2013 Sprint 17
    • Component/s: None
    • Environment:

      Titanium SDK 3.1.2.v20130812225629
      Alloy 1.2.0-alpha6
      Appcelerator Studio 3.1.2.201308091728
      CLI 3.1.2-alpha
      Node 0.10.13
      LiveView: 0.1.32

      Description

      Problem description

      Environment specific global values are not respected, the value returned is always the one relative to the 'env:development'

      Steps to reproduce

      1. Run the sample code

      config.json

      {
      	"global": {
      		"key": "defaultValue",
      		"anotherKey": 12345
      	},
      	"env:development": {
      		"environment": "development"
      	},
      	"env:test": {
      		"environment": "test"
      	},
      	"env:production": {
      		"environment": "production"
      	},
      	"os:ios": {
      		"key": "iosValue"
      	},
      	"os:android": {
      		"key": "androidValue"
      	},
      	"dependencies": {}
      }
      

      index.xml

      <Alloy>
          <Window id="win" backgroundColor="white" exitOnClose="true" fullscreen="false" title="ScrollView Demo">
              <View id="view" backgroundColor="#336699">
              	<Label id='label1' top='20'>platform key: </Label>
              	<Label id='label2' top='80'>global key: </Label>
              	<Label id='label3' top='140'>environment: </Label>
              </View>
          </Window>
      </Alloy>
      

      index.js

      // Alloy.Globals.someGlobalObject = { key: 'value' };
       
      $.label1.text =  $.label1.text + ' ' + Alloy.CFG.key;
      $.label2.text =  $.label2.text + ' ' + Alloy.CFG.anotherKey;
      $.label3.text =  $.label3.text + ' ' + Alloy.CFG.environment;
       
       
      if ((Alloy.isHandheld) && (OS_IOS)){
      	alert('iphone handheld!')
      }
      else if ((Alloy.isHandheld) && (OS_ANDROID)){
      	alert('android handheld')
      }
      else if ((Alloy.isTablet)&&(OS_IOS)){
      	alert('ipad tablet!')
      }
      else if ((Alloy.isTablet)&&(OS_ANDROID)){
      	alert('android tablet')
      }
      else if (OS_MOBILEWEB){
      	alert('mobileweb!')
      }
      else {
      	alert("I don't know!'")
      }
       
      $.win.open();
      
      

      2. Build for packaging (tested on Android)
      3. Install the package on device and run the app

      Result: 'environment: development' label is displayed
      Expected result: "environment: production" label should be displayed.

      Note

      This is not reproducible on Alloy 1.1.3, so is a regression.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                tlukasavage Tony Lukasavage
                Reporter:
                fcasali Federico Casali
              • Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Source Code