Repository: getnikola/nikola

Issue:
output/assets/css/code.css is orphaned?
```
~/blog$ nikola build
Scanning posts................done!
copy_assets:output/assets/css/base.css
Scanning posts................done!
~/blog$ 
~/blog$ nikola build
Scanning posts................done!
~/blog$ nikola check -f
Scanning posts................done!
WARNING: check: Files from unknown origins (orphans):
WARNING: check: output/assets/css/code.css
~/blog$ nikola build
Scanning posts................done!
copy_assets:output/assets/css/base.css
~/blog$ nikola check -f
Scanning posts................done!
WARNING: check: Files from unknown origins (orphans):
WARNING: check: output/assets/css/code.css
```



Discussion:
It seem to happen at random. It’s either just code.css, or it’s every asset inherited from the base theme. My own assets at themes/mytheme/assets/ and /files/assets/ seem just fine.

.  copy_assets:output/assets/css/theme.css
.  copy_assets:output/assets/css/rst.css
.  copy_assets:output/assets/css/ipython.min.css
.  copy_assets:output/assets/css/nikola_ipython.css
.  copy_assets:output/assets/css/ipython.min.css.map
.  copy_assets:output/assets/js/fancydates.js
.  copy_assets:output/assets/js/moment-with-locales.min.js
.  copy_assets:output/assets/js/jquery.min.map
.  copy_assets:output/assets/js/html5.js
.  copy_assets:output/assets/xml/rss.xsl
.  copy_assets:output/assets/xml/atom.xsl

`copy_assets` is creating `output/assets/css/code.css`, but only if

```
utils.get_asset_path('assets/css/code.css',
                                              themes=kw['themes'],
                                              files_folders=kw['files_folders'])
```

returns something which evaluates to `False`. That somewhere where I'd start debugging.

(Actually, `get_asset_path` has a bug I think. When checking the file folders, it always assumes that they are put into `output/` without any subfolder. Maybe that is part of the problem here? Do you have a `assets/css/code.css` in some files folder which isn't copied to `output/` directly?)

I used to have one in themes/css/code.css that was empty. I’ve never had that for the other files, though. It’s  been deleted and any conceivable cache have been deleted including the  output folder.

I use the auto-generated file and also have this problem:

```
(nikola-py3)[kwpolska@kw-cassandra nikola Gmaster]% nikola check -fl
Scanning posts......done!
[2015-09-21T15:34:01Z] WARNING: check: Files from unknown origins (orphans):
[2015-09-21T15:34:01Z] WARNING: check: output/assets/css/code.css
```

This happens even in the demo site, so we should (in any order):

1) add a check to detect it
2) fix it

Also, happens with robots.txt

So, we had tests for "check -l" and "check -f" on the demo site but they were broken and succeeded even though the checks failed.


Resolving patch:
diff --git a/nikola/plugins/task/copy_assets.py b/nikola/plugins/task/copy_assets.py
--- a/nikola/plugins/task/copy_assets.py
+++ b/nikola/plugins/task/copy_assets.py
@@ -61,10 +61,7 @@ def gen_tasks(self):
         code_css_path = os.path.join(kw['output_folder'], 'assets', 'css', 'code.css')
         code_css_input = utils.get_asset_path('assets/css/code.css',
                                               themes=kw['themes'],
-                                              files_folders=kw['files_folders'])
-
-        kw["code.css_input"] = code_css_input
-
+                                              files_folders=kw['files_folders'], output_dir=None)
         yield self.group_task()
 
         for theme_name in kw['themes']:


Test patch:
diff --git a/tests/test_integration.py b/tests/test_integration.py
--- a/tests/test_integration.py
+++ b/tests/test_integration.py
@@ -307,18 +307,11 @@ class TestCheck(DemoBuildTest):
 
     def test_check_links(self):
         with cd(self.target_dir):
-            try:
-                __main__.main(['check', '-l'])
-            except SystemExit as e:
-                self.assertEqual(e.code, 0)
+            self.assertIsNone(__main__.main(['check', '-l']))
 
     def test_check_files(self):
         with cd(self.target_dir):
-            try:
-                __main__.main(['check', '-f'])
-            except SystemExit as e:
-                self.assertEqual(e.code, 0)
-
+            self.assertIsNone(__main__.main(['check', '-f']))
 
 class TestCheckAbsoluteSubFolder(TestCheck):
     """Validate links in a site which is: