Phalcon Dev Tools - Builder doesn't knows where is the models directory - phalcon

I'm getting "Builder doesn't knows where is the models directory" error when I run the phalcon all-models command in both Command Line and Phalcon Webtools.
Please let me know what am I missing?
My webtools.config.php content
define('PTOOLS_IP', '216.174.134.2');
define('PTOOLSPATH', '/var/www/html/vendor/phalcon/devtools');
My webtools.php content
use Phalcon\Web\Tools;
require 'webtools.config.php';
require PTOOLSPATH . '/scripts/Phalcon/Web/Tools.php';
Tools::main(PTOOLSPATH, PTOOLS_IP);
My config.ini content
[database]
adapter = Mysql
host = localhost
username = test
password = test
dbname = test
[application]
controllersDir = ../app/controllers/
modelsDir = ../app/models/
viewsDir = ../app/views/
pluginsDir = ../app/plugins/
libraryDir = ../app/library/
cacheDir = ../app/cache/
baseUri = /
[models]
metadata.adapter = "Memory"
I have change the modelsDir from ../app/models/ to /../app/models/ but still not working.
ANSWER FOUND:
Going to project root directory and type the command (instructions)
# phalcon all-models --directory /var/www/html/projec_name
I speficied the --directory which is the Base path on which project will be created.
Thank you colburton for helping me debug this problem. Much appreciated.

Going to project root directory and type the command (instructions)
# phalcon all-models --directory /var/www/html/projec_name
I speficied the --directory which is the Base path on which project will be created.
Thank you colburton for helping me debug this problem. Much appreciated.

In the options array you pass to the builder you need to add 'modelsDir' with the correct path.
On this page you can find a video with the webtools. There is a tab for "Configuration", where you can set them.
It is also located in the config.ini under app/config

I am using Phalcon 3. After generating a project with phalcon console tool I encountered this error.
There is an easy way out to resolve this issue. Change the following settings in app/config/config.ini if you have one.
[application]
controllersDir = app/controllers/
modelsDir = app/models/
viewsDir = app/views/
pluginsDir = app/plugins/
libraryDir = app/library/
cacheDir = ../cache/

Related

Can't create a site collection through SharePoint Managment Shell for SharePoint 2010

I tried to run the same commands as in here -https://technet.microsoft.com/en-us/library/cc263165(v=office.14).aspx .
$template = Get-SPWebTemplate "STS#0"
New-SPSite -Url "http://web-application-name/sitecollection1" -OwnerAlias "domain\administrator" -Template $template
I am getting the following error:
New-SPSite : A site collection could not be created as the provided managed pat
h does not exist. Change the URL to use an existing managed path or create the
missing managed path prior to calling this command.
What does this error mean? What am i missing?
1.$template = Get-SPWebTemplate "STS#0"
if you are getting error upon running this command use this link https://support.microsoft.com/en-us/help/2796733/sharepoint-2010-management-shell-does-not-load-with-windows-powershell-3.0
to fix it
2.Create a managed path
New-SPManagedPath -RelativeURL "sitecollection1" -WebApplic ation "web-application-name"
3.Create the site collection
New-SPSite -URL "http://web-application-name/sites/sitecollection1"-OwnerAlias "domain\administrator" -Template $template
It is not very clear for my how to create a site collection with a path like:
http://web-application-name/sitecollection2
But this solution worked for what i needed.

Geb/Spock Error- No reports dir has been configured, you need to set in the config file or via the build adapter

I have trouble running my functional test from IntelliJ IDE. When I run the functional test, I got the following error message:
java.lang.IllegalStateException: No reports dir has been configured, you need to set in the config file or via the build adapter.
at geb.Browser.getReportGroupDir(Browser.groovy:899)
at geb.Browser.cleanReportGroupDir(Browser.groovy:932)
at geb.spock.GebSpec.methodMissing(GebSpec.groovy:56)
at geb.spock.GebReportingSpec.setupSpec(GebReportingSpec.groovy:37)
Based on my research, all I need to do is to add the following code in GebConfig.groovy:
reportsDir = new File("target/runtime_reports_dir")
I added the line to GebConfig.groovy and rebuild the project, but still running into the same issue. Is there any other fix to this error?
Adding reportsDir = 'target/geb-reports' to your GebConfig shoud fix this, can you show me your GebConfig file?
There is also another fix for it, your test class extends GebReportingSpec, you can chage it to GebSpec and it should also work.
I had this same issue, while having the reportsDir correctly configured in the GebConfig
Adding the resources folder (where my GebConfig is located) as "Test Sources Root" did the trick for me
To mark the folder as "Test Sources Root":
Right click in the folder
Mark Directory as
Test Sources Root
Happy testing!

