Finding config.rb used by Sencha Cmd - css

I am trying to configure my Sencha Touch 2 application build process such that linked fonts have correct path in the CSS.
I have added fonts_path to MyApp/resources/sass/config.rb:
# Get the directory that this configuration file exists in
dir = File.dirname(__FILE__)
# Load the sencha-touch framework automatically.
load File.join(dir, '..', '..', 'touch', 'resources', 'themes')
# Compass configurations
sass_path = dir
css_path = File.join(dir, "..", "css")
fonts_path = File.join(dir, "..", "fonts")
# Require any additional compass plugins here.
images_dir = File.join(dir, "..", "images")
output_style = :compressed
environment = :production
which should change the fonts path used in the SCSS:
#include icon-font('Pictos', font-files('pictos-web.svg', 'pictos-web.eot'));
but this still compiles to
#font-face{font-family:"Pictos";src:url('/stylesheets/fonts/pictos-web.svg') format('svg'),url('/stylesheets/fonts/pictos-web.eot') format('embedded-opentype')}
So the fonts path used in is the CSS still is /stylesheets/fonts/, and I don't know why.
I have tried to find the config.rb used by calling sencha -d app build production, but this does not give me any more details as to the config file used:
[INF] -compass-compile-sass-dir:
ruby 2.2.3p173 (2015-08-18 revision 51636) [x64-mingw32]
[DBG] exit code was : 0
[DBG] exit code was : 0
[DBG] ruby detected, checking for version in : ruby 2.2.3p173 (2015-08-18 revision 51636) [x64-mingw32]
[DBG] setting GEM_HOME to C:\Users\urban\bin\Sencha\Cmd\6.0.1.76\extensions\sencha-compass\gems
[INF] executing compass using system installed ruby runtime
[DBG] executing compass : ruby C:\Users\urban\bin\Sencha\Cmd\6.0.1.76\extensions\sencha-compass\gems\bin\compass compile --force --trace
identical ../css/app.css
[DBG] exit code was : 0
Now I am not sure that I edited the correct config.rb, there are quite some:
MyApp/resources/sass/config.rb
MyApp/touch/packages/sencha-touch-grid/examples/grid/resources/sass/config.rb
MyApp/touch/packages/sencha-touch-grid/examples/summarygrid/resources/sass/config.rb
MyApp/.backup/MyApp/2.3.1.410/resources/sass/config.rb
MyApp/touch/resources/sass/config-debug.rb
MyApp/touch/resources/sass/config.rb
MyApp/touch/resources/themes/vendor/config/compass-recipes/config.rb
Which one is it or is it neither?

Related

Rails 6 Mina deploy fails at Precompile

I am running a Debian 10 (Buster) Server for my Rails 6.0.3, Ruby 2.6.3, Mina 1.2.3 app. When I run Mina deploy it errors out but does not give me enough to help me understand what I need to do to resolve the issue.
Mina Deploy output
Precompiling asset files
$ RAILS_ENV="production" bundle exec rake assets:precompile
Traceback (most recent call last):
3: from /var/www/site/tmp/build-15965768145748/vendor/bundle/ruby/2.6.0/bin/ruby_executable_hooks:24:in `<main>'
2: from /var/www/site/tmp/build-15965768145748/vendor/bundle/ruby/2.6.0/bin/ruby_executable_hooks:24:in `eval'
1: from /usr/local/rvm/gems/ruby-2.6.3/bin/rake:23:in `<main>'
/usr/local/rvm/gems/ruby-2.6.3/bin/rake:23:in `load': cannot load such file -- /usr/local/rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/specifications/default/exe/rake (LoadError)
! ERROR: Deploy failed.
Deploy.rb
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm'
set :application_name, 'site'
set :domain, 'server'
set :user, 'deployer'
set :deploy_to, "/var/www/site"
set :repository, "git#github.com:git.git"
set :branch, 'master'
set :rvm_use_path, '/etc/profile.d/rvm.sh'
set :shared_files, fetch(:shared_files, []).push('config/database.yml', 'config/secrets.yml')
task :remote_environment do
ruby_version = File.read('.ruby-version').strip
raise "Couldn't determine Ruby version: Do you have a file .ruby-version in your project root?" if ruby_version.empty?
invoke :'rvm:use', 'ruby-2.6.3'
end
desc "Deploys the current version to the server."
task :deploy do
deploy do
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
invoke :'rails:db_migrate'
invoke :'rails:assets_precompile'
invoke :'deploy:cleanup'
on :launch do
end
end
end
namespace :passenger do
desc "Restart Passenger"
task :restart do
queue %{
echo "-----> Restarting passenger"
cd #{deploy_to}/current
#{echo_cmd %[mkdir -p tmp]}
#{echo_cmd %[touch tmp/restart.txt]}
}
end
end
I have made sure that yarn is installed and working on my Production machine. When I run the precompile on the Production machine, it runs through successfully. But still errors out in the Mina Deploy with no change in the error text. I have looked into this article In doing so I have commented out the suggested code snippet just to test, but that did not change anything. In looking at my bashrc, I do not see any snippets with EXPORT or SOURCE at the beginning of them.
EDIT: When I run the precompile on the server side, each new deployment folder seems like it will give me this issue.

Cannot publish asp.net core/angular project. Can't resolve app.server.module.ngfactory?

Used the VS2017 angular template and created an app. Then tried to publish it. I also upgraded to Angular 5.
Any idea with this error about ngfactory is about ???
ERROR in ./ClientApp/boot.server.ts
Module not found : error : Can't resolve './../$$_gendir/ClientApp/app/app.server.module.ngfacto
ry' in 'C:\Users\Matt_Herb\downloads\ibewsurveytemp\ibewsurveytemp\ClientApp' [C:\Users\Matt_Her
b\downloads\ibewsurveytemp\ibewsurveytemp\IbewSurveyTemp.csproj]
# ./ClientApp/boot.server.ts 8:0-94
EXEC : ERROR in error : Please update #angular/cli. Angular 5+ requires at least Angular CLI 1.5
+ [C:\Users\Matt_Herb\downloads\ibewsurveytemp\ibewsurveytemp\IbewSurveyTemp.csproj]
at throwNotSupportedError (C:\Users\Matt_Herb\downloads\ibewsurveytemp\ibewsurveytemp\
packages\compiler-cli\src\ngtools_api.ts:132:9)
at Function.NgTools_InternalApi_NG_2.codeGen (C:\Users\Matt_Herb\downloads\ibewsurveyt
emp\ibewsurveytemp\packages\compiler-cli\src\ngtools_api.ts:80:11)
at _donePromise.Promise.resolve.then (C:\Users\Matt_Herb\downloads\ibewsurveytemp\ibew
surveytemp\node_modules\#ngtools\webpack\src\plugin.js:430:58)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
at Function.Module.runMain (module.js:684:11)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:613:3
C:\Users\Matt_Herb\downloads\ibewsurveytemp\ibewsurveytemp\IbewSurveyTemp.csproj(48,5): error MS
B3073: The command "node node_modules/webpack/bin/webpack.js --env.prod" exited with code 2.
ok ... it looks like a problem with your dependencies and so on ..try this:
1 - update your angular cli with : npm install -g #angular/cli
2 - delete your node_modules in your project (maybe with rimraf)
3 - delete your package-lock.json file (if you've one)
4 - try to run in a different folder ng new testProject --skip-install=true (so it generate WITHOUT install packages a new angular project ..)
5 - go in that project and copy the #angular and other dependencies in package.json file and paste in your project .. save the updated package.json
file of your project
6 - run a npm install --f in your project
7 - try to run a ng serve .. and check if the project load
Hope it helps you
Angular 5 needs to use a different compiler plugin to Angular 4,
Try search/replace 'AotPlugin' with 'AngularCompilerPlugin' in webpack.config.js
see: https://www.npmjs.com/package/#ngtools/webpack
The next problem I ran into was that test files fail to compile when publishing,
The 'exclude' properties on webpack rules and on AngularCompilerPlugin constructor do not seem to work, so I've resorted to excluding these in tsconfig.json:
"exclude": [ "bin", "node_modules", "**/*.spec.ts" ],

Django Pipeline, Heroku, and SASS

I've been trying to get django-pipeline setup so that I can compile and concat my assets. I would also like to remove the compiled css files from my repository to avoid merge conflicts in pull requests.
I've been trying to get django-pipeline to compile the files as part of the deploy process but can't figure this out. I use SASS to write my CSS. My pipeline settings look like this:
STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'
PIPELINE_CSS = {
'main': {
'source_filenames': (
'sass/blah.scss',
'sass/main.scss',
),
'output_filename': 'css/main.css',
'extra_context': {
'media': 'screen',
},
},
}
PIPELINE_COMPILERS = (
'pipeline.compilers.sass.SASSCompiler',
)
This works great locally, and generates .css files in my /sass folder, which are then combined to make the main.css file. If I check those CSS files into my git repository and push to Heroku, it also works fine. However, if I ignore them, which I would like to do so that I'm not committing compiled files, then django-pipeline can't find the files to combine. I'm not sure how I can get the sass compilation working on Heroku and I can't find anything about it.
I can provide more information about my setup if needed, hopefully somebody knows something about this!
OK, here's how I got this working using Compass to compile my SASS files.
Use multiple Heroku buildpacks - Heroku Buildpack Multi
Put the following in your .buildpacks file
https://github.com/heroku/heroku-buildpack-ruby.git
https://github.com/heroku/heroku-buildpack-nodejs
https://github.com/heroku/heroku-buildpack-python.git
Create a Gemfile with compass and any other requirements you have. Here's mine:
source 'https://rubygems.org'
ruby '1.9.3'
gem 'bootstrap-sass'
gem 'compass'
Create a config.rb file. Here's mine. As you can see it, requires the bootstrap-sass that I included in my Gemfile:
# Require any additional compass plugins here.
require 'bootstrap-sass'
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "app_folder/static/css"
sass_dir = "app_folder/static/sass"
images_dir = "app_folder/static/images"
output_style = :compact
more details on config.rb can be found here
Install node packages (django-pipeline wants yuglify). You'll need a package.json file:
{
"dependencies": {
"yuglify": "0.1.4"
},
"engines": {
"node": "0.10.x",
"npm": "1.3.x"
},
"repository": {
"type": "git",
"url": "your repo url"
}
}
almost ready...
when Heroku runs the ruby buildpack, it will look for a rake task called assets:precompile. So now you'll need to add a Rakefile with the following:
namespace 'assets' do
desc 'Updates the stylesheets generated by Sass/Compass'
task :precompile do
print %x(compass compile --time)
end
end
this will put compile your stylesheets. You need to make sure you set the output (back in config.rb) to the place that django-pipeline is looking for CSS files (shown in the original question).
You should get rid of this part in the original question as django-pipeline isn't compiling your SASS for you:
PIPELINE_COMPILERS = (
'pipeline.compilers.sass.SASSCompiler',
)
That should be it! Deploys should just work now, and it didn't really add a significant amount of time to my deploy process.
All in all, it amounts to a lot of setup, but for me it was well worth it as I no longer have to commit compiled files into the repository, which was causing a lot of merge conflicts when working with branches and pull requests.
I would like to figure out how to do this using only two buildpacks (obviously only one would be ideal but I don't know if it's possible). The problem is trying to find binary paths so that pipeline can do it's thing when it doesn't find the defaults. I'm not sure if the reason I can't do this is because of how Heroku is installing things, or because there is a bug in django-pipeline, but right now this is good enough for me.
If you try this and it doesn't work for you, let me know, if I missed something I'm happy to make updates.
I don't want to take away from your excellent solution, but I tried this today and found a few differences that made things simpler for me - likely due to updates in django-pipeline and/or Heroku. My full solution is below, in case anyone else comes looking.
Add the 3 buildpacks to Heroku:
heroku buildpacks:set https://github.com/heroku/heroku-buildpack-ruby.git
heroku buildpacks:add https://github.com/heroku/heroku-buildpack-nodejs
heroku buildpacks:add https://github.com/heroku/heroku-buildpack-python.git
Add django-pipeline and django-pipeline-compass to requirements.txt:
django-pipeline==1.5.2
django-pipeline-compass==0.1.5
Create a Gemfile to install Sass:
source 'https://rubygems.org'
ruby '2.1.5'
gem 'bootstrap-sass'
Create a package.json file to install Yuglify:
{
"dependencies": {
"yuglify": "0.1.4"
},
"engines": {
"node": "0.10.x",
"npm": "1.4.x"
}
}
I did not need a Rakefile or config.rb.
For reference, here are relevant settings from my settings.py:
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, '_generated_media')
STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'pipeline.finders.PipelineFinder',
)
PIPELINE_COMPILERS = (
'pipeline_compass.compiler.CompassCompiler',
)
PIPELINE_YUGLIFY_BINARY = os.path.join(BASE_DIR, 'node_modules', '.bin', 'yuglify')
And I also had to add this entry to urls.py:
url(r'^static/(?P<path>.*)$', serve, kwargs={'document_root': settings.STATIC_ROOT})
Hope it helps someone!
You may need to set PIPELINE_SASS_BINARY so that django-pipeline can find your SASS compiler.
You can use the libsass compiler for django-pipeline that uses Sass packaged as a Python package:
pip install libsasscompiler
Update your config:
PIPELINE['COMPILERS'] = (
'libsasscompiler.LibSassCompiler',
)
The default Yuglify compressor is also a problem on Heroku, which you can temporarily overcome by disabling it. This is my config for enabling Sass on Django for example:
PIPELINE = {
'COMPILERS': (
'libsasscompiler.LibSassCompiler',
),
'STYLESHEETS': {
'main': {
'source_filenames': (
'styles/main.scss',
),
'output_filename': 'css/main.css'
},
},
# disable the default Yuglify compressor not available on Heroku
'CSS_COMPRESSOR': 'pipeline.compressors.NoopCompressor',
'JS_COMPRESSOR': 'pipeline.compressors.NoopCompressor'
}
The longer-term solution would be to move towards a JS-only build toolchain (as most projects are doing). Rails integrates pretty nicely with Webpack for example and is maintained by the same team. Until that happens in Django (if ever) and trickles into the Heroku Python builpack, you can use Heroku's multiple buildpacks and add an official Node buildpack step that runs npm install; npm run build for you.

