Can't save when running "jekyll serve" on Windows 8.1, Notepad++ - ruby

I am trying to use jekyll locally to build my website. It is all set up, and I can build and serve and see results at localhost:4000. There are no errors.
The problem is that when I run "Jekyll serve" I can't save files. The save option is greyed out and "ctrl + s" wont work.
I can open and edit the files, can do "Save As" and do other things - basically anything except saving.
I can save files when I am not serving them.
From what I understand, Jekyll is intended to be used to allow saving while serving so we can see our changes as we go. The auto-regenerate function (now a default with serve) supports that use.
I suspect the problem relates to some sort of permissions-type rule stopping me from editing files that are in use.
But because I am self-taught newbie and am not a developer/programmer, I don't know if it is something to do with how I have set up jekyll, notepad++, permissions or something else entirely.
Here is my environment:
Windows 8.1 64-bit
Ruby v2.1.5p
Jekyll v2.5.1
wdm v0.1.0
RubyDevKit
Notepad++ (in admin mode)
Here is what I have tried:
Scaled back the listen gem from v2.10.0 to v2.7.11 (the earlier was listed as safe/tested on a jekyll on windows website)
Scaled back Jekyll from v2.5.3 to v2.5.1 (the earlier was listed as safe/tested on a jekyll on windows website)
Opened Notepad++ in admin mode instead of normal mode.
Tried executing jekyll serve --watch (in case watch enabled saving)
I have not tried re-installing ruby v2.1.3 (listed as safe/tested on a Jekyll on windows website) because Jekyll is otherwise working I don't want to try a re-install except as a last resort - as a newbie I found it a pain to install it on Windows in the first place.
Can anyone help me with this (probably simple) issue?
I thank you for any assistance in advance.

Okay. So I feel really stupid.
But instead of pretending this never happened, I had better post this answer in case anyone else has a blonde 'moment' (read: an entire day) like I did:
Firstly, you can't edit the _config.yml files while serving. You can edit the other files - html, markdown, etc - but not the config file.
Secondly, in Notepad++ you need to make an actual change to a document before the saving option will appear.
I was using the _config file as my 'test' document for regeneration. While I did open up other files to check when I first thought I had an issue, I THINK I may not have made any changes to them - so the option to save them was never activated. After that, I only looked at the config file after making changes.
So, I THINK I may have been able to save while serving all along.
However, if I am wrong and it wasn't my own stupidity (which I strongly doubt), the steps I took which fixed it were:
Those steps outlined in my question; and
A reinstall of Notepad++ (as kindly recommended by 'nerver nerver' who has since removed his/her comment after I said that did not work).
SORRY ... and excuse me while I go and crawl away and hide in shame ...

If the files you were editing at that time was only _config.yml then the expected behavior is that the saved changes are not reflected when the Jekyll server is running/watching.
This is because the server is started after reading the configuration settings in _config.yml, and then changes that happen to that special file after that are not monitored by Jekyll (this is current as of May 2015, in case this gets changed in the future). Currently this is by design. see this SO question as well
What that means is, you have been saving the file when Jekyll is running just fine, the changes just do not get updated. A way to check this is to make some changes, close the file, then open it again (if you want to be extra sure, open in another editor) and see if reflected changes show up.
Changes made to other files in Jekyll when the server is running will be reflected. For example, if I edit a typo in a blog post, edit CSS files or change some formatting, and save in any text editor, Jekyll will regenerate the file from scratch and you should be able to see the changes by refreshing the localhost:4000 page (or whereever your server is running at).
I'm not sure about running Jekyll on Windows, but on a Linux terminal, Jekyll actually notified the number of files that have changed (with a timestamp) and that it regenerated X number of files. Something like
<timestamp> 3 files have changed. Regenerated 3 files in 0.0536 sec..
Lastly, this is probably not your issue, but I thought I might add this here for future reference, do not edit the files inside the _site folder, as they are always deleted and regenerated whenever the server is started again. Editing those files by hand might save and display changes, but the changes will be lost (because they are, statically generated every time by Jekyll)
TL;DR You most probably have been saving your files! The changes in _config.yml are just not reflected once the server is running, and has to be restarted for the new configuration parameters to take effect.

Related

Odoo - How To Manage & Update Static Files