Capistrano deploy fails due to missing manifest file when using assets prefix

I've just set up a Capistrano deploy for our application and I keep running into this error:
* executing ["ls /path/to/app/shared/assets/manifest*"]
servers: ["web03"]
[web03] executing command
[err :: web03] ls: /path/to/app/shared/assets/manifest*
[err :: web03] : No such file or directory
If I manually create a manifest file with touch /path/to/app/shared/assets/manifest.yml, the deploy script works fine. However, this feels all sorts of sketchy.
I've googled the heck out of this and the most I can gather is that the manifest file it's looking for is a product of the asset pipeline. I checked and I do, in fact, have the pipeline enabled (config.assets.enabled = true), so I'm at a loss.
Could someone please help me understand 1) what this manifest file is and how it's created; and 2) why isn't one being created for my application?
Update: I think I'm closing in on the answer and I think it has something to do with this line:
config.assets.prefix = "/some_other_path"
We needed to rename the "asset" path because we have Asset objects in our system and I'm guessing Cap might be getting confused because of it. Any suggestions?
My suspicion was right: this was a problem with the renamed asset directory. Cap didn't know to look in public/some_other_path instead of public/assets.
In other words, because this line is in my application.rb:
config.assets.prefix = "some_other_path"
I had to add this line to my deploy.rb:
set :assets_prefix, "some_other_path"
Then, Cap knows where to look for a manifest, copies it into shared/assets, and finishes correctly.
It'd be handy to have the deploy.rb reference the config variable instead of having to hard-code the path a second time, but that's outside the scope of this question.
if you configure with the aws, here it should be...
appname/config/environments/production.rb
config.action_controller.asset_host = "//#{ENV['FOG_DIRECTORY']}.s3.amazonaws.com"
config.assets.prefix = "/#{ENV['APP_NAME']}/assets"
appname/config/deploy.rb
...
set :keep_releases, 5
set :assets_prefix, ->{ "#{fetch(:application)}/assets" }
set :whenever_identifier, -> { "#{fetch(:application)}_#{fetch(:stage)}" }
...

Using Compass on Heroku: /tmp for stylesheets remotely and locally