Error with wp and sass/compass

So, I'm trying to set up my wp theme for use with sass.
I've renamed style.css to style.scss and put it in a folder called 'sass'.
Then I made a file called config.rb. In it I wrote
/* config.rb in the theme's root. */
css_dir = "/"
sass_dir = "sass"
output_style = :compressed
I then try to use compas.app to watch the folder (that is on a FTP server, mounted in Finder). I choose the root folder of the theme and press ok. After two seconds I get an error:
'(RegexpError) target of repeat operator is not specified: /* config.rb in the theme's root. */
org/jruby/RubyKernel.java:1112:in eval'
/Applications/compass.app/Contents/Resources/lib/ruby/compass_0.12/compass-0.12.2/lib/compass/configuration/serialization.rb:24:inparse_string'
/Applications/compass.app/Contents/Resources/lib/ruby/compass_0.12/compass-0.12.2/lib/compass/configuration/serialization.rb:15:in _parse'
org/jruby/RubyIO.java:1139:inopen'
org/jruby/RubyKernel.java:296:in open'
file:/Applications/compass.app/Contents/Resources/Java/lib/java/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/1.8/open-uri.rb:32:inopen'
/Applications/compass.app/Contents/Resources/lib/ruby/compass_0.12/compass-0.12.2/lib/compass/configuration/serialization.rb:14:in _parse'
/Applications/compass.app/Contents/Resources/lib/ruby/compass_0.12/compass-0.12.2/lib/compass/configuration/file_data.rb:7:innew_from_file'
/Applications/compass.app/Contents/Resources/lib/ruby/compass_0.12/compass-0.12.2/lib/compass/configuration/inheritance.rb:204:in with_defaults'
/Applications/compass.app/Contents/Resources/lib/ruby/compass_0.12/compass-0.12.2/lib/compass/configuration/file_data.rb:6:innew_from_file'
/Applications/compass.app/Contents/Resources/lib/ruby/compass_0.12/compass-0.12.2/lib/compass/configuration/helpers.rb:42:in configuration_for'
/Applications/compass.app/Contents/Resources/lib/ruby/compass_0.12/compass-0.12.2/lib/compass/configuration/helpers.rb:97:inadd_project_configuration'
/Applications/compass.app/Contents/Resources/lib/ruby/compass_0.12/compass-0.12.2/lib/compass/commands/project_base.rb:31:in add_project_configuration'
/Applications/compass.app/Contents/Resources/lib/ruby/compass_0.12/compass-0.12.2/lib/compass/commands/project_base.rb:25:inconfigure!'
/Applications/compass.app/Contents/Resources/lib/ruby/compass_0.12/compass-0.12.2/lib/compass/commands/project_base.rb:15:in initialize'
/Applications/compass.app/Contents/Resources/lib/ruby/compass_0.12/compass-0.12.2/lib/compass/commands/update_project.rb:37:ininitialize'
file:/Applications/compass.app/Contents/Resources/Java/compass-app.jar!/ui/tray.rb:417:in watch'
file:/Applications/compass.app/Contents/Resources/Java/compass-app.jar!/app.rb:207:intry'
file:/Applications/compass.app/Contents/Resources/Java/compass-app.jar!/ui/tray.rb:412:in watch'
file:/Applications/compass.app/Contents/Resources/Java/compass-app.jar!/ui/tray.rb:153:inopen_dir_handler'
file:/Applications/compass.app/Contents/Resources/Java/compass-app.jar!/ui/tray.rb:71:in run'
file:/Applications/compass.app/Contents/Resources/Java/compass-app.jar!/main.rb:115:inrun_tray'
file:/Applications/compass.app/Contents/Resources/Java/compass-app.jar!/main.rb:131:in (root)'
org/jruby/RubyKernel.java:1062:inrequire'
file:/Applications/compass.app/Contents/Resources/Java/compass-app.jar!/main.rb:1:in `(root)''
You'll have to debug it.
First, download your theme to a local drive and run compass compile on it.
Then run Compass.App on it.
Then run compass watch on the remote folder.
On which step does the problem occur?

JRuby + Sqlitejdbc : No suitable driver found for jdbc:sqlite:

On a machine I have only a user account on, I want to dump the output of a job into an sqlite database instead of textfiles. To this end, I run jruby from the jarfile.
The approach usings gems (dbi, dbd/Jdbc, jdbc/sqlite3) from a local GEM_HOME did not work (No suitable driver found) and also produces deprecation messages from the gems ("include_class is deprecated. Use java_import.")
I turned to Zentus' sqlitejdbc-v056.jar and ran JRuby with Zentus' in the path:
java -cp .:sqlitejdbc-v056.jar -jar jruby-complete-1.7.0.preview1.jar test.rb
where test.rb in inspired by http://www.zentus.com/sqlitejdbc/ and How to initialize the SQLite3 JDBC driver in JRuby? :
require 'java'
require '/home/jens/jruby/sqlitejdbc-v056.jar'
org.sqlite.JDBC # load the driver so DriverManager detects it
p clazz = Java::JavaClass.for_name("org.sqlite.JDBC")
java.sql.DriverManager.registerDriver( clazz )
#Java::OrgSqlite::JDBC # alternate means of same
puts "enumerating..."
java.sql.DriverManager.getDrivers.each{ |e| puts e }
connection = java.sql.DriverManager.getConnection 'jdbc:sqlite:/home/jens/jruby/test.db'
begin
statement = connection.createStatement
...
ensure
connection.close
end
The output I get from this is:
class org.sqlite.JDBC
enumerating...
sun.jdbc.odbc.JdbcOdbcDriver#73415727
DriverManager.java:602:in `getConnection': java.sql.SQLException: No suitable driver found for jdbc:sqlite:/home/jens/jruby/test.db
from DriverManager.java:207:in `getConnection'
from NativeMethodAccessorImpl.java:-2:in `invoke0'
...
Curiously, the driver is listed by the DriverManager, but not deemed suitable for sqlite.
I'm looking forward to any suggestions.
First of all you should use bundler to manage your gem dependencies. Bundler uses a Gemfile to list the gems you need (place it where your script is). And make sure that jruby is in your path.
In your case the Gemfile should contain:
source 'http://rubygems.org'
gem "activerecord-jdbcsqlite3-adapter", ">= 1.2"
Then execute:
bundle install --path vendor/bundle
Then modify your script like this:
require 'rubygems'
require "java"
require 'bundler/setup'
require 'jdbc/sqlite3'
Bundler.require
org.sqlite.JDBC # load the driver so DriverManager detects it
p clazz = Java::JavaClass.for_name("org.sqlite.JDBC")
java.sql.DriverManager.registerDriver( clazz )
puts "enumerating..."
java.sql.DriverManager.getDrivers.each{ |e| puts e }
connection = java.sql.DriverManager.getConnection 'jdbc:sqlite:/home/jens/jruby/test.db'
begin
statement = connection.createStatement
ensure
connection.close
end

Resources