yeoman creates project in Desktop even though I CD into directory - yeoman

I am having a issue creating a yeoman project. I cd in the directory type yo and it says:
Here is it suppose to asked me project name etc and it wants to throw everything on my desktop not the file I cd into. It defaults to mvn and I want gradle. I even npm uninstall -g generator-jhipster
and reinstalled it and got the same issue.

If you have a .yo-rc.json file in a parent directory, Yeoman will load that configuration and generate from that file instead of prompting. This allows developers to run a yo command from any folder in the project and have it apply to the correct files.
To solve this, remove the .yo-rc.json from the parent directory, in your case /Users/drew/Desktop.
For example, if you are in the directory /Users/drew/Desktop/new-project but /Users/drew/Desktop has a .yo-rc.json inside, Yeoman will change to the parent directory (Desktop), load the configuration, and generate the files from that folder instead of the child folder.

Based on your log it's looks like you are running yo in a folder where a .yo-rc.json is already existing. Careful under windows the .yo-rc.json can be that is of type hidden and you can't see it in explorer. Because of an existing .yo-rc.json you are not asked anymore for info e.g. project name, build tool etc. My recommendation will be to create a new folder run inside yo command

Related

Include non-electron folder as part of the NSIS installation

I've been trying to add additional functionality to the electron installer, where I copy some files that are packaged inside the installer, but I receive a non-descriptive error when I try to compile my electron project to create the installer i.e. I get:
* writing effective config
* packaging
* building
x [object Object]
Here is what my script looks like:
!macro customInstall
Rename "$APPDATA\myfolder\img" "$APPDATA\myfolder\img-old"
SetOutPath "$APPDATA\myfolder"
File /nonfatal /a /r "additional_files\*"
CreateShortcut "$SMSTARTUP\mylink.lnk" "$INSTDIR\mylink.exe"
!macroend
Basically everything works except the file copy part. When I remove that part the project builds and compiles into an installer with no problems.
I've also tried to use CopyFiles instead of SetOutPath and File and it works as expected when I place the additional_files folder into the same folder as the installation (dist folder), but I want the folder to be packaged inside the installer. However, I cannot get the additional_files to be packaged with the installation.
I believe it's a location issue, that is, that the NSIS script cannot locate the additional_files/ folder. I've tried modifying the package.json file by adding to the files section the additional_files/ folder and placing it in the root of the project.
I've even tried placing it in the build folder where my installer.nsh script resides, but with no luck.
File looks for files relative to the directory where the .nsi is by default. /NOCD can be used to prevent that but I'm not sure if electron uses that switch.
!cd can be used inside a script to change the directory but I'm not sure if that is going to help you much in this case unless you are willing to use a absolute path and in that case you could just use the absolute path with the File instruction instead.
If you only know where your .nsh file is I suppose you could try File /r "${__FILEDIR__}\additional_files\*"
if you are using electron-builder you have two options inside the settings
extraResources this will copy files into the $INST_DIR/resources folder in your app (this is where the app.asar file is too), and you can access via process.resourcesPath, ex:
extraResources: [
{ from: './dist/ThirdPartyNotices.txt', to: 'ThirdPartyNotices.txt' },
]
extraFiles this would do the same but place the files into the $INST_DIR root folder of your installation ex:
extraFiles: [
{ from: './distrib/mytool.exe', to: 'mytool.exe' },
],
to get the root folder you can use something like remote.app.getAppPath().replace('resources\\app.asar', '').replace('resources/app.asar', '');
all info on: https://www.electron.build/configuration/configuration#overridable-per-platform-options

not able to locate gradle.properties in toolbox

