remove some chapters

This commit is contained in:
Fengda HUANG 2015-10-24 23:00:44 +08:00
parent 32b1422ce5
commit 5cb47f498b
8 changed files with 491 additions and 576 deletions

View file

@ -1,47 +0,0 @@
#介绍
##Github
Wiki百科上是这么说的
> GitHub 是一个共享虚拟主机服务用于存放使用Git版本控制的软件代码和内容项目。它由GitHub公司曾称Logical Awesome的开发者Chris Wanstrath、PJ Hyett和Tom Preston-Werner
使用Ruby on Rails编写而成。
当然让我们看看官方的介绍:
> GitHub is the best place to share code with friends, co-workers, classmates, and complete strangers. Over eight million people use GitHub to build amazing things together.
它还是什么?
- 网站
- 免费博客
- 管理配置文件
- 收集资料
- 简历
- 管理代码片段
- 托管编程环境
- 写作
等等。看上去像是大餐,但是你还需要了解点什么?
###版本管理与软件部署
jQuery[^jQuery]在发布版本``2.1.3``一共有152个commit。我们可以看到如下的提交信息:
- Ajax: Always use script injection in globalEval … bbdfbb4
- Effects: Reintroduce use of requestAnimationFrame … 72119e0
- Effects: Improve raf logic … 708764f
- Build: Move test to appropriate module fbdbb6f
- Build: Update commitplease dev dependency
- ...
###Github与Git
> Git是一个分布式的版本控制系统最初由Linus Torvalds编写用作Linux内核代码的管理。在推出后Git在其它项目中也取得了很大成功尤其是在Ruby社区中。目前包括Rubinius、Merb和Bitcoin在内的很多知名项目都使用了Git。Git同样可以被诸如Capistrano和Vlad the Deployer这样的部署工具所使用。
> GitHub可以托管各种git库并提供一个web界面但与其它像 SourceForge或Google Code这样的服务不同GitHub的独特卖点在于从另外一个项目进行分支的简易性。为一个项目贡献代码非常简单首先点击项目站点的“fork”的按钮然后将代码检出并将修改加入到刚才分出的代码库中最后通过内建的“pull request”机制向项目负责人申请代码合并。已经有人将GitHub称为代码玩家的MySpace。
[^jQuery]: jQuery是一套跨浏览器的JavaScript库简化HTML与JavaScript之间的操作。
<hr>

View file

