Giter Club home page Giter Club logo

devcenter's Introduction

OpenShift Online Developer Center

Build Status

This repo contains the AsciiDoc sources for the OpenShift Online Developer Center.

Development Setup

If you don't have a GitHub account, start by creating a GitHub account.
Fork the devcenter project to your GitHub account.
Clone your newly forked repository into your local workspace

$ git clone [email protected]:[your user]/devcenter.git
Cloning into 'devcenter'...
remote: Reusing existing pack: 4745, done.
remote: Total 4745 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (4745/4745), 1.92 MiB | 1.52 MiB/s, done.
Resolving deltas: 100% (1475/1475), done.
Checking connectivity... done

Add a remote ref to upstream for pulling future updates

$ git remote add upstream https://github.com/openshift/devcenter.git

As a precaution, disable merge commits to your master branch

$ git config branch.master.mergeoptions --ff-only

Building w/Awestruct

Awestruct is a framework for creating static HTML sites, inspired by the Jekyll utility in the same genre. It requires at least Ruby 1.9.3 (see known issues).

First, install the awestruct and bundler gems and resolve any dependencies.

$ gem install awestruct bundler

Live Previews with Rake

This project uses Rake to assist with various development tasks. Run rake setup inside the project's lib folder to get started:

$ cd lib
$ rake setup

To generate the files, regenerate pages on changes, and start a server to preview the site in your browser at http://localhost:4242, run:

$ rake

This is a shortcut for rake preview.

If you need to clear out the generated site from a previous run (recommended), simply run

$ rake clean preview

Content on the live site will look exactly as it does in your development environment. Please verify each of your changes before submitting a pull request.

Contributing

You can preview your changes at devcenter-shifter.rhcloud.com once your Pull Request has been merged.

It's usually a good idea to start by submitting an issue describing your feedback or planned changes.

To contribute changes, first setup your own local copy of this project. Then, create a new branch (from master), to track your changes:

Make sure you have all current changes from upstream/master

$ git pull --rebase upstream master

Push the pulled updates to your fork of devcenter on GitHub

$ git push

Make sure there is an issue logged for your Bug Fix or Feature Request that you are working on here. Create a simple topic branch to isolate that work (just a recommendation)

$ git checkout -b my_cool_feature

Stage your changes and commit (one or more times)

$ git add en/my-new-file.adoc  
$ git commit -m 'ISSUE-XXX Making this awesome new feature'  
$ git add en/another-new-file  
$ git commit -m 'ISSUE-YYY Fixing this really bad bug'

Rebase your branch against the latest master (applies your patches on top of master)

$ git fetch upstream
$ git rebase -i upstream/master
# if you have conflicts fix them and rerun rebase
# The -f, forces the push, alters history, see note below
$ git push -f origin my_cool_feature

The -i triggers an interactive update which also allows you to combine commits, alter commit messages etc. It's a good idea to make the commit log very nice for external consumption. Note that this alters history, which while great for making a clean patch, is unfriendly to anyone who has forked your branch. Therefore you want to make sure that you either work in a branch that you don't share, or if you do share it, tell them you are about to revise the branch history (and thus, they will then need to rebase on top of your branch once you push it out).

After completing your changes, test and review them locally.

Finally, send us a Pull Request comparing your new branch with openshift/devcenter:master.

When you're done, reset your development environment by repeating the steps in this section: switch back to master, update your repo, and cut a new feature branch (from master).

Deployment

A hosted copy of these docs can be launched using the rhc command line tool.

Firstly, create an app on the rhcloud.

$ APP_NAME=staticdocs
$ NEW_GIT_REMOTE_URL=$(rhc app create $APP_NAME php-5.4 --no-git --no-dns | grep "Git remote:" | sed -e 's/.*Git remote: *\([^ ]*\)/\1/')
$ echo $NEW_GIT_REMOTE_URL
$ rhc app show $APP_NAME

Then, cd into your local devcenter/lib project folder, then run awestruct -u APP_BASE_URL to update it to your site.base_url:

$ cd devcenter/lib
# You should replace APP_BASE_URL with your own rhcloud app domain.
# e.g. https://devcenterdocs-mycustomdomain.rhcloud.com (note the https)
$ APP_BASE_URL=https://developers.openshift.com
# The awestruct command is necessary to correctly generate the static files' url
$ awestruct -u $APP_BASE_URL