Static Files in Odoo
I'm new to Odoo, and am working through developing a custom theme for a client. I've worked through the theme tutorial despite the many errors and omissions that exist in that documentation (going to make a pull request to update that after I'm done). My latest struggle is dealing with static files in Odoo, specifically images in the theme.
The Setup
Running Odoo 13.0.20200323 on Ubuntu 18.04 in VirtualBox managed by Vagrant and provisioned with Ansible
The Problem
Changes to image files in the static folder are not reflected on the website. This includes updating the theme in the website theme settings (the update function seems to update everything else). I've changed image names, image content, moved them into other folder, and have not been able to figure out how to have any changes updated on the website. I've restarted the server, doesn't change anything. Updated the theme as stated above, doesn't work. The only way I've been able to have any changes reflected on the front end is to completely destroy and rebuild the server.
Questions
What am I missing? Is there a function I'm not running to trigger Odoo to update what it serves from the static folder?
How does Odoo work with static files in general? On the fly updates to files in the static folder don't seem to have any changes on the front end. Are the files in the static folder copied somewhere else on install, and then served from that other location?
Understanding
I understand that having images and other files change in a folder called static, doesn't make much sense functionally, and that's not my intention for this. Since I'm in development I need to make changes to files, like SCSS, JS, and images, and have those updates reflected on the front end without having to destroy and rebuild the server every time. To be clear, changes to SCSS and JS files that I've registered in .xml files and bundled with various Odoo bundles update just fine when I make changes to them and then update the theme on the backend in the theme management view.
My desire is to understand how Odoo handles the files in the static folder in general, how to update those files properly, and how to manage them while developing and for release.
Answers
I've figured out an answer to the first part of the question as to what I'm doing wrong. It seems like a browser caching issue. When performing a hard reload, empty cache and hard reload, or visiting the site in an incognito window changes are reflected to imagery.
As far as I can tell Odoo is just serving files from the static folder directly. Please correct me if this is not the case.
Follow-up
Does anyone have a good solution for working with changes like this and dealing with browser caching issues?
Answer: I've set up a a couple gulp tasks that use gulp-rev (will replace with gulp-rev-all soon) rev-del and rev-rewrite to handle cache busting through appending hashes to the file names.
I'm going to try setting up Browser-sync in proxy mode to see how that deals with changes to files on reload. I'll report what I find!
Update: Browser-sync has worked well so far as expected. But was kind of useless until I figured out how to work out a fix for the problem below
Does anyone know of how to automate Odoo rebuilding SCSS, JS etc. bundles? So that on file change the theme can be updated and the results seen without having to manually update the theme on the backend to see the results?
Answer: The main task was figuring out how to get live HTML/XML updates working. Which meant building Odoo from the source, and not making any updates or changes to the theme on the backend or frontend from within the Odoo interface. Passing the option --dev xml to Odoo when starting it with odoo-bin allows for the XML code to be evaluated directly, and makes live updates possible. But this extremely helpful (almost necessary) functionality is broken when you make any updates to the them from within Odoo. I'll report on any work arounds to this, but for now as long as I don't touch the theme from within Odoo (update the theme or make edits to it with their editor) then it works great. Also I had to bypass bundling my CSS and JS with their bundler initially to get those updates working live, but may be able to go back and rebundle them now that the code is being evaluated directly.
⭐️Boilerplate and Tutorial Series ⭐️
I'm going to get my whole process for theme building dialed in and then I'll be sharing the boilerplate and build tools on GitHub and also writing and filming a tutorial series on it. Since the built in documentation on that front is straight up error filled, omits critical information and also

Magento site still not updating after changes to files

I have been trying to get my Magento site to take some changes but it is still not refreshing the changes. I have disabled caching and flushed all of them on every single occasion I have also cleared my browser cache and it still does not take changes. I have gone as far to delete several files from the server that the theme relies on but it still functions like nothing was ever removed! What could be my issue?
You keep editing those files. I do not think those files are the files you think they are.
You question is pretty short on details, but my first guess if your system is running with the compiler enabled, which means it's loading its class files from
includes/src
Googling around to learn about the compiler would be a good idea.
I'd try adding the following to the end of your index.php file
echo '<--';
print_r(get_included_files());
echo '-->';
This will list every file PHP used during the request. Compare the full paths with the ones you're editing, and I bet you'll find a discrepancy.

Prompt to reload an externally modified file in Textmate 2?

Im finding myself using TextMate 2 more and more for development these days
One thing that is bugging me is that it does not seem to reload a file when it is changed externally.
This is a big problem since I use terminal to switch git branches a lot, and it often results in accidentally saving an older version over the new branch
Sadly the TM team seem to have disabled the Issue tracker on github, and documentation just seems scattered far and wide over the web in tiny scraps.
Any ideas?
Right now it reloads the file silently whenever the file on Disk is changed. There is currently no option for a prompt.
Regarding the closed issue tracker: As an alternative, you can always send a mail to the Textmate users list if you find a problem.
I just updated to TM 2. In the past, I have enjoyed using TM to view development.log as I am introducing new or modified code. TM 1 would ask me if I want to revert to what's on disk and of course I would respond with Yes. Then I could see any additions to the log file. Occasionally I would empty the log file with Cmd+A, Delete, Cmd+S. Macromates, please make TM 2 work like TM 1 reloading content.
I also could not find a solution to this problem which is still there, however it is possible to file an issue using this contact page: http://macromates.com/support
Additionally there are hidden setting which cannot be set from the GUI. Unfortunately they don't include and setting for automatic load from disk: https://github.com/textmate/textmate/wiki/Hidden-Settings

ClickOnce Error "different computed hash than specified in manifest" when transferring published files

I am in an interesting situation where I maintain the code for a program that is used and distributed primarily by our sister company. We are ready to distribute the program to all of the 3rd party users and since it is technically our sister companies program, we want to host it on their website. (in the interest of anonimity, I'll use 'program' everywhere instead of the actual application name, and 'www.SisterCompany.com' instead of their actual URL.)
So I get everything ready to go, setup the Publish setting to check for updates at program start, the minimum required version, and I set the Insallation Folder URL and Update Location to "http://www.SisterCompany.com/apps/program/", with the actual Publishing Folder Location as "C:\LocalProjects\Program\Publish\". Everything else is pretty standard.
After publish, I confirm that everything installs and works correctly when running directly from the publish location on my C: drive. So I put everything on our FTP server, and the guy at our sister company pulls it down and places everything in the '/apps/program/' directory on their webserver.
This is where it goes bad. When I try to install it from their site, I get the - File, Program.exe.config, has a different computed hash than specified in manifest. Error. I tested it a bit, and I even get that error trying to install from any network location on our network other than my local C: drive.
After doing the initial publish in visual studio, I have changed no files (which is the answer/reason I've found by doing some searching about this error).
What could be causing this? Is it because I set the Installation Folder URL to a location that it isn't initially published too?
Let me know if any additional info is needed.
Thanks.
After bashing my head against this all weekend, I have finally found the answer. After unsigning the project and removing the hash on the offending file (an xml file), I got the program to install, but it was giving me 'Windows Side by Side' Errors. I drilled down into the App Cache were the file was, and instead of a config .xml file, it was one of the HTML files from the website the clickonce installer was hosted on. Turns out that the web server didn't seem to like serving up an .XML (or .mdb it turns out) file.
This MSDN article ended up giving me the final solution:
I had to make sure that the 'Use ".deploy" file extension' was selected so that the web server wouldn't mangle files with extensions it didn't like.
I couldn't figure out why that one file's hash would be different. Turns out it wasn't even the same file at all.
It is possible that one of the FTP transfers is happening in text mode, rather than binary?
For me the problem was that .config transformations were done after generating manifest.
To anyone else who's still having trouble, five years later:
The first problem was configuring the MIME type, which on nginx (/etc/nginx/mime.types) should look like this:
application/x-ms-manifest application
See Click Once Server and Client Configuration.
The weirder problem to me was that I was using git to handle the push to the server, i.e.
git remote add live ssh://user#mybox/path/to/publish
git commit -am "committing...";git push live master
Works great for most things, but it was probably being registered as a "change," which prevented the app from installing locally. Once I started using scp instead:
scp -r * user#mybox/path/to/dir/
It worked without a hitch.
It is unfortunate that there is not a lot of helpful information out there about this.

Sass development workflow issues

I've been trying to adopt Sass into my development workflow. I do primarily front-end development and as such, I am updating stylesheets quite frequently. After endless searching, I have yet to find the answer to what I feel should be a simple question.
I use both Coda and Textmate, so a solution for either would suffice. When developing locally, I open the terminal, get my .scss file watched, then go to town. I save my .scss file, it happily updates my .css file... and then I'm left with the slight annoyance of having to manually select the .css and publish it to the remote server. Its not the end of the world but having to pause my usual dev workflow to manually upload a file I'm not actively in is becoming a nuisance. In Coda, it doesn't detect when a file has been updated outside of Coda, so it isn't marked for publishing. Its driving me crazy. I just need a way to save the .scss file and have the .css file easily/automatically uploaded to the remote server. Any help would be greatly appreciated!
The typical way Sass is used is to design on your local computer while using Sass, and to only upload the CSS (and probably the Sass as well) to the server once you're finished. Another alternative would be to run sass --watch on the server so that it compiles the uploaded Sass files.
I have had a rake task that calls rsync for this kind of cases. That still needs to be run each time but because it uses rsync only the changed files are moved. Now, while reading this I got an idea that shouldn't there be 'rsync watch' somewhere and indeed there seems to be: http://code.google.com/p/lsyncd/
Here's an interesting approach I just read about, installing compass into a small local ruby env, inspired by python virtualenv:
http://rhodesmill.org/brandon/2011/adding-compass/
YMMV (I haven't even tried this myself).
The Sublime SFTP/FTP Plugin can monitor and auto-upload the .css output file whenever it's updated by the SCSS compiler.
Map your project directory to your server
Check it's woking correctly by browsing remote
Right click on your .css output file, and choose 'Monitor File (Upload on External Save)'
Keep the file's tab open in Sublime to ensure it stays monitored/uploaded.
For extra points, have a look at Browsersync or LiveReload.

Resources