@ -1,7 +1,50 @@
#Git基本知识与Github使用
##Git
##Github
Wiki百科上是这么说的
> GitHub 是一个共享虚拟主机服务用于存放使用Git版本控制的软件代码和内容项目。它由GitHub公司曾称Logical Awesome的开发者Chris Wanstrath、PJ Hyett和Tom Preston-Werner
使用Ruby on Rails编写而成。
当然让我们看看官方的介绍:
> GitHub is the best place to share code with friends, co-workers, classmates, and complete strangers. Over eight million people use GitHub to build amazing things together.
它还是什么?
- 网站
- 免费博客
- 管理配置文件
- 收集资料
- 简历
- 管理代码片段
- 托管编程环境
- 写作
等等。看上去像是大餐,但是你还需要了解点什么?
###版本管理与软件部署
jQuery[^jQuery]在发布版本``2.1.3``一共有152个commit。我们可以看到如下的提交信息:
- Ajax: Always use script injection in globalEval … bbdfbb4
- Effects: Reintroduce use of requestAnimationFrame … 72119e0
- Effects: Improve raf logic … 708764f
- Build: Move test to appropriate module fbdbb6f
- Build: Update commitplease dev dependency
- ...
###Github与Git
> Git是一个分布式的版本控制系统最初由Linus Torvalds编写用作Linux内核代码的管理。在推出后Git在其它项目中也取得了很大成功尤其是在Ruby社区中。目前包括Rubinius、Merb和Bitcoin在内的很多知名项目都使用了Git。Git同样可以被诸如Capistrano和Vlad the Deployer这样的部署工具所使用。
> GitHub可以托管各种git库并提供一个web界面但与其它像 SourceForge或Google Code这样的服务不同GitHub的独特卖点在于从另外一个项目进行分支的简易性。为一个项目贡献代码非常简单首先点击项目站点的“fork”的按钮然后将代码检出并将修改加入到刚才分出的代码库中最后通过内建的“pull request”机制向项目负责人申请代码合并。已经有人将GitHub称为代码玩家的MySpace。
[^jQuery]: jQuery是一套跨浏览器的JavaScript库简化HTML与JavaScript之间的操作。
##Git
从一般开发者的角度来看git有以下功能
@ -97,167 +140,81 @@ git push -u origin master
如果你完成了上面的步骤之后,那么我想你想知道你需要怎样的项目。
<hr />
##Github流行项目分析
##用好Github
之前曾经分析过一些Github的用户行为现在我们先来说说Github上的Star吧。(截止: 2015年3月9日23时。)
如何用好Github,并实践一些敏捷软件开发是一个很有意思的事情.我们可以在上面做很多事情,从测试到CI,再到自动部署.
用户 | 项目名 | Language | Star | Url
-----|---------- |----------|------|----
twbs | Bootstrap | CSS | 78490 | [https://github.com/twbs/bootstrap](https://github.com/twbs/bootstrap)
vhf |free-programming books | - | 37240 | [https://github.com/vhf/free-programming-books](https://github.com/vhf/free-programming-books)
angular | angular.js | JavaScript | 36,061 | [https://github.com/angular/angular.js](https://github.com/angular/angular.js)
mbostock | d3 | JavaScript | 35,257 | [https://github.com/mbostock/d3](https://github.com/mbostock/d3)
joyent | node | JavaScript | 35,077 | [https://github.com/joyent/node](https://github.com/joyent/node)
###敏捷软件开发
上面列出来的是前5的看看大于1万个stars的项目的分布一共有82个:
显然我是在扯淡,这和敏捷软件开发没有什么关系。不过我也不知道瀑布流是怎样的。说说我所知道的一个项目的组成吧:
语言 | 项目数
-----|-----
JavaScript | 37
Ruby | 6
CSS | 6
Python | 4
HTML | 3
C++ | 3
VimL | 2
Shell | 2
Go | 2
C | 2
- 看板式管理应用程序(如trello简单地说就是管理软件功能)
- CI(持续集成)
- 测试覆盖率
- 代码质量(code smell)
类型分布:
- 库和框架: 和``jQuery``
- 系统: 如``Linux``、``hhvm``、``docker``
- 配置集: 如``dotfiles``
- 辅助工具: 如``oh-my-zsh``
- 工具: 如``Homewbrew``和``Bower``
- 资料收集: 如``free programming books````You-Dont-Know-JS````Font-Awesome``
- 其他:简历如``Resume``
对于一个不是远程的团队(如只有一个人的项目) 来说Trello、Jenkin、Jira不是必需的:
##创建Pull Request
> 你存在,我深深的脑海里
除了创建项目之外我们也可以创建Pull Request来做贡献。
当只有一个人的时候你只需要明确知道自己想要什么就够了。我们还需要的是CI、测试以来提升代码的质量。
###我的第一个PR
###测试
我的第一个PR是给一个小的Node的CoAP相关的库的Pull Request。原因比较简单是因为它的README.md写错了导致我无法办法进行下一步。
通常我们都会找Document如果没有的话你会找什么?看源代码,还是看测试?
const dgram = require('dgram')
- , coapPacket = require('coap-packet')
+ , package = require('coap-packet')
```javascript
it("specifying response when you need it", function (done) {
var doneFn = jasmine.createSpy("success");
lettuce.get('/some/cool/url', function (result) {
expect(result).toEqual("awesome response");
done();
});
expect(jasmine.Ajax.requests.mostRecent().url).toBe('/some/cool/url');
expect(doneFn).not.toHaveBeenCalled();
jasmine.Ajax.requests.mostRecent().respondWith({
"status": 200,
"contentType": 'text/plain',
"responseText": 'awesome response'
});
});
```
代码来源: [https://github.com/phodal/lettuce](https://github.com/phodal/lettuce)
上面的测试用例,清清楚楚地写明了用法,虽然写得有点扯。
等等,测试是用来干什么的。那么,先说说我为什么会想去写测试吧:
- 我不希望每次做完一个个新功能的时候,再手动地去测试一个个功能。(自动化测试)
- 我不希望在重构的时候发现破坏了原来的功能,而我还一无所知。
- 我不敢push代码因为我没有把握。
虽然我不是TDD的死忠测试的目的是保证功能正常TDD没法让我们写出质量更高的代码。但是有时TDD是不错的可以让我们写出逻辑更简单地代码。
也许你已经知道了``Selenium``、``Jasmine``、``Cucumber``等等的框架,看到过类似于下面的测试
很简单,却又很有用的步骤,另外一个也是:
```
Ajax
✓ specifying response when you need it
✓ specifying html when you need it
✓ should be post to some where
Class
✓ respects instanceof
✓ inherits methods (also super)
✓ extend methods
Effect
✓ should be able fadein elements
✓ should be able fadeout elements
```
else
cat << END
$0: error: module ngx_pagespeed requires the pagespeed optimization library.
-Look in obj/autoconf.err for more details.
+Look in objs/autoconf.err for more details.
END
exit 1
fi
```
代码来源: [https://github.com/phodal/lettuce](https://github.com/phodal/lettuce)
看上去似乎每个测试都很小,不过补完每一个测试之后我们就得到了测试覆盖率
###CLA
File | Statements | Branches | Functions | Lines
-----|------------|----------|-----------|------
lettuce.js | 98.58% (209 / 212)| 82.98%(78 / 94) | 100.00% (54 / 54) | 98.58% (209 / 212)
CLA即Contributor License Agreement在为一些大的组织、机构提交Pull Request的时候可能需要签署这个协议。他们会在你的Pull Request里问你只有你到他们的网站去注册并同意协议才会接受你的PR。
本地测试都通过了,于是我们添加了``Travis-CI``来跑我们的测试
以下是我为Google提交的一个PR
###CI
![Google CLA](./img/google-cla.png)
虽然node.js不算是一门语言但是因为我们用的node下面的是一个简单的``.travis.yml``示例:
以及Eclipse的一个PR
```yml
language: node_js
node_js:
- "0.10"
![Eclipse CLA](./img/eclipse-cla.png)
notifications:
email: false
before_install: npm install -g grunt-cli
install: npm install
after_success: CODECLIMATE_REPO_TOKEN=321480822fc37deb0de70a11931b4cb6a2a3cc411680e8f4569936ac8ffbb0ab codeclimate < coverage/lcov.info
```
代码来源: [https://github.com/phodal/lettuce](https://github.com/phodal/lettuce)
我们把这些集成到``README.md``之后,就有了之前那张图。
CI对于一个开发者在不同城市开发同一项目上来说是很重要的这意味着当你添加的部分功能有测试覆盖的时候项目代码会更加强壮。
###代码质量
像``jslint``这类的工具只能保证代码在语法上是正确的但是不能保证你写了一堆bad smell的代码。
- 重复代码
- 过长的函数
- 等等
``Code Climate``是一个与github集成的工具我们不仅仅可以看到测试覆盖率还有代码质量。
先看看上面的ajax类:
```javascript
Lettuce.get = function (url, callback) {
Lettuce.send(url, 'GET', callback);
};
Lettuce.send = function (url, method, callback, data) {
data = data || null;
var request = new XMLHttpRequest();
if (callback instanceof Function) {
request.onreadystatechange = function () {
if (request.readyState === 4 && (request.status === 200 || request.status === 0)) {
callback(request.responseText);
}
};
}
request.open(method, url, true);
if (data instanceof Object) {
data = JSON.stringify(data);
request.setRequestHeader('Content-Type', 'application/json');
}
request.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
request.send(data);
};
```
代码来源: [https://github.com/phodal/lettuce](https://github.com/phodal/lettuce)
在[Code Climate](https://codeclimate.com/github/phodal/lettuce/src/ajax.js)在出现了一堆问题
- Missing "use strict" statement. (Line 2)
- Missing "use strict" statement. (Line 14)
- 'Lettuce' is not defined. (Line 5)
而这些都是小问题啦,有时可能会有
- Similar code found in two :expression_statement nodes (mass = 86)
这就意味着我们可以对上面的代码进行重构,他们是重复的代码。
###重构
不想在这里说太多关于``重构``的东西可以参考Martin Flower的《重构》一书去多了解一些重构的细节。
这时想说的是,只有代码被测试覆盖住了,那么才能保证重构的过程没有出错。
他们都要求我签署CLA。
<hr>

View file

@ -1,40 +0,0 @@
#Github流行项目分析
之前曾经分析过一些Github的用户行为现在我们先来说说Github上的Star吧。(截止: 2015年3月9日23时。)
用户 | 项目名 | Language | Star | Url
-----|---------- |----------|------|----
twbs | Bootstrap | CSS | 78490 | [https://github.com/twbs/bootstrap](https://github.com/twbs/bootstrap)
vhf |free-programming books | - | 37240 | [https://github.com/vhf/free-programming-books](https://github.com/vhf/free-programming-books)
angular | angular.js | JavaScript | 36,061 | [https://github.com/angular/angular.js](https://github.com/angular/angular.js)
mbostock | d3 | JavaScript | 35,257 | [https://github.com/mbostock/d3](https://github.com/mbostock/d3)
joyent | node | JavaScript | 35,077 | [https://github.com/joyent/node](https://github.com/joyent/node)
上面列出来的是前5的看看大于1万个stars的项目的分布一共有82个:
语言 | 项目数
-----|-----
JavaScript | 37
Ruby | 6
CSS | 6
Python | 4
HTML | 3
C++ | 3
VimL | 2
Shell | 2
Go | 2
C | 2
类型分布:
- 库和框架: 和``jQuery``
- 系统: 如``Linux``、``hhvm``、``docker``
- 配置集: 如``dotfiles``
- 辅助工具: 如``oh-my-zsh``
- 工具: 如``Homewbrew``和``Bower``
- 资料收集: 如``free programming books````You-Dont-Know-JS````Font-Awesome``
- 其他:简历如``Resume``
<hr>

View file

@ -1,19 +0,0 @@
#创建你的项目
问题来了,我们在上面需要怎样的项目? 在上章中,我们说到了下面的内容会比较受欢迎:
- 库和框架: 和``jQuery``
- 系统: 如``Linux``、``hhvm``、``docker``
- 配置集: 如``dotfiles``
- 辅助工具: 如``oh-my-zsh``
- 工具: 如``Homewbrew``和``Bower``
- 资料收集: 如``free programming books````You-Dont-Know-JS````Font-Awesome``
- 其他:简历如``Resume``
不过,在多数情况下,我想文档类如资料收集会比较受欢迎。但是,并非所有喜欢的程序员都喜欢去收集这样的内容,有时候我们想创造的是一个流行的库,这也是我最想做的开源项目。
##Hello,World
So你可以从Hello,World开始试试。
<hr>

View file

@ -1,40 +0,0 @@
#创建Pull Request
除了创建项目之外我们也可以创建Pull Request来做贡献。
##第一个PR
我的第一个PR是给一个小的Node的CoAP相关的库的Pull Request。原因比较简单是因为它的README.md写错了导致我无法办法进行下一步。
const dgram = require('dgram')
- , coapPacket = require('coap-packet')
+ , package = require('coap-packet')
很简单,却又很有用的步骤,另外一个也是:
```
else
cat << END
$0: error: module ngx_pagespeed requires the pagespeed optimization library.
-Look in obj/autoconf.err for more details.
+Look in objs/autoconf.err for more details.
END
exit 1
fi
```
##CLA
CLA即Contributor License Agreement在为一些大的组织、机构提交Pull Request的时候可能需要签署这个协议。他们会在你的Pull Request里问你只有你到他们的网站去注册并同意协议才会接受你的PR。
以下是我为Google提交的一个PR
![Google CLA](./img/google-cla.png)
以及Eclipse的一个PR
![Eclipse CLA](./img/eclipse-cla.png)
他们都要求我签署CLA。
<hr>

View file

@ -1,5 +1,166 @@
#构建Github项目
##用好Github
如何用好Github,并实践一些敏捷软件开发是一个很有意思的事情.我们可以在上面做很多事情,从测试到CI,再到自动部署.
###敏捷软件开发
显然我是在扯淡,这和敏捷软件开发没有什么关系。不过我也不知道瀑布流是怎样的。说说我所知道的一个项目的组成吧:
- 看板式管理应用程序(如trello简单地说就是管理软件功能)
- CI(持续集成)
- 测试覆盖率
- 代码质量(code smell)
对于一个不是远程的团队(如只有一个人的项目) 来说Trello、Jenkin、Jira不是必需的:
> 你存在,我深深的脑海里
当只有一个人的时候你只需要明确知道自己想要什么就够了。我们还需要的是CI、测试以来提升代码的质量。
###测试
通常我们都会找Document如果没有的话你会找什么?看源代码,还是看测试?
```javascript
it("specifying response when you need it", function (done) {
var doneFn = jasmine.createSpy("success");
lettuce.get('/some/cool/url', function (result) {
expect(result).toEqual("awesome response");
done();
});
expect(jasmine.Ajax.requests.mostRecent().url).toBe('/some/cool/url');
expect(doneFn).not.toHaveBeenCalled();
jasmine.Ajax.requests.mostRecent().respondWith({
"status": 200,
"contentType": 'text/plain',
"responseText": 'awesome response'
});
});
```
代码来源: [https://github.com/phodal/lettuce](https://github.com/phodal/lettuce)
上面的测试用例,清清楚楚地写明了用法,虽然写得有点扯。
等等,测试是用来干什么的。那么,先说说我为什么会想去写测试吧:
- 我不希望每次做完一个个新功能的时候,再手动地去测试一个个功能。(自动化测试)
- 我不希望在重构的时候发现破坏了原来的功能,而我还一无所知。
- 我不敢push代码因为我没有把握。
虽然我不是TDD的死忠测试的目的是保证功能正常TDD没法让我们写出质量更高的代码。但是有时TDD是不错的可以让我们写出逻辑更简单地代码。
也许你已经知道了``Selenium``、``Jasmine``、``Cucumber``等等的框架,看到过类似于下面的测试
```
Ajax
✓ specifying response when you need it
✓ specifying html when you need it
✓ should be post to some where
Class
✓ respects instanceof
✓ inherits methods (also super)
✓ extend methods
Effect
✓ should be able fadein elements
✓ should be able fadeout elements
```
代码来源: [https://github.com/phodal/lettuce](https://github.com/phodal/lettuce)
看上去似乎每个测试都很小,不过补完每一个测试之后我们就得到了测试覆盖率
File | Statements | Branches | Functions | Lines
-----|------------|----------|-----------|------
lettuce.js | 98.58% (209 / 212)| 82.98%(78 / 94) | 100.00% (54 / 54) | 98.58% (209 / 212)
本地测试都通过了,于是我们添加了``Travis-CI``来跑我们的测试
###CI
虽然node.js不算是一门语言但是因为我们用的node下面的是一个简单的``.travis.yml``示例:
```yml
language: node_js
node_js:
- "0.10"
notifications:
email: false
before_install: npm install -g grunt-cli
install: npm install
after_success: CODECLIMATE_REPO_TOKEN=321480822fc37deb0de70a11931b4cb6a2a3cc411680e8f4569936ac8ffbb0ab codeclimate < coverage/lcov.info
```
代码来源: [https://github.com/phodal/lettuce](https://github.com/phodal/lettuce)
我们把这些集成到``README.md``之后,就有了之前那张图。
CI对于一个开发者在不同城市开发同一项目上来说是很重要的这意味着当你添加的部分功能有测试覆盖的时候项目代码会更加强壮。
###代码质量
像``jslint``这类的工具只能保证代码在语法上是正确的但是不能保证你写了一堆bad smell的代码。
- 重复代码
- 过长的函数
- 等等
``Code Climate``是一个与github集成的工具我们不仅仅可以看到测试覆盖率还有代码质量。
先看看上面的ajax类:
```javascript
Lettuce.get = function (url, callback) {
Lettuce.send(url, 'GET', callback);
};
Lettuce.send = function (url, method, callback, data) {
data = data || null;
var request = new XMLHttpRequest();
if (callback instanceof Function) {
request.onreadystatechange = function () {
if (request.readyState === 4 && (request.status === 200 || request.status === 0)) {
callback(request.responseText);
}
};
}
request.open(method, url, true);
if (data instanceof Object) {
data = JSON.stringify(data);
request.setRequestHeader('Content-Type', 'application/json');
}
request.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
request.send(data);
};
```
代码来源: [https://github.com/phodal/lettuce](https://github.com/phodal/lettuce)
在[Code Climate](https://codeclimate.com/github/phodal/lettuce/src/ajax.js)在出现了一堆问题
- Missing "use strict" statement. (Line 2)
- Missing "use strict" statement. (Line 14)
- 'Lettuce' is not defined. (Line 5)
而这些都是小问题啦,有时可能会有
- Similar code found in two :expression_statement nodes (mass = 86)
这就意味着我们可以对上面的代码进行重构,他们是重复的代码。
###重构
不想在这里说太多关于``重构``的东西可以参考Martin Flower的《重构》一书去多了解一些重构的细节。
这时想说的是,只有代码被测试覆盖住了,那么才能保证重构的过程没有出错。
##从模块分离到测试
在之前说到

View file

@ -81,7 +81,7 @@
<hr>
#介绍
#Git基本知识与Github使用
##Github
@ -127,13 +127,8 @@ jQuery[^jQuery]在发布版本``2.1.3``一共有152个commit。我们可以
[^jQuery]: jQuery是一套跨浏览器的JavaScript库简化HTML与JavaScript之间的操作。
<hr>
#Git基本知识与Github使用
##Git
从一般开发者的角度来看git有以下功能
1. 从服务器上克隆数据库(包括代码和版本信息)到单机上。
@ -228,7 +223,86 @@ git push -u origin master
如果你完成了上面的步骤之后,那么我想你想知道你需要怎样的项目。
<hr />
##Github流行项目分析
之前曾经分析过一些Github的用户行为现在我们先来说说Github上的Star吧。(截止: 2015年3月9日23时。)
用户 | 项目名 | Language | Star | Url
-----|---------- |----------|------|----
twbs | Bootstrap | CSS | 78490 | [https://github.com/twbs/bootstrap](https://github.com/twbs/bootstrap)
vhf |free-programming books | - | 37240 | [https://github.com/vhf/free-programming-books](https://github.com/vhf/free-programming-books)
angular | angular.js | JavaScript | 36,061 | [https://github.com/angular/angular.js](https://github.com/angular/angular.js)
mbostock | d3 | JavaScript | 35,257 | [https://github.com/mbostock/d3](https://github.com/mbostock/d3)
joyent | node | JavaScript | 35,077 | [https://github.com/joyent/node](https://github.com/joyent/node)
上面列出来的是前5的看看大于1万个stars的项目的分布一共有82个:
语言 | 项目数
-----|-----
JavaScript | 37
Ruby | 6
CSS | 6
Python | 4
HTML | 3
C++ | 3
VimL | 2
Shell | 2
Go | 2
C | 2
类型分布:
- 库和框架: 和``jQuery``
- 系统: 如``Linux``、``hhvm``、``docker``
- 配置集: 如``dotfiles``
- 辅助工具: 如``oh-my-zsh``
- 工具: 如``Homewbrew``和``Bower``
- 资料收集: 如``free programming books````You-Dont-Know-JS````Font-Awesome``
- 其他:简历如``Resume``
##创建Pull Request
除了创建项目之外我们也可以创建Pull Request来做贡献。
###我的第一个PR
我的第一个PR是给一个小的Node的CoAP相关的库的Pull Request。原因比较简单是因为它的README.md写错了导致我无法办法进行下一步。
const dgram = require('dgram')
- , coapPacket = require('coap-packet')
+ , package = require('coap-packet')
很简单,却又很有用的步骤,另外一个也是:
```
else
cat << END
$0: error: module ngx_pagespeed requires the pagespeed optimization library.
-Look in obj/autoconf.err for more details.
+Look in objs/autoconf.err for more details.
END
exit 1
fi
```
###CLA
CLA即Contributor License Agreement在为一些大的组织、机构提交Pull Request的时候可能需要签署这个协议。他们会在你的Pull Request里问你只有你到他们的网站去注册并同意协议才会接受你的PR。
以下是我为Google提交的一个PR
![Google CLA](./img/google-cla.png)
以及Eclipse的一个PR
![Eclipse CLA](./img/eclipse-cla.png)
他们都要求我签署CLA。
<hr>
#构建Github项目
##用好Github
@ -391,112 +465,6 @@ Lettuce.send = function (url, method, callback, data) {
这时想说的是,只有代码被测试覆盖住了,那么才能保证重构的过程没有出错。
<hr>
#Github流行项目分析
之前曾经分析过一些Github的用户行为现在我们先来说说Github上的Star吧。(截止: 2015年3月9日23时。)
用户 | 项目名 | Language | Star | Url
-----|---------- |----------|------|----
twbs | Bootstrap | CSS | 78490 | [https://github.com/twbs/bootstrap](https://github.com/twbs/bootstrap)
vhf |free-programming books | - | 37240 | [https://github.com/vhf/free-programming-books](https://github.com/vhf/free-programming-books)
angular | angular.js | JavaScript | 36,061 | [https://github.com/angular/angular.js](https://github.com/angular/angular.js)
mbostock | d3 | JavaScript | 35,257 | [https://github.com/mbostock/d3](https://github.com/mbostock/d3)
joyent | node | JavaScript | 35,077 | [https://github.com/joyent/node](https://github.com/joyent/node)
上面列出来的是前5的看看大于1万个stars的项目的分布一共有82个:
语言 | 项目数
-----|-----
JavaScript | 37
Ruby | 6
CSS | 6
Python | 4
HTML | 3
C++ | 3
VimL | 2
Shell | 2
Go | 2
C | 2
类型分布:
- 库和框架: 和``jQuery``
- 系统: 如``Linux``、``hhvm``、``docker``
- 配置集: 如``dotfiles``
- 辅助工具: 如``oh-my-zsh``
- 工具: 如``Homewbrew``和``Bower``
- 资料收集: 如``free programming books````You-Dont-Know-JS````Font-Awesome``
- 其他:简历如``Resume``
<hr>
#创建你的项目
问题来了,我们在上面需要怎样的项目? 在上章中,我们说到了下面的内容会比较受欢迎:
- 库和框架: 和``jQuery``
- 系统: 如``Linux``、``hhvm``、``docker``
- 配置集: 如``dotfiles``
- 辅助工具: 如``oh-my-zsh``
- 工具: 如``Homewbrew``和``Bower``
- 资料收集: 如``free programming books````You-Dont-Know-JS````Font-Awesome``
- 其他:简历如``Resume``
不过,在多数情况下,我想文档类如资料收集会比较受欢迎。但是,并非所有喜欢的程序员都喜欢去收集这样的内容,有时候我们想创造的是一个流行的库,这也是我最想做的开源项目。
##Hello,World
So你可以从Hello,World开始试试。
<hr>
#创建Pull Request
除了创建项目之外我们也可以创建Pull Request来做贡献。
##第一个PR
我的第一个PR是给一个小的Node的CoAP相关的库的Pull Request。原因比较简单是因为它的README.md写错了导致我无法办法进行下一步。
const dgram = require('dgram')
- , coapPacket = require('coap-packet')
+ , package = require('coap-packet')
很简单,却又很有用的步骤,另外一个也是:
```
else
cat << END
$0: error: module ngx_pagespeed requires the pagespeed optimization library.
-Look in obj/autoconf.err for more details.
+Look in objs/autoconf.err for more details.
END
exit 1
fi
```
##CLA
CLA即Contributor License Agreement在为一些大的组织、机构提交Pull Request的时候可能需要签署这个协议。他们会在你的Pull Request里问你只有你到他们的网站去注册并同意协议才会接受你的PR。
以下是我为Google提交的一个PR
![Google CLA](./img/google-cla.png)
以及Eclipse的一个PR
![Eclipse CLA](./img/eclipse-cla.png)
他们都要求我签署CLA。
<hr>
#构建Github项目
##从模块分离到测试
在之前说到

View file

@ -74,17 +74,22 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
<li><a href="#扩大人脉">扩大人脉</a></li>
</ul></li>
</ul></li>
<li><a href="#介绍">介绍</a><ul>
<li><a href="#git基本知识与github使用">Git基本知识与Github使用</a><ul>
<li><a href="#github">Github</a><ul>
<li><a href="#版本管理与软件部署">版本管理与软件部署</a></li>
<li><a href="#github与git">Github与Git</a></li>
</ul></li>
</ul></li>
<li><a href="#git基本知识与github使用">Git基本知识与Github使用</a><ul>
<li><a href="#git">Git</a><ul>
<li><a href="#git初入">Git初入</a></li>
<li><a href="#在github创建项目">在Github创建项目</a></li>
</ul></li>
<li><a href="#github流行项目分析">Github流行项目分析</a></li>
<li><a href="#创建pull-request">创建Pull Request</a><ul>
<li><a href="#我的第一个pr">我的第一个PR</a></li>
<li><a href="#cla">CLA</a></li>
</ul></li>
</ul></li>
<li><a href="#构建github项目">构建Github项目</a><ul>
<li><a href="#用好github">用好Github</a><ul>
<li><a href="#敏捷软件开发">敏捷软件开发</a></li>
<li><a href="#测试">测试</a></li>
@ -92,16 +97,6 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
<li><a href="#代码质量">代码质量</a></li>
<li><a href="#重构">重构</a></li>
</ul></li>
</ul></li>
<li><a href="#github流行项目分析">Github流行项目分析</a></li>
<li><a href="#创建你的项目">创建你的项目</a><ul>
<li><a href="#helloworld">Hello,World</a></li>
</ul></li>
<li><a href="#创建pull-request">创建Pull Request</a><ul>
<li><a href="#第一个pr">第一个PR</a></li>
<li><a href="#cla">CLA</a></li>
</ul></li>
<li><a href="#构建github项目">构建Github项目</a><ul>
<li><a href="#从模块分离到测试">从模块分离到测试</a><ul>
<li><a href="#skillock模块化">Skillock模块化</a></li>
<li><a href="#自动化测试">自动化测试</a></li>
@ -251,7 +246,7 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
<h3 id="扩大人脉">扩大人脉</h3>
<p>如果我们想创造出更好、强大地框架时,那么认识更多的人可能会带来更多的帮助。有时候会同上面那一点一样的效果</p>
<hr>
<h1 id="介绍">介绍</h1>
<h1 id="git基本知识与github使用">Git基本知识与Github使用</h1>
<h2 id="github">Github</h2>
<p>Wiki百科上是这么说的</p>
<blockquote>
@ -290,8 +285,6 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
<blockquote>
<p>GitHub可以托管各种git库并提供一个web界面但与其它像 SourceForge或Google Code这样的服务不同GitHub的独特卖点在于从另外一个项目进行分支的简易性。为一个项目贡献代码非常简单首先点击项目站点的“fork”的按钮然后将代码检出并将修改加入到刚才分出的代码库中最后通过内建的“pull request”机制向项目负责人申请代码合并。已经有人将GitHub称为代码玩家的MySpace。</p>
</blockquote>
<hr>
<h1 id="git基本知识与github使用">Git基本知识与Github使用</h1>
<h2 id="git">Git</h2>
<p>从一般开发者的角度来看git有以下功能</p>
<ol type="1">
@ -357,7 +350,146 @@ git push -u origin master</code></pre>
<pre><code>git remote add origin git@github.com:phodal/github-roam.git
git push -u origin master</code></pre>
<p>如果你完成了上面的步骤之后,那么我想你想知道你需要怎样的项目。</p>
<hr />
<h2 id="github流行项目分析">Github流行项目分析</h2>
<p>之前曾经分析过一些Github的用户行为现在我们先来说说Github上的Star吧。(截止: 2015年3月9日23时。)</p>
<table>
<thead>
<tr class="header">
<th style="text-align: left;">用户</th>
<th style="text-align: left;">项目名</th>
<th style="text-align: left;">Language</th>
<th style="text-align: left;">Star</th>
<th style="text-align: left;">Url</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;">twbs</td>
<td style="text-align: left;">Bootstrap</td>
<td style="text-align: left;">CSS</td>
<td style="text-align: left;">78490</td>
<td style="text-align: left;"><a href="https://github.com/twbs/bootstrap" class="uri">https://github.com/twbs/bootstrap</a></td>
</tr>
<tr class="even">
<td style="text-align: left;">vhf</td>
<td style="text-align: left;">free-programming books</td>
<td style="text-align: left;">-</td>
<td style="text-align: left;">37240</td>
<td style="text-align: left;"><a href="https://github.com/vhf/free-programming-books" class="uri">https://github.com/vhf/free-programming-books</a></td>
</tr>
<tr class="odd">
<td style="text-align: left;">angular</td>
<td style="text-align: left;">angular.js</td>
<td style="text-align: left;">JavaScript</td>
<td style="text-align: left;">36,061</td>
<td style="text-align: left;"><a href="https://github.com/angular/angular.js" class="uri">https://github.com/angular/angular.js</a></td>
</tr>
<tr class="even">
<td style="text-align: left;">mbostock</td>
<td style="text-align: left;">d3</td>
<td style="text-align: left;">JavaScript</td>
<td style="text-align: left;">35,257</td>
<td style="text-align: left;"><a href="https://github.com/mbostock/d3" class="uri">https://github.com/mbostock/d3</a></td>
</tr>
<tr class="odd">
<td style="text-align: left;">joyent</td>
<td style="text-align: left;">node</td>
<td style="text-align: left;">JavaScript</td>
<td style="text-align: left;">35,077</td>
<td style="text-align: left;"><a href="https://github.com/joyent/node" class="uri">https://github.com/joyent/node</a></td>
</tr>
</tbody>
</table>
<p>上面列出来的是前5的看看大于1万个stars的项目的分布一共有82个:</p>
<table>
<thead>
<tr class="header">
<th style="text-align: left;">语言</th>
<th style="text-align: left;">项目数</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;">JavaScript</td>
<td style="text-align: left;">37</td>
</tr>
<tr class="even">
<td style="text-align: left;">Ruby</td>
<td style="text-align: left;">6</td>
</tr>
<tr class="odd">
<td style="text-align: left;">CSS</td>
<td style="text-align: left;">6</td>
</tr>
<tr class="even">
<td style="text-align: left;">Python</td>
<td style="text-align: left;">4</td>
</tr>
<tr class="odd">
<td style="text-align: left;">HTML</td>
<td style="text-align: left;">3</td>
</tr>
<tr class="even">
<td style="text-align: left;">C++</td>
<td style="text-align: left;">3</td>
</tr>
<tr class="odd">
<td style="text-align: left;">VimL</td>
<td style="text-align: left;">2</td>
</tr>
<tr class="even">
<td style="text-align: left;">Shell</td>
<td style="text-align: left;">2</td>
</tr>
<tr class="odd">
<td style="text-align: left;">Go</td>
<td style="text-align: left;">2</td>
</tr>
<tr class="even">
<td style="text-align: left;">C</td>
<td style="text-align: left;">2</td>
</tr>
</tbody>
</table>
<p>类型分布:</p>
<ul>
<li>库和框架: 和<code>jQuery</code></li>
<li>系统: 如<code>Linux</code><code>hhvm</code><code>docker</code></li>
<li>配置集: 如<code>dotfiles</code></li>
<li>辅助工具: 如<code>oh-my-zsh</code></li>
<li>工具: 如<code>Homewbrew</code><code>Bower</code></li>
<li>资料收集: 如<code>free programming books</code><code>You-Dont-Know-JS</code><code>Font-Awesome</code></li>
<li>其他:简历如<code>Resume</code></li>
</ul>
<h2 id="创建pull-request">创建Pull Request</h2>
<p>除了创建项目之外我们也可以创建Pull Request来做贡献。</p>
<h3 id="我的第一个pr">我的第一个PR</h3>
<p>我的第一个PR是给一个小的Node的CoAP相关的库的Pull Request。原因比较简单是因为它的README.md写错了导致我无法办法进行下一步。</p>
<pre><code> const dgram = require(&#39;dgram&#39;)
- , coapPacket = require(&#39;coap-packet&#39;)
+ , package = require(&#39;coap-packet&#39;)</code></pre>
<p>很简单,却又很有用的步骤,另外一个也是:</p>
<pre><code> else
cat &lt;&lt; END
$0: error: module ngx_pagespeed requires the pagespeed optimization library.
-Look in obj/autoconf.err for more details.
+Look in objs/autoconf.err for more details.
END
exit 1
fi</code></pre>
<h3 id="cla">CLA</h3>
<p>CLA即Contributor License Agreement在为一些大的组织、机构提交Pull Request的时候可能需要签署这个协议。他们会在你的Pull Request里问你只有你到他们的网站去注册并同意协议才会接受你的PR。</p>
<p>以下是我为Google提交的一个PR</p>
<figure>
<img src="./img/google-cla.png" alt="Google CLA" /><figcaption>Google CLA</figcaption>
</figure>
<p>以及Eclipse的一个PR</p>
<figure>
<img src="./img/eclipse-cla.png" alt="Eclipse CLA" /><figcaption>Eclipse CLA</figcaption>
</figure>
<p>他们都要求我签署CLA。</p>
<hr>
<h1 id="构建github项目">构建Github项目</h1>
<h2 id="用好github">用好Github</h2>
<p>如何用好Github,并实践一些敏捷软件开发是一个很有意思的事情.我们可以在上面做很多事情,从测试到CI,再到自动部署.</p>
<h3 id="敏捷软件开发">敏捷软件开发</h3>
@ -497,163 +629,6 @@ after_success: CODECLIMATE_REPO_TOKEN=321480822fc37deb0de70a11931b4cb6a2a3cc4116
<h3 id="重构">重构</h3>
<p>不想在这里说太多关于<code>重构</code>的东西可以参考Martin Flower的《重构》一书去多了解一些重构的细节。</p>
<p>这时想说的是,只有代码被测试覆盖住了,那么才能保证重构的过程没有出错。</p>
<hr>
<h1 id="github流行项目分析">Github流行项目分析</h1>
<p>之前曾经分析过一些Github的用户行为现在我们先来说说Github上的Star吧。(截止: 2015年3月9日23时。)</p>
<table>
<thead>
<tr class="header">
<th style="text-align: left;">用户</th>
<th style="text-align: left;">项目名</th>
<th style="text-align: left;">Language</th>
<th style="text-align: left;">Star</th>
<th style="text-align: left;">Url</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;">twbs</td>
<td style="text-align: left;">Bootstrap</td>
<td style="text-align: left;">CSS</td>
<td style="text-align: left;">78490</td>
<td style="text-align: left;"><a href="https://github.com/twbs/bootstrap" class="uri">https://github.com/twbs/bootstrap</a></td>
</tr>
<tr class="even">
<td style="text-align: left;">vhf</td>
<td style="text-align: left;">free-programming books</td>
<td style="text-align: left;">-</td>
<td style="text-align: left;">37240</td>
<td style="text-align: left;"><a href="https://github.com/vhf/free-programming-books" class="uri">https://github.com/vhf/free-programming-books</a></td>
</tr>
<tr class="odd">
<td style="text-align: left;">angular</td>
<td style="text-align: left;">angular.js</td>
<td style="text-align: left;">JavaScript</td>
<td style="text-align: left;">36,061</td>
<td style="text-align: left;"><a href="https://github.com/angular/angular.js" class="uri">https://github.com/angular/angular.js</a></td>
</tr>
<tr class="even">
<td style="text-align: left;">mbostock</td>
<td style="text-align: left;">d3</td>
<td style="text-align: left;">JavaScript</td>
<td style="text-align: left;">35,257</td>
<td style="text-align: left;"><a href="https://github.com/mbostock/d3" class="uri">https://github.com/mbostock/d3</a></td>
</tr>
<tr class="odd">
<td style="text-align: left;">joyent</td>
<td style="text-align: left;">node</td>
<td style="text-align: left;">JavaScript</td>
<td style="text-align: left;">35,077</td>
<td style="text-align: left;"><a href="https://github.com/joyent/node" class="uri">https://github.com/joyent/node</a></td>
</tr>
</tbody>
</table>
<p>上面列出来的是前5的看看大于1万个stars的项目的分布一共有82个:</p>
<table>
<thead>
<tr class="header">
<th style="text-align: left;">语言</th>
<th style="text-align: left;">项目数</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;">JavaScript</td>
<td style="text-align: left;">37</td>
</tr>
<tr class="even">
<td style="text-align: left;">Ruby</td>
<td style="text-align: left;">6</td>
</tr>
<tr class="odd">
<td style="text-align: left;">CSS</td>
<td style="text-align: left;">6</td>
</tr>
<tr class="even">
<td style="text-align: left;">Python</td>
<td style="text-align: left;">4</td>
</tr>
<tr class="odd">
<td style="text-align: left;">HTML</td>
<td style="text-align: left;">3</td>
</tr>
<tr class="even">
<td style="text-align: left;">C++</td>
<td style="text-align: left;">3</td>
</tr>
<tr class="odd">
<td style="text-align: left;">VimL</td>
<td style="text-align: left;">2</td>
</tr>
<tr class="even">
<td style="text-align: left;">Shell</td>
<td style="text-align: left;">2</td>
</tr>
<tr class="odd">
<td style="text-align: left;">Go</td>
<td style="text-align: left;">2</td>
</tr>
<tr class="even">
<td style="text-align: left;">C</td>
<td style="text-align: left;">2</td>
</tr>
</tbody>
</table>
<p>类型分布:</p>
<ul>
<li>库和框架: 和<code>jQuery</code></li>
<li>系统: 如<code>Linux</code><code>hhvm</code><code>docker</code></li>
<li>配置集: 如<code>dotfiles</code></li>
<li>辅助工具: 如<code>oh-my-zsh</code></li>
<li>工具: 如<code>Homewbrew</code><code>Bower</code></li>
<li>资料收集: 如<code>free programming books</code><code>You-Dont-Know-JS</code><code>Font-Awesome</code></li>
<li>其他:简历如<code>Resume</code></li>
</ul>
<hr>
<h1 id="创建你的项目">创建你的项目</h1>
<p>问题来了,我们在上面需要怎样的项目? 在上章中,我们说到了下面的内容会比较受欢迎:</p>
<ul>
<li>库和框架: 和<code>jQuery</code></li>
<li>系统: 如<code>Linux</code><code>hhvm</code><code>docker</code></li>
<li>配置集: 如<code>dotfiles</code></li>
<li>辅助工具: 如<code>oh-my-zsh</code></li>
<li>工具: 如<code>Homewbrew</code><code>Bower</code></li>
<li>资料收集: 如<code>free programming books</code><code>You-Dont-Know-JS</code><code>Font-Awesome</code></li>
<li>其他:简历如<code>Resume</code></li>
</ul>
<p>不过,在多数情况下,我想文档类如资料收集会比较受欢迎。但是,并非所有喜欢的程序员都喜欢去收集这样的内容,有时候我们想创造的是一个流行的库,这也是我最想做的开源项目。</p>
<h2 id="helloworld">Hello,World</h2>
<p>So你可以从Hello,World开始试试。</p>
<hr>
<h1 id="创建pull-request">创建Pull Request</h1>
<p>除了创建项目之外我们也可以创建Pull Request来做贡献。</p>
<h2 id="第一个pr">第一个PR</h2>
<p>我的第一个PR是给一个小的Node的CoAP相关的库的Pull Request。原因比较简单是因为它的README.md写错了导致我无法办法进行下一步。</p>
<pre><code> const dgram = require(&#39;dgram&#39;)
- , coapPacket = require(&#39;coap-packet&#39;)
+ , package = require(&#39;coap-packet&#39;)</code></pre>
<p>很简单,却又很有用的步骤,另外一个也是:</p>
<pre><code> else
cat &lt;&lt; END
$0: error: module ngx_pagespeed requires the pagespeed optimization library.
-Look in obj/autoconf.err for more details.
+Look in objs/autoconf.err for more details.
END
exit 1
fi</code></pre>
<h2 id="cla">CLA</h2>
<p>CLA即Contributor License Agreement在为一些大的组织、机构提交Pull Request的时候可能需要签署这个协议。他们会在你的Pull Request里问你只有你到他们的网站去注册并同意协议才会接受你的PR。</p>
<p>以下是我为Google提交的一个PR</p>
<figure>
<img src="./img/google-cla.png" alt="Google CLA" /><figcaption>Google CLA</figcaption>
</figure>
<p>以及Eclipse的一个PR</p>
<figure>
<img src="./img/eclipse-cla.png" alt="Eclipse CLA" /><figcaption>Eclipse CLA</figcaption>
</figure>
<p>他们都要求我签署CLA。</p>
<hr>
<h1 id="构建github项目">构建Github项目</h1>
<h2 id="从模块分离到测试">从模块分离到测试</h2>
<p>在之前说到</p>
<blockquote>