my application is using Spring Boot, with 2 main modules main and test. In another directory on same level I have folder which contains script with database triggers which I need create in database before tests.
Here is my project structure:
src/
├── main
├── scripts (this is not module, only default folder)
│ └── custom_script.sql
└── test
└── persistent
└── TestConfiguration.java
Test configuration is only interface where I set some configuration for tests, currently contains following code:
#Sql("../../scripts/custom_script.sql")
public interface TestConfiguration {
}
This code didn't work, and custom_script.sql isn't executed. Can you tell me why, or what is the better to execute it?
I am trying to copy a file in gradle and rename it at the same time, where the new name of the file should be dependent of the name of the subfolder it was in.
My file structure looks like this for example:
├── apk
│ └── app-envTest-normalBuild-release.apk
├── logs
│ └── manifest-merger-envTest-normalBuild-release-report.txt
└── mapping
└── envTestNormalBuild
└── release
├── dump.txt
├── mapping.txt
├── seeds.txt
└── usage.txt
I'd like to copy the mapping.txt and rename it. The new name should be mapping-envTestNormalBuild.txt - i.e. should include the name of the subdirectory it was released in.
Can someone tell me if/how this is possible using the gradle copy+rename feature?
I have seen that the reverse is possible, i.e. copying a file like foo-bar.txt to a directory/path foo/bar.txt and similar.
You can try e.g.:
task clean {
doLast {
project.file('dest').deleteDir()
}
}
task cp(type: Copy) {
dependsOn clean
from 'mapping/envTestNormalBuild/release'
into 'dest'
include 'mapping.txt'
eachFile { fcp ->
fcp.name = "$fcp.file.parentFile.parentFile.name-$fcp.name"
}
}
A demo can be found here.
I am new to Magento 2...and trying to learn CODEPOOL in Magento 2. This is a very basic question regarding Magento 2 Folder Structure.Magento 2 is differ from other previous version like Magento 1.9.1,1.9.0 ...
Magento 2 is significantly different from Magento 1.X and s not backward compatible as well.
In Magento 2,
All Custom Modules will go in app/code
Module Name will be something similar to app/code/[Company]/[Module]
View of the module (layout XMLs, Template .phtmls, Module Javascripts, LESS, CSS and all related files) will now go inside the Module Folder itself, making the module is standalone and independant
No More codepools. Core team has written their own modules for functionalities and core code lives in [MAGE_ROOT]/vendor/magento/. for example Catalog Module is now at [MAGE_ROOT]/vendor/magento/module-catalog having the module name Magento_Catalog
Even the Magento themes are now coming as Modules, look for [MAGE_ROOT]/vendor/magento/theme-frontend-luma or [MAGE_ROOT]/vendor/magento/theme-adminhtml-backend
Usage of Advanced Design Patterns and Features like Namespaces, Automatic Dependancy Injection, Static Content Generation
Some Used Technologies
LESS, jQuery, RequireJS, knockout.js and More
Varnish, Redis, Memcached
Solr
A complete list as per the documentation http://devdocs.magento.com/guides/v2.0/architecture/tech-stack.html
Good Tutorials to Follow
http://alanstorm.com/
https://www.ashsmith.io/
Give it a try. It's complex, more advanced. But worth learning...
Magento 2 all module reside inside app/code folder.
Inside app/code folder
/etc (main configuration folder module.xml)
/Setup (database table related file)
/Controller(action file)
/Model(Business logic)
/Helper (Miscellaneous data)
/Block (Block Template function file)
/view (phtml and layout file with css and js file)
/i18n (For translation language feature)
There are no core/community/local folder and those all folders are remove.
Magento use complete MVC pattern as following:-
1.complete module code resides in single folder:VendorName/ModuleName
2.No core/community/local folder
3.complete front end data (view data) resides into view folder.
4.Module register trough registration.php file.
5.dependency manage by composer.js file.
Magento 2 code structure is different from Magento 1. Code can be found under [MagentoRoot]/app/code and can also be installed under [MagentoRoot]/vendor directory using composer. Frontend Themes can be created under [MagentoRoot]/app/design/frontend and Admin Themes can be created under [MagentoRoot]/app/design/adminhtml
As far as concerned with Magento 2, the code pool structure of Magento 2 is different than Magento 1.
There are directories of modules where code found in Magento 2 as:
app/code
vendor
design/frontend
design/adminhtml
Every module follows the directory structure as VendorName/ModuleName inside the directory app/code, all the Code can be found under [MagentoRoot]/app/code, and can similar third-party modules also can be installed under /vendor directory using composer.json.
Please check the complete documentation:
https://developer.adobe.com/commerce/php/development/build/component-file-structure/
https://www.cloudways.com/blog/create-module-in-magento-2/
magento extension folder structure :
In Magneto 2 very easy to understand folder structure
Common directories
Following are some common module directories:
Block: contains PHP view classes as part of Model View Controller(MVC) vertical implementation of module logic.
Controller: contains PHP controller classes as part of MVC vertical implementation of module logic.
etc: contains configuration files; in particular, module.xml, which is required.
Model: contains PHP model classes as part of MVC vertical implementation of module logic.
Setup: contains classes for module database structure and data setup which are invoked when installing or upgrading.
Additional directories
Additional folders can be added for configuration and other ancillary functions for items like plugin-ins, localization, and layout files.
Api: contains any PHP classes exposed to the API.
i18n: contains localization files.
Plugin: contains any needed plug-ins.
view: contains view files, including static view files, design templates, email templates, and layout files
Theme file structure
A typical theme file structure can look like the following:
├── composer.json ├── etc │ └── view.xml ├── i18n │ └── en_US.csv ├── LICENSE_AFL.txt ├── LICENSE.txt ├── media │ └── preview.jpg ├── registration.php └── web ├── css │ ├── email.less │ ├── print.less │ ├── source │ │ ├── _actions-toolbar.less │ │ ├── _breadcrumbs.less │ │ ├── _buttons.less │ │ ├── components │ │ │ └── _modals_extend.less │ │ ├── _icons.less │ │ ├── _layout.less │ │ ├── _theme.less │ │ ├── _tooltips.less │ │ ├── _typography.less │ │ └── _variables.less │ ├── _styles.less │ ├── styles-l.less │ └── styles-m.less ├── images │ └── logo.svg └── js ├── navigation-menu.js ├── responsive.js └── theme.js
Common directories
Typical theme directories are:
etc: Contains configuration files such as the view.xml file which contains image configurations for all images and thumbnails.
i18n: Translation dictionaries, if any.
media: Theme preview images (screen capture of your theme) can be put in here.
web: Optional directory that contains static files organized into the following subdirectories:
css/source: Contains a theme’s less configuration files that invoke mixins for global elements from the Magento UI library, and the theme.less file that overrides the default variables values.
css/source/lib: Contains view files that override the UI library files stored in lib/web/css/source/lib.
fonts: The folder to place the different fonts for your theme.
images: Static images folder.
js: The folder for your JavaScript files.
Base on this tutorial:
http://spring.io/guides/gs/serving-web-content/
I can use the thymeleaf to serve the view in the location
/src/main/resources/templates/
However, I have to put the static web contents (css, js) in another location:
/src/main/webapp/resources
And linking the resources in the hello.html like that:
<link href="resources/hello.css" />
<script src="resources/hello.js"></script>
The directory structure is:
└── src
└── main
└── java
└── hello.java
└──resources
└──templates
└──hello.html
└──webapp
└──resources
└──hello.js
└──hello.css
The problem is that the links of the static files are work when I run the web server. But if I open the html files in offline mode, the links are broken.
Could I move the static resource from
/src/main/webapp/resources
to:
/src/main/resources/templates/resources
The new directory structure would be like:
└── src
└── main
└── java
└── hello.java
└──resources
└──templates
└──hello.html
└──resources
└──hello.js
└──hello.css
I tried it but is doesn't work.
Try src/main/resources/static (or src/main/resources/public or src/main/resources/resources). All those are registered by Spring Boot autoconfig.
Define the mapping in your context like following -
<mvc:resources mapping="/templates/**"
location="classpath:/templates/" />
This will route everything that's hitting /template/ url to search for contents under your src/main/resources/templates/ folder.
In case you need tweaking in the url/prefix - adjust the mapping accordingly.
I am building a backbone.js app on a Rails 3.1 back-end. I'm using CoffeeScript to write the backbone classes, and Jasmine (via jasmine-headless-webkit) for testing.
Given the following (partial) tree:
.
├── app
│ ├── assets
│ │ ├── javascripts
│ │ │ └── views
│ │ │ ├── avia_view.js.coffee
├── spec
│ ├── javascripts
│ │ └── views
│ │ └── avia_view_spec.js.coffee
... I would expect avia_view_spec.js.coffee to know about Avia.AviaView, which is defined in avia_view.js.coffee.
However, I get the following output from running bundle exec jasmine-headless-webkit:
Running Jasmine specs...
F
Avia.AviaView render creates a new MatricesView . (/home/duncan/avia/spec/javascripts/views/avia_view_spec.js.coffee:10)
ReferenceError: Can't find variable: Avia in /home/duncan/avia/spec/javascripts/views/avia_view_spec.js.coffee (line ~5)
ReferenceError: Can't find variable: Avia in /home/duncan/avia/spec/javascripts/views/avia_view_spec.js.coffee (line ~10)
My jasmine.yml contains the following:
src_files:
- public/javascripts/prototype.js
- public/javascripts/effects.js
- public/javascripts/controls.js
- public/javascripts/dragdrop.js
- public/javascripts/application.js
- public/javascripts/**/*.js
I think I need to tell Jasmine to load the contents of avia_view.js.coffee but I'm not entirely sure how. Adding an explicit reference in the src_files section in jasmine.yml doesn't seem to make a difference ...
Could someone please tell me what I'm doing wrong here? I suspect it's something simple ...
Without having seen to much of your code, I'd suspect it beacuse of CoffeeScript's function wrapping (docs). You need to ensure that all the symbols you want to use are exported to somewhere you can get at them (here is a thorough discussion about that).
Edit: here's another longish and theoretical but good documentation on this topic.
Try adding this to your avia_view.js.coffee
(exports ? this).Avia = Avia
See this for a detailed explanation.
Alternatively try this;
window.Avia = Avia
We encountered the same problem; I highly recommend JasmineRice