I'm trying to run ./gradlew build command, which has artifactory_contextUrl property used in build.gradle file.
gradlew.properties is located in C:\Users\XXX.gradle folder, when I build the project in windows Intellij it takes the gradle.properties file in user folder and so gets the contexturl and everything is fine but,
when I try to build the project in docker toolbox it couldnt find it.
Toolbox starts with some location in C folder.
I tried with placing gradle.properties at the same level as build.gradle it works fine in toolbox. Eventually I dont want to keep the gradle.properties at buils.gradle level
What should I do? Does any one has any suggestions?
Well, I guess the docker toolbox (whatever it is, I don't know it) does run with another user account and thus does not find your gradle.properties file in your user directory.
The file is actually called gradle.properties, isn't it? In your question you use gradlew.properties and gradle.properties and only the latter is valid.
To solve your problem you can either make sure the gradle.properties is also in the users home directory that is used in the docker toolbox. To find out which directory this is, you can run Gradle with -d and search for Gradle user home, there it tells you which directory is the one where the gradle.properties is expected.
Alternatively you can use -P artifactory_contextUrl=asdf to set the property from the commandline, or use the system property org.gradle.project.artifactory_contextUrl or environment variable ORG_GRADLE_PROJECT_artifactory_contextUrl to set the project property.

using "packages" folder in DART

In my app, I've the pubspec.yaml file as:
name: server
dependencies:
oracledart: any
and after running pub get, I got the folder "packages" updated correctly.
I wanted to create sub folders for testing my functions individually, so I created folder: test/boms.dart, which is:
import 'dart:async';
import 'package:oracledart/oracledart.dart';
void main() {
...
}
but once running it, I got this error msg:
Unhandled exception:
Uncaught Error: FileSystemException: Cannot open file, path = 'G:\app\bin\test\packages\oracledart\oracledart.dart' (OS Error: The system cannot find the path specified.
Do I need to copy the 'packages' folder to each sub folder have the function "main", or there is another way to connect it!
At least for top-level folders the packages link should be created automatically. Try run pub get or pub upgrade or create the test folder from within DartEditor (I don't know what creates the symlinks but usually they are created automatically in top-level folders as far as I remember). In subfolders of top-level folders like bin, test, ... I always had to create them manually by creating a new symlink to the packages link in the package root.
In Linux like:
ln -s ../packages/ packages
don't know how to in Windows.
I think the DART team, should make symlinks auto generation in sub folders of the "bin" folder, same as the case of the sub folders of the "web" folder.
anyhow, to create them manually in Windows 7, I found it make as below:
1. run CMD as admin
2. mklink /D myApp\bin\test\packages myApp\packages [D for directory, not drive]
I found how to make symlinks in windows here
another full detailed way is mentioned here

Relative paths on Xcode scripts

I'm experimenting running scripts with Xcode and have got a couple of questions:
1) Xcode says to drag n drop the script into the run script section but that creates an absolute path: /Users/Me/Desktop/Project/etc. which is obviously no use if somebody else or a CI machine checks out the code. How to specify a relative path?
2) There's a permission denied error during the build when the script gets executed.
(I'm using scripts off here to experiment with https://gist.github.com/sekati/3172554)
"$SRCROOT" gives the project folder:
i.e: Users/yourUserName/MyProject
but if you have a workspace folder with multiple projects inside:
i.e: Users/yourUserName/MyWorkspace/MyProject
And you need just the workspace folder, use 2 dots:
"../SomeFodler"
While someFolder will be created in the workspace folder.
Simple as that.
1) Edit your script with the following:
Root of the project: ${SRCROOT}
Root of the build: ${CONFIGURATION_BUILD_DIR}
2) Press ⌘+8, click Build and read the error.
1) In an Xcode project of mine, I have the following script that generates the source code documentation. As you can see each line of the script uses a relative path. I don't even need to use ${SRCROOT}.
# change directory because Doxyfile is configured with a relative input path ".."
cd doxygen
# clean the directory
rm -rf html
# generate docs
/opt/local/bin/doxygen Doxyfile
# open the html documentation
open html/index.html
2) The reason for the "permission denied" error may be that you have not set the executable bit on the script. On the console, type this command to set the executable bit, then try again to run the script.
chmod +x /path/to/xcode-build-bump.sh

Ruby on Rails Tutorial - 5.26 - Sublime Text "Unable to Save" new file "spec/support/utilities.rb"

I am using Sublime Text 2 while following Michael Hartl's Ruby on Rails Tutorial.
The specific portion of the tutorial to which I am referring can be found at http://ruby.railstutorial.org/book/ruby-on-rails-tutorial (ctrl+F "Listing 5.26").
I am able to create the spec/support file. However, when trying to create the spec/support/utilities.rb file, I receive the message "Unable to save ~/rails_projects/sample_app/spec/support/utilities.rb".
Does anyone know why this might be?
Someone on the Sublime Text forum seems to have had the exact same problem: http://www.sublimetext.com/forum/viewtopic.php?f=3&t=8570&p=36922#p36922
This issue sounds like it's a result of incorrect permissions or ownership of the folder. Change directories (cd) so you're outside of the folder where you're creating the .rb file and type:
ls -l
This terminal command lists the permissions attached to all files/folders in that directory. If "root" is listed as the folder owner, change its owner by typing:
sudo chown YOUR_COMP_USER_NAME FOLDER_NAME/
You should now be able to save files from inside that folder.
To diagnose this, first find out if it's an issue in Sublime or your file system:
Does that file already exist? Try looking for it on your file system (not using Sublime).
Verify that you have permission to write to that file. Use "ls -la" on the command line to show the file permissions.
Are you able to create and/or save that file using any different editor, for example TextMate, or Notepad?
The following sublime plugin fixed the Unable to save... bug
https://gist.github.com/3779601
The folder spec/support doesn't exist, and sublime won't create the missing folder, so it errors.
You just need to make the spec/support folder , then sublime will save the file.
I also highly recommend installing the AdvancedNewFile plugin ( Video of it action thanks to Jeffrey Way and NetTuts+ ) , which you can grab straight from Package Control.
It creates files, parent folders if needed, and if you try to create a file that already exists, it opens it instead.
This can happen if you are trying to create the file within a directory that does not currently exist. For ex. I was unable to save
~/rails_projects/sample_app/app/views/shared/_error_messages.html.erb
via the "subl" command from the Terminal because I was missing /shared/ folder. Hope that helps.
so #knice almost had it, I ran into the same problem with permission when starting my first rails project on mavericks.
as mentioned if you run ls -l you'll see your folder / files listed with their permissions
I solved this by changing ownership recursively with the following command from outside my project directory
sudo chown -Rv <your_username> <your_path_and_foldername>
for example if you're in your folder in terminal you should cd .. and then
sudo chown -Rv username ruby_proj/
the -R is for recursive meaning it will apply to all files and folder contained within the folder you specified, and the v after just produces verbose output, showing you which folder and file permissions have been changed.
Hope that helps someone else.

Resources