Rails 3.1 assets gives me asset not precompiled error whereas I can see the asset in the assets directory - ruby-on-rails-3.1

On my Rails 3.1 production installation I get the error:
ActionView::Template::Error (jquery.case_by_email.js isn't precompiled)
however, when I go to
public/assets folder I can see the file:
-rw-r--r-- 1 user user 1225 Sep 16 12:56 jquery.case_by_email-acb70cf78973ab24fe65ae3d01a2d1ba.js
-rw-r--r-- 1 user user 615 Sep 16 12:56 jquery.case_by_email-acb70cf78973ab24fe65ae3d01a2d1ba.js.gz
-rw-r--r-- 1 user user 1225 Sep 16 12:56 jquery.case_by_email.js
-rw-r--r-- 1 user user 615 Sep 16 12:56 jquery.case_by_email.js.gz
I actually see 4 versions of this file. 2 with fingerprint one of which is gziped and 2 without fingerprint.
Note that I have the file specifically in the list of precompiles in my application.rb application configuration:
# Extra .js for precompile. Files that are not included in manifests
config.assets.precompile += ['jquery.case_by_email.js']
I am including this file in my view as follows:
<% content_for :javascript_includes do %>
<%= javascript_include_tag "jquery.case_by_email" %>
<% end %>
How can I track where the problem is? Other assets are normally found and served.
Thanks in advance

Add to config/environments/production.rb the following line:
config.assets.compile = true

Related

After deleting Gradle's build cache and building, some tasks are still marked as FROM-CACHE

I start off by deleting Gradle's build cache
$ rm -rf $GRADLE_HOME/caches/build-cache-*
I manually confirm this directory is gone. I also clean to ensure nothing from incremental build will interfere
$ ./gradlew clean
I then run a build w/ build-cache enabled:
$ ./gradlew --build-cache --scan app:assembleDebug
...
238 actionable tasks: 172 executed, 49 from cache, 17 up-to-date
Checking the generated report I see that some tasks are still marked as FROM-CACHE. How is this happening?
FWIW I'm using Gradle 5.6.3. I also don't use a remote build cache.
UPDATE: after clearing build cache, here's what's left in the cache dir:
$ pwd
/Users/jasonatwood/.gradle/caches
$ ls -al
total 24
drwx------ 11 jasonatwood staff 352 Dec 13 18:11 .
drwxr-xr-x 9 jasonatwood staff 288 Oct 15 17:24 ..
drwxr-xr-x 14 jasonatwood staff 448 Oct 29 16:07 5.4.1
drwxr-xr-x 15 jasonatwood staff 480 Nov 26 18:25 5.6.3
drwxr-xr-x 35 jasonatwood staff 1120 Dec 11 14:14 jars-3
drwxr-xr-x 5 jasonatwood staff 160 Oct 15 17:44 journal-1
drwxr-xr-x 7 jasonatwood staff 224 Oct 15 17:50 modules-2
drwxr-xr-x 5 jasonatwood staff 160 Oct 15 17:50 transforms-2
-rw-r--r-- 1 jasonatwood staff 39 Oct 15 17:27 transforms-2.lock
-rw------- 1 jasonatwood staff 28 Oct 22 16:34 user-id.txt
-rw-r--r-- 1 jasonatwood staff 17 Dec 13 18:00 user-id.txt.lock
If I understand correctly, I don't need to delete any of these.
The local task cache in the .gradle directory within the root project might interfere.
In order to disable the local/global caching altogether, use gradle.properties:
org.gradle.caching=false
If you remove the local build cache and don't use a remove cache, Gradle should indeed not be able to fetch anything cached on the next build. However, I don't think you actually removed anything.
The GRADLE_HOME environment variable, if you have it, should points to an unpacked local Gradle distribution. It could be something like /Users/jasonatwood/gradle-6.0-all. It would be wrong to set it to a path that is not a Gradle distribution.
The Gradle build cache resides in /Users/jasonatwood/.gradle/caches/build-cache-1.
When you try to remove it with $ rm -rf $GRADLE_HOME/caches/build-cache-*, you are using GRADLE_HOME as if it is pointing to the root of your home folder (/Users/jasonatwood), which it most likely isn't.
So instead, use this for removing it: $ rm -rf ~/.gradle/caches/build-cache-*
Or, at the very least, verify that the cache folder has indeed been removed.
If I run a --scan and look at the FROM-CACHE tasks in the generated HTML report.
I then look at the build cache keys for those FROM-CACHE tasks. I then go find those keys on my local machine. I see they are generated at the same time as the rest of the build. So I'm guessing that Gradle is using build cache within a build and not just across builds.
Sometimes there is a need to invalidate cache every time you restart the IDEA. This may be due to shared indexes reuse. What I did Settings --> Tools --> Shared Indexes -> Download Automatically and it resolved all the pain.
Earlier the setting was Don't download use Local.

My metasploit module(s) not found/loading

Any custom metasploit module I create isn't getting loaded.
I tried both of these demos:
https://www.offensive-security.com/metasploit-unleashed/building-module/ https://github.com/rapid7/metasploit-framework/wiki/Loading-External-Modules
and got the same result that the modules were NOT found.
Before posting here, I checked these out:
https://forums.kali.org/showthread.php?28940-Metasploit-modules-not-loading!
https://www.offensive-security.com/metasploit-unleashed/modules-and-locations
and from SO:
I can't get new modules to load in metasploit
How to add module in Metasploit?
no help
Just working with the github example, on the Kali host, I do indeed have the file in the right location (according to the demo):
root#kali:~/.msf4/modules/exploits/test# ls -al
total 12
drwxr-xr-x 2 root root 4096 Mar 19 13:59 .
drwxr-xr-x 3 root root 4096 Mar 19 13:58 ..
-rw-r--r-- 1 root root 9 Mar 19 13:59 test_module.rb
I then ran reload_all and when using this command:
use exploit/test/test_module it returns with Failed to load module.
I also tried to manually load that path and it failed too:
msf > loadpath ~/.msf4/modules/
Loaded 0 modules:
Posting the answer for anyone who may come across this. I'm kinda new to this; didn't know where metasploit info gets logged.
It's in: ~/.msf4/logs/framework.log
The log told me I had a syntax error... must have happened from copying and pasting the text from the browser. Cleaned that up and everything works.

Building Gem - InvalidSpecificationException […] are not files

This issue has been brought up several times. Past solutions have revolved around Git files not added and committed. What should one do if, by all accounts, Git has been properly handled and the error still appears.
rake aborted!
Gem::InvalidSpecificationException: ["Gemfile", "Gemfile.lock",
"lib/sysstandards/ext/abstract_interface.rb",
"lib/sysstandards/ext/mainframe_constants.rb",
"lib/sysstandards/ext/text_box_formatters.rb", "spec/ext",
"spec/ext/abstract_interface_spec.rb",
"spec/ext/text_box_formatters_spec.rb"] are not files
All the files listed above were new files. They were added to the repository. They were committed. The branch was positioned to master. The child branch was merged into master.
dvn#mint01 ~/RubymineProjects/SysStandards $ git status
On branch master
nothing to commit, working directory clean
The files show in the git listing.
dvn#mint01 ~/RubymineProjects/SysStandards $ git ls-files
Gemfile
Gemfile.lock
...
lib/sysstandards.rb
lib/sysstandards/chgtable.rb
lib/sysstandards/ext/abstract_interface.rb
lib/sysstandards/ext/file_flocked.rb
lib/sysstandards/ext/load_params.rb
lib/sysstandards/ext/mainframe_constants.rb
lib/sysstandards/ext/text_box_formatters.rb
...
spec/ext/abstract_interface_spec.rb
spec/ext/text_box_formatters_spec.rb
I'm really lost on this one. I have looked at the similar questions, followed their advice, but to no avail. I cannot get around this, thus, I cannot get the gem built. Please let me know what other information you may require.
I'm on the verge of deleting .git and starting from scratch. But there is a lot of history that will be lost if I do. I'll wait until Monday to see if anyone has any guidance. But on Monday, I think I'll ditch Git and switch to Fossil.
Thanks for your time and consideration,
dvn
Update to issue showing gemspec
spec = Gem::Specification.new do |s|
s.name = 'SysStandards'
s.version = '3.0.0'
s.has_rdoc = true
s.extra_rdoc_files = ['readme.md', 'LICENSE']
s.summary = 'Standards Library'
s.description = s.summary
s.author = 'Don V Nielsen'
s.email = 'donvnielsen#gmail.com'
# s.executables = ['your_executable_here']
s.files = %w(LICENSE readme.md Rakefile Gemfile Gemfile.lock Rakefile) + Dir.glob("{lib,spec}/**/*")
s.require_path = "lib"
s.bindir = "bin"
end
GEM
rake (12.0.0)
rspec (3.5.0)
PLATFORMS
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]
x64-mingw32
x86-mingw32
BUNDLED WITH
1.10.6
Update with file listings
dvn#mint01 ~/RubymineProjects/SysStandards $ ls -l
total 40
drwx------ 2 dvn dvn 4096 Oct 30 11:16 coverage
drwxr-xr-x 2 dvn dvn 4096 Feb 23 09:46 doc
-rw-r--r-- 1 dvn dvn 139 Feb 23 12:20 Gemfile
-rw-r--r-- 1 dvn dvn 629 Feb 23 12:20 Gemfile.lock
drwxr-xr-x 3 dvn dvn 4096 Feb 23 12:20 lib
-rw-r--r-- 2 dvn dvn 65 Apr 1 2013 LICENSE
drwxr-xr-x 3 dvn dvn 4096 Feb 22 18:38 pkg
-rw-r--r-- 1 dvn dvn 1169 Feb 23 15:39 Rakefile
-rw-r--r-- 1 dvn dvn 890 Feb 23 12:20 readme.md
drwx------ 6 dvn dvn 4096 Feb 23 12:20 spec
dvn#mint01 ~/RubymineProjects/SysStandards $ ls -l ./lib/sysstandards/ext
total 20
-rw-r--r-- 1 dvn dvn 1259 Feb 23 12:20 abstract_interface.rb
-rw-r--r-- 1 dvn dvn 388 Feb 23 12:20 file_flocked.rb
-rw-r--r-- 1 dvn dvn 345 Feb 23 12:20 load_params.rb
-rw-r--r-- 1 dvn dvn 540 Feb 23 12:20 mainframe_constants.rb
-rw-r--r-- 1 dvn dvn 1366 Feb 23 12:20 text_box_formatters.rb
dvn#mint01 ~/RubymineProjects/SysStandards $ ls -l ./spec/ext
total 8
-rw-r--r-- 1 dvn dvn 747 Feb 23 12:20 abstract_interface_spec.rb
-rw-r--r-- 1 dvn dvn 941 Feb 23 12:20 text_box_formatters_spec.rb
So What is File.symlink
The exception is thrown from the following code in gem::specification.rb:
#files.delete_if { |x| File.directory?(x) && !File.symlink?(x) }
#test_files.delete_if { |x| File.directory?(x) && !File.symlink?(x) }
#executables.delete_if { |x| File.directory?(File.join(#bindir, x)) }
#extra_rdoc_files.delete_if { |x| File.directory?(x) && !File.symlink?(x) }
#extensions.delete_if { |x| File.directory?(x) && !File.symlink?(x) }
non_files = files.reject { |x| File.file?(x) || File.symlink?(x) }
unless not packaging or non_files.empty? then
raise Gem::InvalidSpecificationException,
"[\"#{non_files.join "\", \""}\"] are not files"
end
#files comes into this code holding 46 entries: files and directories. The #files.delete_if should remove the directories, and the result is 36 remaining entries. Among the 36 survivors is 'spec/ext', which is a directory per 'ls -l':
dvn#mint01 ~/RubymineProjects/SysStandards/spec $ ls -l
total 32
-rw-r--r-- 1 dvn dvn 1353 Feb 23 12:20 change_table_spec.rb
drwx------ 3 dvn dvn 4096 Oct 30 11:17 data
drwxr-xr-x 2 dvn dvn 4096 Feb 23 12:20 ext
When files.reject is executed, the result is seven entries in non_files: the one directory and six files. This is the cause of the exception. So it appears that File.symlink? is triggering the issue. What is a File.symlink, what sets the value, and how does the value get set?
Deleting the /pkg folder and re-running rake gem fixed the problem.
The problem stemmed from the existing /pkg folder. I identified the problem by adding puts Dir.getwd to Rakefile and specification.rb. Rakefile gathered the project files from my project folder and specification.rb gathered files from the package build folder.
Rakefile : /home/dvn/RubymineProjects/SysStandards
Specification: /home/dvn/RubymineProjects/SysStandards/pkg/SysStandards-3.0.0
So, for reasons unknown, the package build folder was not being updated with the added/changed files. I'm assuming some decision determined that the folder did not require updating.
Deleting the /pkg folder fixed the problem, forcing the gem process to rebuild its pkg build folder, thus copying the affected files.
I'm concerned that Gemfile and Rakefile were ending up in the non_files list. Those two files have been present in the project from the very beginning; they are not new files. So what exactly triggered them to go in.
Unfortunately, I was an idiot. I solved the problem by deleting the /pkg folder. I should have renamed it, keeping its contents. Duh. Now I have nothing to compare against.

