# \[ANN\] Styles 'n Scripts v0.7

**URL:** <https://www.ruby-forum.com/t/ann-styles-n-scripts-v0-7/153972>\
**Category:** Radiant CMS\
**Created:** [November 24, 2008, 6:48am UTC](https://www.ruby-forum.com/t/ann-styles-n-scripts-v0-7/153972 "2008-11-24T06:48:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mahadewa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@mahadewa](https://www.ruby-forum.com/u/mahadewa)\
**Post date:** [November 24, 2008, 6:48am UTC](https://www.ruby-forum.com/t/ann-styles-n-scripts-v0-7/153972/1 "2008-11-24T06:48:46Z")

</div>

Time for a new release. This is mostly bugfixes and a minor addition or  
two to work with other extension:

```
* Renamed one of the TextAsset fields (internal change to let SnS
  work better with Andrew N.'s file_system extension).

* The radiant:extensions:sns:config rake task was just plain
  broken. I think most folks out there don't know about this tool
  or I'd have heard more complaints by now.

  Please note that this is *the* way to change the SnS settings --
  not directly in the db or with the settings extension as these
  bypass validations I have in place and, since I store these
  settings in memory, don't take effect until you restart your
  server. The rake task, however, works properly and immediately.

* There was an issue with one of the migrations if you had existing
  stylesheets/javascripts from an early SnS version (fringe case).

* Changed the name of a model so that SnS now "just works" with the
  import-export and super-export extensions (nice tools, BTW)

* Added the radiant:extensions:sns:update_dependencies rake task to
  recreate the dependencies table if you had a problem importing
  existing data (see above).

```

> **[GitHub - SwankInnovations/radiant-sns-extension: Adds Stylesheet and Javascript...](https://github.com/SwankInnovations/radiant-sns-extension/tree/master)**
>
> master

-Chris

---

<div class="post-metadata">

**Author:** ![mahadewa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@mahadewa](https://www.ruby-forum.com/u/mahadewa)\
**Post date:** [November 24, 2008, 2:28pm UTC](https://www.ruby-forum.com/t/ann-styles-n-scripts-v0-7/153972/2 "2008-11-24T14:28:49Z")

</div>

Thanks Chris,

This means that it is time for me to announce my sns\_file\_system  
extension:

[GitHub - nelstrom/radiant-sns\_file\_system-extension: Add file\_system behaviour to the SnS extension](http://github.com/nelstrom/radiant-sns_file_system-extension/tree/master)

Also on the Radiant extensions repository:

```
http://ext.radiantcms.org/extensions/69-sns-file-system

```

You will need the latest version of the file\_system extension[1](http://github.com/nelstrom/radiant-file-system-extension/tree/master), as  
well as  
Chris’s latest (0.7) release of SnS.

With this extension installed, the styles and scripts are extended to  
include the file\_system functionality. This means that you can save to  
the  
file system all of the stylesheets and javascripts that are managed  
through  
the Radiant interface, by running the rake command `rake file_system:to_files`. Any changes you make to these files can then be  
loaded back in to the database by running `rake file_system:to_db`.

If you have written an extension, and you would like for it to piggy  
back on  
the file\_system extension, you might consider sns\_file\_system to be a  
useful  
reference. Sean’s template extension[2](http://github.com/seancribbs/radiant-templates-extension/tree/master) also does this.

Cheers,  
Drew

On Mon, Nov 24, 2008 at 5:47 AM, Chris P. \<

---

<div class="post-metadata">

**Author:** ![mahadewa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@mahadewa](https://www.ruby-forum.com/u/mahadewa)\
**Post date:** [November 24, 2008, 3:20pm UTC](https://www.ruby-forum.com/t/ann-styles-n-scripts-v0-7/153972/3 "2008-11-24T15:20:36Z")

</div>

Chris P. said the following on 11/24/2008 12:47 AM:

> Time for a new release. This is mostly bugfixes and a minor addition or  
> two to work with other extension:

Hint, please, as to the ways we might update depending on the way we  
installed.

–  
“The Air Force is reacting to the EPA ban on CFC’s by replacing them in  
the cooling systems of the ICBMs. If they are ever fired, it will be an  
environmentally friendly nuclear holocaust, not threatening the Ozone  
layer.” – _Access to Energy_, July 1993

---

<div class="post-metadata">

**Author:** ![mahadewa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@mahadewa](https://www.ruby-forum.com/u/mahadewa)\
**Post date:** [November 24, 2008, 7:45pm UTC](https://www.ruby-forum.com/t/ann-styles-n-scripts-v0-7/153972/4 "2008-11-24T19:45:09Z")

</div>

Chris P. said the following on 11/24/2008 12:29 PM:

> ## Updating
> 
> updating SnS is the same as every other extension, run:
> 
> ```
> rake [your_env] radiant:extensions:sns:install
> 
> ```

OH WOW! All the git/svn stuff encoded in a rake file!  
Why has no-one ever done that before?  
Please can we have this done recursively from the root!  
Please!

–  
A lot of managers talk about ‘thinking out of the box,’ but they don’t  
understand the communication process by which that happens. You do not  
think out of the box by commanding the box! You think out of the box  
precisely by bringing ideas together that don’t allow dominant ideas to  
continue to dominate.

- Stan Deetz

---

<div class="post-metadata">

**Author:** ![mahadewa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@mahadewa](https://www.ruby-forum.com/u/mahadewa)\
**Post date:** [November 24, 2008, 8:21pm UTC](https://www.ruby-forum.com/t/ann-styles-n-scripts-v0-7/153972/5 "2008-11-24T20:21:03Z")

</div>

Um, no. (Though it would be very cool). In order to make use of the  
‘install’ task, you have to have the latest version of SnS (or any  
extension) copied into the extension’s directory (from github, svn, or  
wherever).

Install in this sense, means:  
“migrate the db, copy any needed files into your project’s /public  
folder, do anything else the extension writer deems necessary to get  
things working”

and not:  
“go get the latest version and then install that”

I think the Ray extension may do what you’re looking for.

-Chris

---

<div class="post-metadata">

**Author:** ![mahadewa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@mahadewa](https://www.ruby-forum.com/u/mahadewa)\
**Post date:** [November 24, 2008, 6:30pm UTC](https://www.ruby-forum.com/t/ann-styles-n-scripts-v0-7/153972/6 "2008-11-24T18:30:26Z")

</div>

## Updating

updating SnS is the same as every other extension, run:

```
rake [your_env] radiant:extensions:sns:install

```

The install task is new to SnS in v0.7. In previous versions (and with  
other extensions that dont’ have an install task), run:

```
rake [your_env] radiant:extensions:[ext_name]:migrate
rake [your_env] radiant:extensions:[ext_name]:update
rake [your_env]

```

radiant:extensions:[ext\_name]:any-other-task-needed-by-ext

## Problems With Backing Up

That said, a month or so ago Anton ran into problems when trying to port  
data from one Radiant project to another (not quite the same as updating  
an existing project). In his case, during the backup/restore, the  
text\_asset\_dependencies table was copied, and the records were copied –  
but not their data. As you can imagine, SnS didn’t like that and threw  
an error when it couldn’t find the expected data.

Normally, I’d chalk this up to a failure in the import/export process  
(he copied and pasted data manually using a sqlite editor) but then Nate  
Turnage posted with (essentially) the same problem using the  
Import-Export extension. Except in his case, that table just wasn’t  
exported because of how the SnS table and model were named (it ignored  
them). With this release, I’ve changed SnS so that Import-Export (and  
Super-Export) extensions will automatically find the models now. (And  
I’ve submitted a patch to those extensions so that this won’t happen  
with other extensions).

## Backup & Restoring

Rules for copying data from one db to another (SnS or otherwise): Copy  
_all_ the data. If using the same db in both places, I might suggest  
using your db’s dump tools. The importing-and-exporting extensions  
should now work just fine for you too.

## New SnS Data Recreation Tool

I’ve added a new rake task in SnS to repair/rebuild the  
text\_asset\_dependencies table. It exists for a special migrations case  
but it would also help the two situations above. Just run:

```
rake [your_env] radiant:extensions:sns:rebuild_dependencies

```

And SnS will rebuild the text\_asset\_dependencies table (the table must  
exist but it handles both missing and empty records).

-Chris