I'm currently using Compass with Heroku using this configuration recommended on the Heroku knowledge base. Heroku has a read-only file system, and so the compiled stylesheets need to be stored in /tmp. This works fine remotely on Heroku; locally, however, Rails expects to find stylesheets in /public/stylesheets (when called through = stylesheet_link_tag 'screen.css', :media => 'screen, projection').
In order to solve the problem, I have created symbolic links in /public/stylesheets using ln -s tmp/stylesheets/screen.css public/stylesheets/screen.css and that seems to work.
Is there a way to solve this problem without using symbolic links, perhaps by changing some configuration in Rails? I've poked around without much success.
Here is my config/initializers/compass.rb:
require 'compass'
require 'compass/app_integration/rails'
Compass::AppIntegration::Rails.initialize!
# Required for Heroku:
require 'fileutils'
FileUtils.mkdir_p(Rails.root.join("tmp", "stylesheets"))
Compass::AppIntegration::Rails.initialize!
Rails.configuration.middleware.delete('Sass::Plugin::Rack')
Rails.configuration.middleware.insert_before('Rack::Sendfile', 'Sass::Plugin::Rack')
Rails.configuration.middleware.insert_before('Rack::Sendfile', 'Rack::Static',
:urls => ['/stylesheets'],
:root => "#{Rails.root}/tmp")
And here is my config/compass.rb:
project_type = :rails
project_path = Compass::AppIntegration::Rails.root
# Set this to the root of your project when deployed:
http_path = "/"
# Necessary for Heroku (original commented out:
css_dir = 'tmp/stylesheets'
#css_dir = "public/stylesheets/compiled"
sass_dir = 'app/views/stylesheets'
environment = Compass::AppIntegration::Rails.env
Any help would be greatly appreciated.
I was actually just about to set up Compass with our Rails application, which is hosted on Heroku, so cheers for giving me an excuse to work through this. :)
The answer is simple:
Modify 'config/compass.rb':
project_type = :rails
project_path = Compass::AppIntegration::Rails.root
http_path = "/"
environment = Compass::AppIntegration::Rails.env
if environment == 'production'
css_dir = "tmp/stylesheets"
sass_dir = "app/views/stylesheets"
else
css_dir = "public/stylesheets"
sass_dir = "app/stylesheets"
end
Then modify 'config/initializers/compass.rb':
require 'compass'
require 'compass/app_integration/rails'
Compass::AppIntegration::Rails.initialize!
require 'fileutils'
FileUtils.mkdir_p(Rails.root.join("tmp", "stylesheets"))
environment = Compass::AppIntegration::Rails.env
if environment == 'production'
Compass::AppIntegration::Rails.initialize!
Rails.configuration.middleware.delete('Sass::Plugin::Rack')
Rails.configuration.middleware.insert_before('Rack::Sendfile', 'Sass::Plugin::Rack')
Rails.configuration.middleware.insert_before('Rack::Sendfile', 'Rack::Static',
:urls => ['/stylesheets'],
:root => "#{Rails.root}/tmp")
end
... and voila, you're good.
ok, I'm a big heroku and compass fan myself so i've been through this many times
Heroku's docs, whilst giving correct information, provide poor advice in this instance.
When using compass, the best thing to do, 99.999% of the time is turn it off in production mode.
This means that you compile your stylesheets on your development machine and then add them to your git repo before pushing to heroku.
You will suffer a reasonably sizeable performance hit if you allow compass to compile on the server.
So here's what I do:
You should have a config.ru file at the base of your app. Open it and add the following:
require 'sass/plugin/rack'
use Sass::Plugin::Rack
Sass::Plugin.options[:never_update] = true
You can then remove quite a lot of the code from your initializer (especially the part where you unload Sass::Plugin::Rack). Additionally you will want to remove the if statement from compass.rb in config folder
Think about it, why would you want Sass to compile a stylesheet on the server? It just eats up processing power. Hope this helps,
EDIT::
PS - I should add that you will need to run compass watch from the command line now in order to get your stylesheets to compile in your dev environment
The recommended Heroku configuration will also work locally.
Removed the second 'Compass::AppIntegration::Rails.initialize!' from config/initializers/compass.rb, you only need it once.
Ensure your scss files are in 'app/views/stylesheets'
On both local and production servers the stylesheets will be compiled to tmp/stylesheets, and a request to /stylesheets will resolve to tmp/stylesheest. No need for two separate configurations.

How to load file from the Bundle in eclipse & My Eclipse?

This is very strange behavior I have noticed while developing Plugin.
I have a file in the bundle that has to be loaded for wizard.
I tried to load the file in eclipse using following code.
Bundle bundle = Platform.getBundle(MTPAppPlugin.getDefault()
.getBundle().getSymbolicName());
URL fileURL = bundle.getEntry(relativeFilePath);
File file = new File(FileLocator.resolve(fileURL).toURI());
But this didnt worked in MyEclipse.So I used other way for my eclipse
url = new URL("platform:/plugin/"
+ MTPAppPlugin.getDefault().getBundle().getSymbolicName()
+ relativeFilePath);
InputStream inputStream = url.openConnection().getInputStream();
in = new BufferedReader(new InputStreamReader(inputStream));
Now I need to know is there any common way to load the file for eclipse & My Eclipse?
The first one will not work if you have space in your folder path like C:\program files....
The first one seems to be correct. What was the error given in MyEclipse?