Failed to archive Cocoa application with command-line tool inside Executables

I stuck with this problem in my project, so, I tried it with an empty test project. Here is what I do.
Create a new Cocoa application project in Xcode.
Add a new command-line tool target to it.
Add this target to the dependencies of the cocoa app.
In cocoa app target build phases add Copy files build phase, Destination = Executables, add executable product to the list.
Now Run cocoa application. No problem, application launched. Navigate app bundle in Finder, Show package contents, executable here in Contents/MacOS. This is what I expect to be.
The problem occurs when I archive cocoa application, it fails with the following error:
(null): error: /Users/prudnikov/Library/Developer/Xcode/DerivedData/TestAppWithExecutable-hiysgipuqcktgoayxrgjfrtcxubl/Build/Intermediates/ArchiveIntermediates/TestAppWithExecutable/BuildProductsPath/Release/TestAppExecutable: No such file or directory
Here is a screenshot
Here is content of this directory
prudnikov#Vladimirs-iMac ~ $ ls -al /Users/prudnikov/Library/Developer/Xcode/DerivedData/TestAppWithExecutable-hiysgipuqcktgoayxrgjfrtcxubl/Build/Intermediates/ArchiveIntermediates/TestAppWithExecutable/BuildProductsPath/Release/
total 8
drwxr-xr-x 5 prudnikov staff 170B Apr 26 21:59 ./
drwxr-xr-x# 3 prudnikov staff 102B Apr 26 21:59 ../
drwxr-xr-x 3 prudnikov staff 102B Apr 26 21:59 TestAppExecutable.dSYM/
lrwxr-xr-x 1 prudnikov staff 239B Apr 26 21:59 TestAppWithExecutable.app# -> /Users/prudnikov/Library/Developer/Xcode/DerivedData/TestAppWithExecutable-hiysgipuqcktgoayxrgjfrtcxubl/Build/Intermediates/ArchiveIntermediates/TestAppWithExecutable/InstallationBuildProductsLocation/Applications/TestAppWithExecutable.app
drwxr-xr-x 3 prudnikov staff 102B Apr 26 21:59 TestAppWithExecutable.app.dSYM/
Archiving executable — no problems. All build settings are defaults.
I've also tried to change build configuration from Debug to Release for Run action of Cocoa application scheme. It runs successfully in this case as well.
This is very strange for me. Please advice how to do it?
UPDATE: It seems that I have problem with OS. People tried the same example and it worked. Then I trien to create a new account on my Mac and do the same there and it worked as well. What global configuration can cause this?
I don't think this is an Answer but it's too long for a comment.
Check the parent directories
gdunham: ~/Library/Developer/Xcode/DerivedData$ ls -laeG /Users/gdunham/Library/Developer/Xcode/DerivedData | grep -e " \\.$"
drwxr-xr-x 31 gdunham staff 1054 Apr 15 14:29 /Users/gdunham/Library/Developer/Xcode/DerivedData
drwxr-xr-x 13 gdunham staff 442 May 1 19:56 /Users/gdunham/Library/Developer/Xcode
drwxr-xr-x 4 gdunham staff 136 Mar 8 2012 /Users/gdunham/Library/Developer/
drwx------# 66 gdunham staff 2244 Apr 2 22:43 /Users/gdunham/Library
0: group:everyone deny delete
drwxr-xr-x+ 62 gdunham staff 2108 Apr 30 14:33 /Users/gdunham
0: group:everyone deny delete
drwxr-xr-x 7 root admin 238 Feb 20 14:16 /Users
drwxr-xr-x 34 root wheel 1224 Apr 20 09:26 /
Also look at your group membership
gdunham: ~/Library/Developer/Xcode/DerivedData$ groups
staff com.apple.access_screensharing com.apple.access_screensharing-disabled everyone _appstore localaccounts _appserverusr admin _appserveradm _lpadmin _lpoperator _developer com.apple.sharepoint.group.1

