Open lgiordani opened 11 years ago
We've added support for this in our 2.1 branch, but it may still be a bit shaky. Try it for us and see what happens?
I tried with a bare repository. After cloning http://github.com/imathis/octopress.git I tracked your 2.1 branch with git checkout -t remotes/origin/2.1
and rake setup_github_pages
returns
Enter the read/write url for your repository: https://github.com/lgiordani/lgiordani.github.com.git
Added remote https://github.com/lgiordani/lgiordani.github.com.git as origin
Set origin as default remote
Master branch renamed to 'source' for committing your blog source files
rm -rf _deploy
mkdir _deploy
cd _deploy
Initialized empty Git repository in /home/leo/lgiordani.github.com/_deploy/.git/
Attempting to pull from repository
fatal: Couldn't find remote ref master
Unexpected end of command stream
[master (root-commit) 4418360] Octopress init
1 file changed, 1 insertion(+)
create mode 100644 index.html
cd -
{:deploy_branch=>"master", :deploy_dir=>"_deploy", :copy_dot_files=>[], :deploy_default=>"push"}
rake aborted!
undefined method `has_key?' for nil:NilClass
/home/leo/lgiordani.github.com/Rakefile:428:in `block in <top (required)>'
Tasks: TOP => setup_github_pages
(See full trace by running task with --trace)
Full trace is here
** Invoke setup_github_pages (first_time)
** Execute setup_github_pages
Enter the read/write url for your repository: https://github.com/lgiordani/lgiordani.github.com.git
Added remote https://github.com/lgiordani/lgiordani.github.com.git as origin
Set origin as default remote
Master branch renamed to 'source' for committing your blog source files
rm -rf _deploy
mkdir _deploy
cd _deploy
Initialized empty Git repository in /home/leo/lgiordani.github.com/_deploy/.git/
Attempting to pull from repository
fatal: Couldn't find remote ref master
Unexpected end of command stream
[master (root-commit) 6e2dcd4] Octopress init
1 file changed, 1 insertion(+)
create mode 100644 index.html
cd -
{:deploy_branch=>"master", :deploy_dir=>"_deploy", :copy_dot_files=>[], :deploy_default=>"push"}
rake aborted!
undefined method `has_key?' for nil:NilClass
/home/leo/lgiordani.github.com/Rakefile:428:in `block in <top (required)>'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:228:in `call'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:228:in `block in execute'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:223:in `each'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:223:in `execute'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:166:in `block in invoke_with_call_chain'
/usr/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:159:in `invoke_with_call_chain'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:152:in `invoke'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:143:in `invoke_task'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:101:in `block (2 levels) in top_level'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:101:in `each'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:101:in `block in top_level'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:110:in `run_with_threads'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:95:in `top_level'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:73:in `block in run'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:160:in `standard_exception_handling'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:70:in `run'
/var/lib/gems/1.9.1/gems/rake-10.0.3/bin/rake:33:in `<top (required)>'
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23:in `<main>'
Tasks: TOP => setup_github_pages
Sorry but I know nothing about ruby so I cannot really understand what's going on.
Installing gems with bundle install
installed the following
Fetching gem metadata from http://rubygems.org/........
Fetching gem metadata from http://rubygems.org/..
Installing rake (10.0.3)
Using RedCloth (4.2.9)
Installing chunky_png (1.2.6)
Using fast-stemmer (1.0.1)
Using classifier (1.3.3)
Using fssm (0.2.9)
Installing sass (3.2.4)
Using compass (0.12.2)
Using directory_watcher (1.4.1)
Using haml (3.1.7)
Using kramdown (0.13.8)
Using liquid (2.3.0)
Using syntax (1.0.0)
Using maruku (0.6.1)
Using posix-spawn (0.3.6)
Using yajl-ruby (1.1.0)
Using pygments.rb (0.3.4)
Using jekyll (0.12.0)
Installing jsmin (1.0.1)
Using rack (1.4.1)
Using rack-protection (1.3.2)
Installing rake-minify (0.4.0)
Installing rb-fsevent (0.9.3)
Using rdiscount (1.6.8)
Installing redcarpet (2.2.2) with native extensions
Using rubypants (0.2.0)
Using tilt (1.3.3)
Using sinatra (1.3.3)
Using stringex (1.4.0)
Installing tzinfo (0.3.35)
Using bundler (1.2.3)
I am available to test again the whole thing, just tell me what you need. Thank you
I think I found the problem (see Google Groups), but I have no knowledge to write a patch.
Got it. Problem is, as you discovered:
Spotted, I think: in Rakefile:427
site_configuration = Octopress::Configuration.read_config('site.yml')
but since _config/site.yml is an empty file
--- # --------------------------- # # User Site Configuration # # --------------------------- #
the resulting site_configuration is nil, hence the
undefined method `has_key?' for nil:NilClass
The above issue can be solved just entering
url: 'http://yoursite.com'
in _config/_site.yml
.
This is not the best way to handle the case, however. It would be best to insert the above line, but commented
# Uncomment this and set it according to your needs if you want to use a custom domain
# url: 'http://yoursite.com'
And handle in Rakefile the case of empty file.
Rakefile stops anyway because of current_url
undefined (used at line 435
and 445
).
Moreover, I find help text from lines 443
and 446
a little inaccurate. Problems I spotted:
To host at "your-site.com" [...] echo "your-domain.com"
- perhaps the two addresses should be the sameThen change the url in _config.yml
- _config.yml
is no more presenthttp://help.github.com/pages/#custom_domains
is now https://help.github.com/articles/setting-up-a-custom-domain-with-pages
What do you think? Thanks
I just fixed this! If the config file (YAML file) is empty, YAML
returns nil
. It now returns Hash.new
when there are no configs present. Ref #1005.
Thank you.
It still does not work because of the current_url
issue. See the above comment.
The pull request above should fix this issue with the undefined current_url
variable. I've also changed the comments with your suggestions @lgiordani
There's still stuff that's going to cause problems this part of the code.
This line in the setup_github_pages
task is loading explicitly the user's _config/site.yml
file, and then on the next line setting the url to a generated URL (defined here).
That means that the most current case (the default), where the user hasn't yet copied _config/default/classic.yml
to _config/site.yml
, site_configuration[:url]
is going to be nil
, because we're not loading _config/default/classic.yml
which contains the default value that we're checking against.
I think this has already been solved by @parkr with #1005.
Branch 2.1 already contains an empty _config/site.yml
which now does not need to be replaced by a copy of _config/defaults/classic.yml
.
However I understand the issue pointed by @gkarekinian. Why do both _config/site.yml
and _config/defaults/classic.yml
contain the same flag?
I think that probably _config/defaults/classic.yml
is meant to stay there untouched (as a default, indeed), while other files in _config
should overwrite its values. What is the point of this way? The only reason I see is to isolate the different parts of the old _config.yml
to allow a simpler customization. I'm not totally sure that this is a good thing, however.
Parker, can you clarify the purpose and structure of the new config system?
Thanks
I have been struggling to set up a brand new clone off of 2.1 as well, for the past few days (and hence #1006). Apart from the above findings, it also seemed to me that the branch itself needs to be called 'master' rather than '2.1' for 'setup_github_pages' to configure the 'deploy' correctly.
Can someone please explain how to setup '2.1' from scratch?
Thanks
@lgiordani The new configuration setup is meant to offer flexibility with plugins and their configurations and reduce merge conflicts. By having a user-defined set of configs (site.yml
) paired with defaults, we have more flexibility to update plugins and themes more easily. When we release the next version, we'll write about it.
@gkarekinian I think defaults/classic.yml
contains a nonsensical url
config that would have the same outcome as loading nothing. Should work fine unless I'm overlooking something.
@floydpink On your clone, check out master and merge 2.1 into it. Then run the rake task and you should be ok!
So, I just merged 2.1 into master, (on a brand new clone of master) then tried this. I tried it without editing anything and that failed. So I added a url: 'http://yoursite.com'
line and ran rake setup_github_pages
again, and still got an error. So I copied the entire classic.yml
file over to _config/site.yml
and filled in all the values and it's still saying >rake aborted!
undefined local variable or method
current_url' for main:Object >/Users/natedickson/Projects/Natedicksondotcom/octopress/Rakefile:512:in
blockin <top (required)>'
I'm taking a look at this now.
Let me know if this works better for you now.
I followed the steps @PogiNate mentioned (clone master then merge 2.1) but my issue is with this new config structure. It isn't making any sense to me.
What I did:
bundle install
then rake install
_config/defaults/pinboard-feed.yml
file adding my usernamerake generate
The blog is generated correctly but no Pinboard data is displayed. The /source/_includes/sidebars/blog_index_default.html
includes /source/_includes/sidebars/sections/pinboard.html
as expected (I just enterd dummy text on the page) but the feed is never displayed. I tested this with Github too but I think the problem is in how it's calling for the config settings. The start of /source/_includes/sidebars/sections/pinboard.html
references site.pinboard_user
. If I add pinboard_user
to /_config/site.yml
then it displays the HTML.
So if site.yml
only takes values that were used in 2.0 (they all seem to work) then what are all the files in the _config/defaults/
directory for?
Also, I get missing JS errors for javascripts/pinboard.js
and javascripts/octopress.js
. There are coffeescript files for these but no JS is generated. The only JS files that appear in the public folder after generating are:
/public/javascripts/build/all-9f4dbadb1810a27cbbd4cb451c39defe.js
/public/javascripts/libs/jquery.min.js
/public/javascripts/jquery.min.js
The js includes in the html header don't seem to match up with the assets available.
I discovered that if I just run rake setup_github_pages
and use the git@github
... address it works just fine. If I try to run the rake task with the https://github.com
... address it fails. However, if I run the setup task and then change the git setup after the fact to the https://
path then rake deploy
works just fine.
I'm working behind a firewall which allows me only http and https access to Internet. Following http://octopress.org/docs/deploying/github/ I get the following
it runs without problems if I insert
Bu then if I run
rake deploy
it stucks atI think this is because of SSH access being forbidden from my machine. Any help?
Thank you