require packages

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Eno
Reply | Threaded
Open this post in threaded view
|

require packages

Eno

Under Amber 0.12 new artitecture, My webpage was coded by guess and try and error:

<head>
    <title>Amber Smalltalk</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <meta name="author" content="Nicolas Petton"/>
    <script type='text/javascript' src='../../support/amber.js'></script>
    <script type='text/javascript' src='../../support/requirejs/require.min.js'></script>
</head>

<body>
<script type='text/javascript'>
    require(
        [ "../../support/devel" , "../tk_core/TkNeuro" , "./tk_core/TkNeuro2" , "./tk_core/TkNeuro1"  ],
        function (smalltalk) {
            smalltalk.defaultAmdNamespace = "tk_core";
            smalltalk.initialize();
            smalltalk.Browser._open()
        }
    );
</script>

is it right?
the 'TkNeuro.js' in parent dir was supposed to be included since if I input  the file with wrong name, the page was halted. however, it coud not found on web ide. all the codes writted in the subdirectory are all written into it's namespace dir.

I think the original package/js path hierarchic artitecture  is good, since this way, I could put all the packages inside only one place and all the edited changes would be updated to the required pages.

Best regards,




--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: require packages

Herby Vojčík


EnoX1 wrote:

>
> Under Amber 0.12 new artitecture, My webpage was coded by guess and
> try and error:
>
> <head>
> <title>Amber Smalltalk</title>
> <meta http-equiv="content-type" content="text/html; "/>
> <meta name="author" content="Nicolas Petton"/>
> <script type='text/javascript' src='../../support/amber.js'></script>
> <script type='text/javascript'
> src='../../support/requirejs/require.min.js'></script>
> </head>
>
> <body>
> <script type='text/javascript'>
> require(
> [ "../../support/devel" , "../tk_core/TkNeuro" , "./tk_core/TkNeuro2"
> , "./tk_core/TkNeuro1" ],
> function (smalltalk) {
> smalltalk.defaultAmdNamespace = "tk_core";
> smalltalk.initialize();
> smalltalk.Browser._open()
> }
> );
> </script>
>
> is it right?

This pattern is not supported. Amber should be treated as external dependency of the project, that is, project should not be included in the amber dir. Amber SHOULD NOT be loaded as in your examples, using relative paths: amber.js provides m
apping to load it from its designated namespace 'amber'; in your example, "amber/devel".

The complete guide to loading amber project in the recommeded (read: supported) way is in this wiki page: https://github.com/amber-smalltalk/amber/wiki/How-to-load-amber

You should follow every point of it (have modules separated in their own locations, select a namespace for each of it, do the AMD config to map your namespaces to physical locations, use namespaced names for all amber packages and sets etc.) to have your loading process compatible and playing nice with other amber libs.

OTOH, the way amber is done now (as AMD modules), your are completely free to deploy in any other configuration, if you for any reason decide to customize the way your projects are deployed and loaded: in the previous version, you had to use custom loader of amber. Now you are just handed the bunch of AMD modules and you can load them as you wish. The only thing fixed now is the namespace of the amber m
odules (amber/xxx for set, amber_core/xxx for core packages, some others for supporting libraries); amber.js script does map the amber namespaces to the right locations for you. You can harness the power of AMD and combine amber with the rest of the ecosystem exactly as you see fit (this assumes familiarity with AMD/require.js; as for structure of amber, the mappings done in amber.js and the code of the sets (devel.js, helios.js, deploy.js) should be good start, probably enough to understand it).

> the 'TkNeuro.js' in parent dir was supposed to be included since if I
> input the file with wrong name, the page was halted. however, it coud
> not found on web ide. all the codes writted in the subdirectory are
> all written into it's namespace dir.
>
> I think the original package/js path hierarchic artitecture is good,
> since this way, I could put all the packages inside only one place and
> all the edited changes would be updated to the required pages.
>
> Best regards,

>
>
>
>

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Eno
Reply | Threaded
Open this post in threaded view
|

Re: require packages

Eno

I still could not catch the keypoint.

I moved the project to a new location out of the amber directory as you said, and write the index.html as follow:

<!DOCTYPE html>
<html>

<head>
    <title>Amber Smalltalk</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <meta name="author" content="Nicolas Petton"/>
    <script type='text/javascript' src='../amber/support/amber.js'></script>
    <script type='text/javascript' src='../amber/support/requirejs/require.min.js'></script>
</head>

<body>
<script type='text/javascript'>
    require(
        ["amber/devel"],
        function (smalltalk) {
            smalltalk.defaultAmdNamespace = "amber_core";
            smalltalk.initialize();

            smalltalk.Browser._open()
        }
    );
</script>
</body>
</html>

I run the server at the new project directory with: ''../amber/bin/amber serve --port 3000'''.

The amber system is in another directory now, so I  need to load the amber.js and require.js by using relative url .

The amber subest 'amber/devel' was remained the same in the requre parameter as the document said that it will be mapped automatically by the amber.js.

By this way simply without other functionality, the html was  not halted without functioning .

I don't know what's wrong? need great help and guidance.

Best regards.



Herby於 2013年11月13日星期三UTC+8下午6時59分29秒寫道:

This pattern is not supported. Amber should be treated as external dependency of the project, that is, project should not be included in the amber dir. Amber SHOULD NOT be loaded as in your examples, using relative paths: amber.js provides m
apping to load it from its designated namespace 'amber'; in your example, "amber/devel".

The complete guide to loading amber project in the recommeded (read: supported) way is in this wiki page: https://github.com/amber-smalltalk/amber/wiki/How-to-load-amber

You should follow every point of it (have modules separated in their own locations, select a namespace for each of it, do the AMD config to map your namespaces to physical locations, use namespaced names for all amber packages and sets etc.) to have your loading process compatible and playing nice with other amber libs.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Eno
Reply | Threaded
Open this post in threaded view
|

Re: require packages

Eno
Sorry, the condition resolved after moving the server running directory up to parent dir, so that both amber and my project dirs are all of it's
subdirectory. Then, the relatively paths understand the paths to retrieve the amber.js script.



EnoX1於 2013年11月14日星期四UTC+8上午10時48分03秒寫道:

I still could not catch the keypoint.

I moved the project to a new location out of the amber directory as you said, and write the index.html as follow:

<!DOCTYPE html>
<html>

<head>
    <title>Amber Smalltalk</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <meta name="author" content="Nicolas Petton"/>
    <script type='text/javascript' src='../amber/support/amber.js'></script>
    <script type='text/javascript' src='../amber/support/requirejs/require.min.js'></script>
</head>

<body>
<script type='text/javascript'>
    require(
        ["amber/devel"],
        function (smalltalk) {
            smalltalk.defaultAmdNamespace = "amber_core";
            smalltalk.initialize();

            smalltalk.Browser._open()
        }
    );
</script>
</body>
</html>

I run the server at the new project directory with: ''../amber/bin/amber serve --port 3000'''.

The amber system is in another directory now, so I  need to load the amber.js and require.js by using relative url .

The amber subest 'amber/devel' was remained the same in the requre parameter as the document said that it will be mapped automatically by the amber.js.

By this way simply without other functionality, the html was  not halted without functioning .

I don't know what's wrong? need great help and guidance.

Best regards.



Herby於 2013年11月13日星期三UTC+8下午6時59分29秒寫道:

This pattern is not supported. Amber should be treated as external dependency of the project, that is, project should not be included in the amber dir. Amber SHOULD NOT be loaded as in your examples, using relative paths: amber.js provides m
apping to load it from its designated namespace 'amber'; in your example, "amber/devel".

The complete guide to loading amber project in the recommeded (read: supported) way is in this wiki page: https://github.com/amber-smalltalk/amber/wiki/How-to-load-amber

You should follow every point of it (have modules separated in their own locations, select a namespace for each of it, do the AMD config to map your namespaces to physical locations, use namespaced names for all amber packages and sets etc.) to have your loading process compatible and playing nice with other amber libs.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: require packages

Herby Vojčík
In reply to this post by Eno


EnoX1 wrote:
>
> I still could not catch the keypoint.
>
> I moved the project to a new location out of the amber directory as you
> said, and write the index.html as follow:

Everything seems ok with this index.html except few little things, see
below.

> <!DOCTYPE html>
> <html>
>
> <head>
> <title>Amber Smalltalk</title>
> <meta http-equiv="content-type" content="text/html; "/>
> <meta name="author" content="Nicolas Petton"/>
> <script type='text/javascript' src='../amber/support/amber.js'></script>
> <script type='text/javascript'
> src='../amber/support/requirejs/require.min.js'></script>
> </head>
>
> <body>
> <script type='text/javascript'>

You are still missing the mappings for your project. Amber.js only maps
amber for you.

> require(
> ["amber/devel"],

Plus your own code. This only loads amber. If you want to include your
packages, you should add other paths like
"com_mycompany_myproject/Package1", "com_mycompany_myproject/Package2".

> function (smalltalk) {
> smalltalk.defaultAmdNamespace = "amber_core";

Not "amber_core", but "com_mycompany_myproject". You are developing your
project, not amber itself, do you?

> smalltalk.initialize();
>
> smalltalk.Browser._open()
> }
> );
> </script>
> </body>
> </html>
>
> I run the server at the new project directory with: ''../amber/bin/amber
> serve --port 3000'''.
>
> The amber system is in another directory now, so I need to load the
> amber.js and require.js by using relative url .
>
> The amber subest 'amber/devel' was remained the same in the requre
> parameter as the document said that it will be mapped automatically by
> the amber.js.
>
> By this way simply without other functionality, the html was not halted
> without functioning .
>
> I don't know what's wrong? need great help and guidance.
>
> Best regards.
>
>
>
> Herby於 2013年11月13日星期三UTC+8下午6時59分29秒寫道:
>
>
>     This pattern is not supported. Amber should be treated as external
>     dependency of the project, that is, project should not be included
>     in the amber dir. Amber SHOULD NOT be loaded as in your examples,
>     using relative paths: amber.js provides m
>     apping to load it from its designated namespace 'amber'; in your
>     example, "amber/devel".
>
>     The complete guide to loading amber project in the recommeded (read:
>     supported) way is in this wiki page:
>     https://github.com/amber-smalltalk/amber/wiki/How-to-load-amber
>     <https://github.com/amber-smalltalk/amber/wiki/How-to-load-amber>
>
>     You should follow every point of it (have modules separated in their
>     own locations, select a namespace for each of it, do the AMD config
>     to map your namespaces to physical locations, use namespaced names
>     for all amber packages and sets etc.) to have your loading process
>     compatible and playing nice with other amber libs.
>
> --
> You received this message because you are subscribed to the Google
> Groups "amber-lang" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [hidden email].
> For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.