Phusion Passenger, mod_rails rails 2.3 problem

"The application has exited during startup (i.e. during the evaluation of config/environment.rb). The error message may have been written to the web server's log file. Please check the web server's log file (i.e. not the (Rails) application's log file) to find out why the application exited."
I'm getting the above error message when I try to access my test site.
Permission for config/* is
-rw-r--r-- 1 www-data root 2011 Aug 27 20:17 environment.rb
drwxr-xr-x 3 root root 4096 Aug 27 20:17 environments
drwxr-xr-x 3 root root 4096 Aug 27 20:17 initializers
drwxr-xr-x 3 root root 4096 Aug 27 20:17 locales
-rw-r--r-- 1 root root 2431 Aug 27 20:17 routes.rb
I've tried "root root 2011 Aug 27 20:17 environment.rb" as well but no success either.
I'm running Debian GNU/Linux and have other Rails sites running fine on the same server, I have tried to replicate the setup from one of the other sites, but it's not having any effect.
I encountered this same issue, and after killing passenger and apache ended up finding:
http://geminstallthat.wordpress.com/2009/03/01/passenger-with-rails-23-application-missingsourcefile/
Essentially the issue is for some versions of libapache2-mod-passenger the app/controllers/application.rb change to app/controllers/application_controller.rb (in Rails 2.3) explodes things (technical term).

Resources