Then, create a new git repository in the lib/_site folder and add your app's remote url.

$ cd devcenter/lib/_site/
# Note that there is a symbolic link for this folder (devcenter/public)
$ git init
$ git remote add $APP_NAME $NEW_GIT_REMOTE_URL
$ git add .
$ git commit -m "Add static doc files"
$ git push $APP_NAME master

Optionally, you can create a new directory outside of the devcenter scope and copy your files every time you recompile the site. This is cleaner but requires an additional step.

Rerun with different APP_NAME values to set up additional deployment targets. Subsequent deployments can be made with git push APP_NAME master.

By default, OpenShift will build your site using the master branch. To deploy an alternate branch, use rhc app configure:

rhc app configure -a APP_NAME --deployment-branch BRANCH_NAME

Adding New Sections

The page sources are human-readable .adoc files (AsciiDoc), which are intended to be published in various formats, usually HTML.

At a minimum, the first several lines of a new .adoc document must follow this pattern:

---
layout: base <1>
category: 03_Languages <2>
breadcrumb: Languages <3>
parent_url: <4>
nav_title: JBossAS/Wildfly <5>
nav_priority: 2 <6>
meta_desc: JBossAS Developers - OpenShift Resources to host your Java applications in the cloud. <7>
---
= JBossAS Overview <8>

Start writing your content here.

<1> .haml layout used by page (defined in _layouts - in general use base)
<2> Used for left-nav categorization/display. Number is priority level, String is leftnav display string
<3> Used for breadcrumbs - should be same as category without numbers or underscore
<4> Used for breadcrumbs - url of parent
<5> Used in leftnav - Link text for this specific page
<6> Used in leftnav - sort order for the page in this specific category
<7> Meta description - for SEO
<8> Title of page (only set once)

For the rest of the document, make sure that you are following proper AsciiDoc syntax and preview your document before submitting a pull request. There's no magic in how the documentation is built, so if it doesn't look right in your sandbox, it won't look right on the documentation site.

Review Process (for Administrators)

Pull Requests should be able to be automatically merged using GitHub's web-based tools.

To test PRs submissions locally, switch back to master and set up a local copy of the contributed code:

Locate the upstream section for your GitHub remote in the .git/config file. It looks like this:

[remote "upstream"]
    fetch = +refs/heads/*:refs/remotes/upstream/*
    url = [email protected]:openshift/devcenter.git

Now add the line fetch = +refs/pull//head:refs/remotes/upstream/pr/ to this section.

[remote "upstream"]
    fetch = +refs/heads/*:refs/remotes/upstream/*
    url = [email protected]:openshift/devcenter.git
    fetch = +refs/pull/*/head:refs/remotes/upstream/pr/*

Now fetch all the pull requests:

$ git fetch upstream
From github.com:openshift/devcenter
 * [new ref]         refs/pull/1000/head -> upstream/pr/1000
 * [new ref]         refs/pull/1002/head -> upstream/pr/1002
 * [new ref]         refs/pull/1004/head -> upstream/pr/1004
 * [new ref]         refs/pull/1009/head -> upstream/pr/1009
...

To check out a particular pull request:

$ git checkout pr/999
Branch pr/999 set up to track remote branch pr/999 from upstream.
Switched to a new branch 'pr/999'

In addition to local testing, the feature branch can also be deployed to OpenShift for review.

If everything looks good, use the merge button on the pull request to merge in the changes.

Mentioning PR numbers in commit messages will automatically generate links:

git commit -m 'merging pull request #123, thanks for contributing!'

If the Pull Request requires additional work, add a comment on GitHub describing the changes, and switch back to your repo's local master branch to it's previous state:

git checkout master

Known Issues

devcenter's People

Contributors

bparees avatar chanakasan avatar charle692 avatar coreydaley avatar coryspitzer avatar dmueller2001 avatar fromage avatar gshipley avatar imagentleman avatar ivansanchez avatar jightuse avatar jiri-fiala avatar jsvgoncalves avatar katiejots avatar luciddreamz avatar marekjelen avatar potherca avatar rhamilto avatar rmzelle avatar ryanj avatar sg00dwin avatar shekhargulati avatar spurtell avatar suspect-zero avatar thesteve0 avatar tiwillia avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.