I want to take and put some of the files under bower_components folder. In my web site, bower_components folder tree is as follows:
├── bower_components
│ └── angular
│ ├── README.md
│ ├── angular-csp.css
│ ├── angular.js
│ ├── angular.min.js
│ ├── angular.min.js.gzip
│ ├── angular.min.js.map
│ └── bower.json
I just want to copy the angular.min.js file to the output/bower_components/angular/angular.min.js folder.
For this purpose, I modified the Rules file as below:
compile "/bower_components/*.min.js" do
#item.identifier.chop + '.' + item[:extension]
end
route "/bower_components/*.min.js" do
item.identifier.chop + '.' + item[:extension]
end
When I compile my website, I have the following error:
RuntimeError: Found 4 content files for content/bower_components/angular/angular; expected 0 or 1
Compilation stack:
(empty)
Stack trace:
0. /Users/neva/.rvm/gems/ruby-1.9.3-p448#global/gems/nanoc-3.6.7/lib/nanoc/data_sources/filesystem.rb:164:in `block in all_split_files_in'
1. /Users/neva/.rvm/gems/ruby-1.9.3-p448#global/gems/nanoc-3.6.7/lib/nanoc/data_sources/filesystem.rb:154:in `each_pair'
2. /Users/neva/.rvm/gems/ruby-1.9.3-p448#global/gems/nanoc-3.6.7/lib/nanoc/data_sources/filesystem.rb:154:in `all_split_files_in'
3. /Users/neva/.rvm/gems/ruby-1.9.3-p448#global/gems/nanoc-3.6.7/lib/nanoc/data_sources/filesystem.rb:78:in `load_objects'
4. /Users/neva/.rvm/gems/ruby-1.9.3-p448#global/gems/nanoc-3.6.7/lib/nanoc/data_sources/filesystem.rb:37:in `items'
5. /Users/neva/.rvm/gems/ruby-1.9.3-p448#global/gems/nanoc-3.6.7/lib/nanoc/base/source_data/site.rb:325:in `block in load_items'
6. /Users/neva/.rvm/gems/ruby-1.9.3-p448#global/gems/nanoc-3.6.7/lib/nanoc/base/source_data/site.rb:324:in `each'
7. /Users/neva/.rvm/gems/ruby-1.9.3-p448#global/gems/nanoc-3.6.7/lib/nanoc/base/source_data/site.rb:324:in `load_items'
8. /Users/neva/.rvm/gems/ruby-1.9.3-p448#global/gems/nanoc-3.6.7/lib/nanoc/base/source_data/site.rb:243:in `load'
9. /Users/neva/.rvm/gems/ruby-1.9.3-p448#global/gems/nanoc-3.6.7/lib/nanoc/base/source_data/site.rb:127:in `layouts'
... 27 more lines omitted. See full crash log for details.
What shall be the problem?
Do you have any idea?
Because of the way it maps input filenames onto output paths, Nanoc requires the base name (i.e., the filename less extension) of each file under content to be unique. From Nanoc's perspective you are giving it four files that share the base name angular and thus cannot have unique output paths, so it gives you this error.
Since what you really want is to have Nanoc copy over this portion of your site verbatim, you ought to set up a static data source from which to load it. Then Nanoc will simply copy the files over as-is without attempting to process or rename them. The "Troubleshooting" page on the Nanoc website has instructions on how to do this; see "Solution #2" under "Error: “Found 3 content files for X; expected 0 or 1”.
Related
I am creating a script.sh file that creates a Test.swift file and adds it into a Xcode project. However, I would like to know if there is a way to add this file to Xcode (in the project.pbxproj file) from this script? Instead of doing it manually in Xcode (Add files to Project...).
Thank you
3/05 Update
I tried #Johnykutty answer, here is my current Xcode project before executing the ruby script:
I have already generated a A folder with a Sample.swift file located in test, but these files are not linked to my Xcode project yet:
Now here is the script that I'm executing:
require 'xcodeproj'
project_path = '../TestCodeProjTest.xcodeproj'
project = Xcodeproj::Project.open(project_path)
file_group = project["TestCodeProjTest"]["test"]
file_group.new_file("#{project.project_dir}/TestCodeProjTest/test/A")
project.save()
This almost works fine, except that it creates a folder reference instead of a group, and it doesn't link it to my target:
Hence the content of Sample.swift is unreachable.
Its hard to achieve by bash. But really easy if you use Ruby and xcodeproj gem from Cocoapods
Consider you have file structure like
├── GeneratedFiles
│ └── Sample1.swift
├── MyProject
│ ├── AppDelegate.swift
│ ├── ... all other files
│ ├── SceneDelegate.swift
│ └── ViewController.swift
├── MyProject.xcodeproj
│ ├── project.pbxproj
│ ├── .....
└── add_file.rb
Then you can add files like
require 'xcodeproj'
project_path = 'MyProject.xcodeproj'
project = Xcodeproj::Project.open(project_path)
file_group = project["MyProject"]
file_group.new_file("../GeneratedFiles/Sample1.swift")
project.save()
UPDATE:
project["MyProject"] returns a file group which is a group named MyProject in the root of the project, you can select another group inside MyProject by file_group = project["MyProject"]["MyGroup"]
Then the generated file path should be either related to that group like file_group.new_file("../../GeneratedFiles/Sample1.swift") or full path like file_group.new_file("#{project.project_dir}/GeneratedFiles/Sample1.swift")
More details about Xcodeproj here
I have a repository structure as follows :-
xyz/src
1. abc
- p
- q
- r
2. def
- t
- u
- v
3. etc
- o
- m
- n
I have created a .mod file in src and run go build ./...
Except for local packages everything is fine. So if abc/p is being used in def then it throws the following exception :- cannot find module providing package abc/p. The idea behind keeping the .mod file in src package was to make sure the path is being found from where the mod file is located. Can anyone suggest where should the mod file ideally should be? also i tried placing it one directory above in xyz but still same issue as well as i created one for each sub directory. I am bit confused on this. Will I have to create separate repository for abc and etc. But considering gopath which earlier used to work for the same I think module should also be able to do the same. Any suggestions?
The most common and easiest approach is a single go.mod file in your repository, where that single go.mod file is placed in the root of your repository.
Russ Cox commented in #26664:
For all but power users, you probably want to adopt the usual convention that one repo = one module. It's important for long-term evolution of code storage options that a repo can contain multiple modules, but it's almost certainly not something you want to do by default.
The Modules wiki says:
For example, if you are creating a module for a repository
github.com/my/repo that will contain two packages with import paths
github.com/my/repo/foo and github.com/my/repo/bar, then the first
line in your go.mod file typically would declare your module path as
module github.com/my/repo, and the corresponding on-disk structure
could be:
repo/
├── go.mod <<<<< Note go.mod is located in repo root
├── bar
│ └── bar.go
└── foo
└── foo.go
In Go source code, packages are imported using the full path including
the module path. For example, if a module declared its identity in its
go.mod as module github.com/my/repo, a consumer could do:
import "example.com/my/repo/bar"
That imports package bar from the module github.com/my/repo.
I have a single go.mod in the root of my go application. I am using the following structure inspired by Kat Zien - How Do You Structure Your Go Apps
At the minute one of my applications looks like this
.
├── bin
├── cmd
│ ├── cli
│ └── server
│ └── main.go
├── pkg
│ ├── http
│ │ └── rest
| │ # app-specific directories excluded
│ └── storage
│ └── sqlite
All packages are imported via their full path, i.e. import "github.com/myusername/myapp/pkg/http/rest" otherwise it causes problems all over the place and this was the one change I had to make going from $GOPATH to go mod.
go mod then handles all the dependencies it discovers properly as far as I've discovered so far.
I am using Yocto 2.3 to build my device image.
My image includes packagegroup-core-boot that, in turn, includes busybox.
IMAGE_INSTALL = "\
....
packagegroup-core-boot \
Busybox is configured to include syslogd:
CONFIG_SYSLOGD=y
CONFIG_FEATURE_ROTATE_LOGFILE=y
CONFIG_FEATURE_REMOTE_LOG=y
CONFIG_FEATURE_SYSLOGD_DUP=y
CONFIG_FEATURE_SYSLOGD_CFG=y
CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=256
CONFIG_FEATURE_IPC_SYSLOG=y
CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=64
CONFIG_LOGREAD=y
CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING=y
CONFIG_FEATURE_KMSG_SYSLOG=y
CONFIG_KLOGD=y
It is built and installed correctly.
Relevant syslog files do appear in busybox image directory:
tmp/work/armv5e-poky-linux-gnueabi/busybox/1.24.1-r0/image$ tree etc/
etc/
├── default
├── init.d
│ └── syslog.busybox
├── syslog.conf.busybox
├── syslog-startup.conf.busybox
These files don't appear in my main image rootfs, though. Only the syslogd command is included. See output on target device:
# ls -l $( which syslogd )
lrwxrwxrwx 1 root root 19 Jan 10 12:31 /sbin/syslogd -> /bin/busybox.nosuid
What can be happening to make this files not to be included in the final image?
Additional question:
As shown in the tree output, the init script for syslog is included in busybox but no link to /etc/rc?.d/ is created.
I understand that is should be created by a do_install() hook, shouldn't?
Thanks in advance.
EDIT
Contents of packages-split, as #Anders says, seems ok:
poky/build-idprint/tmp/work/armv5e-poky-linux-gnueabi/busybox/1.24.1-r0$ tree packages-split/busybox-syslog/
packages-split/busybox-syslog/
└── etc
├── init.d
│ ├── syslog
│ └── syslog.busybox
├── syslog.conf
├── syslog.conf.busybox
├── syslog-startup.conf
└── syslog-startup.conf.busybox
I just can't figure out what is stripping this files out of the final image.
Check tmp/work/armv5e-poky-linux-gnueabi/busybox/1.24.1-r0/packages-split. This is where all files are split into the packages that will be generated. If you search that directory, you'll find eg syslog.conf in the busybox-syslog package.
Thus, in order to get those files into your image, you'll need to add busybox-syslog to your image. I.e. IMAGE_INSTALL += "busybox-syslog".
I have a css structure where I have a folder with vendors, other with modules, other with framework, and on the root sass I have my main file which imports all the other sass files form the other folders.
How can I set the file watcher on PHPStorm to only watch that specific main.scss file??
This is what I have on PHPStorm file watcher.
Arguments:
cache --update $FileName$:$FileParentDir$/css/$FileNameWithoutExtension$.css
Working directory:
$FileDir$
Output paths to refresh:
$FileParentDir$/css/$FileNameWithoutExtension$.css
yesterday i had the same problem and gave up and told myself that i have to sleep over it so i can craft new ideas 😁
The magic word here is Partials > SASS Guide: Partials
You have to extend all your non-main files with an underscore so your file vendors.sass for example would look like this: _vendors.sass. The File Watcher now knows that he can skip this file since it's a partial. The main file is then the only one which doesn't come with an underscore :)
Beneath i show you my folder structure and the configurations for the watcher.
├── css
│ ├── sass
│ │ ├── _cookie.sass
│ │ ├── _farben.sass
│ │ ├── _navi.sass
│ │ ├── _schriften.sass
│ │ ├── _sidebar.sass
│ │ ├── _typo.sass
│ │ └── style.sass
│ ├── style.css
And this is the configuration for phpstorm to tell the app where to save the (compressed) output-file:
Arguments:
--no-cache --update $FileName$:$FileParentDir$/$FileNameWithoutExtension$.css --style compressed
Working directory:
$fileDir$
Output paths to refresh:
$FileParentDir$/$FileNameWithoutExtension$.css
I think that you maybe already have solved this problem, since your question is more than five months old. But in my case i was blind to see that this was a simple sass-thing. So hopefully no one needs to struggle for a solution like me in the future!
Cheers
This is possible with PHPStorm (and presumably WebStorm).
Note: I am using version 2018.3
To transpile just a single "main" file, you need to configure the PHPStorm File Watcher Scope:
Open PHPStorm Preferences (on a Mac, command comma)
Search for File Watchers and edit them.
Find your SCSS file watcher (presumably this will work with other watchers) and edit it.
In the configuration window, click the 3-dot icon that is to the right of the "Scopes" dropdown.
In the "Scopes" window, click the + icon to add a new scope.
From the "Add Scope" dropdown, choose Local Scope.
When prompted, enter the descriptive name of the scope (something like Theme File Only)
Now you should be in the "Scope" window (see screenshot). In the file explorer section in the middle, expand the tree and find the file you'd like to transpile.
Click the file (you can choose multiple if appropriate), and click the Include button to the right.
Click Apply then OK.
In your file watcher dialog, in the "Scope" dropdown, ensure that the newly added scope (named Them File Only or similar) is selected. Click Apply then OK.
At this point, the IDE will only watch, and transpile, the specific file(s) selected.
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.