Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge #116

Open
wants to merge 3,698 commits into
base: master
Choose a base branch
from
Open

merge #116

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
3698 commits
Select commit Hold shift + click to select a range
4507238
Fix #842 Markdown List 行之间有换行时,排版乱掉的问题;
huacnlee Jan 12, 2017
38bd439
Reply API 结果增加 Mention 提及来源的话题信息;
huacnlee Jan 16, 2017
6620471
Fix 38bd4397f3954db6f277168dddfba1efe47b24c3 typo
huacnlee Jan 16, 2017
b7daac2
Only Run CI on 2.4.0 [skip ci]
huacnlee Jan 16, 2017
c00c7d4
@ 自动完成用户名的功能改进,将关注用户匹配的优先放到前面;
huacnlee Jan 17, 2017
f04168d
Remove spec/javascripts 已经很久都没跑过了
huacnlee Jan 17, 2017
ce20973
用户名 AutoComplete 功能将回帖里面的匹配的优先排到前面;
huacnlee Jan 17, 2017
7d5ca10
Fix test
huacnlee Jan 17, 2017
e15849c
Bundle Update on 2017-01-17 (#851)
deppbot Jan 17, 2017
1f0a9b0
Upgrade RuCaptcha 2.0.0.beta4
huacnlee Jan 20, 2017
e22daf1
Merge branch 'master' of github.com:ruby-china/homeland
huacnlee Jan 20, 2017
dd1cb38
RuCaptcha 2.0.0
huacnlee Jan 22, 2017
912f832
修正评论列表的样式;
huacnlee Jan 22, 2017
90263a9
Upgrade Rubocop
huacnlee Jan 22, 2017
9b34484
Downgrade a gem verison
huacnlee Jan 22, 2017
75606c3
1.month is to too long for Memcached
huacnlee Feb 4, 2017
2afb624
Fix Render and/or redirect were called multiple times in this action
huacnlee Feb 4, 2017
04cf13d
Upgrade RuCaptcha 2.0.1 to fix #856
huacnlee Feb 4, 2017
858f7ee
Version 2.5.2
huacnlee Feb 6, 2017
1833182
用 actions 表来代替 Like, Folllow, Block 等功能之前的 Array 字段存储. (#857)
huacnlee Feb 11, 2017
839b7a1
Version 2.6.0
huacnlee Feb 11, 2017
3af8e41
Update README.md
huacnlee Feb 11, 2017
905b9b3
Fix #862 Team 页面无法打开的问题.
huacnlee Feb 13, 2017
a646068
version 2.6.1
huacnlee Feb 13, 2017
e698182
Fix #862 file name type
huacnlee Feb 13, 2017
6cd70e9
Fix typo again
huacnlee Feb 14, 2017
b72c330
Fix "invalid value for Integer" with :page param.
huacnlee Feb 14, 2017
90b07a4
Save more Exception environments.
huacnlee Feb 14, 2017
0ebae30
Do not puts exception messages [skip ci]
huacnlee Feb 14, 2017
794bd1e
update_attributes -> update
huacnlee Feb 15, 2017
88eedb5
Bundle Update on 2017-02-14 (#863)
deppbot Feb 15, 2017
de7d634
Upgrade ActionStore, RuCaptcha, remove pry
huacnlee Feb 15, 2017
7f60cd9
Update RuCaptcha to fix test
huacnlee Feb 15, 2017
bc324e5
Config USE_OFFICIAL_GEM_SOURCE in travis-ci.org
huacnlee Feb 15, 2017
21c5465
Downgrade Rainbow 2.1.0
huacnlee Feb 15, 2017
bd879cf
改进 user_liked_reply_ids,避免将所有的 id 都塞到页面.
huacnlee Feb 16, 2017
de901c7
@user.like_reply_ids_by_replies 改用直接查询 actions 表的方式,避免拉出所有用户已赞的编号;
huacnlee Feb 16, 2017
324f661
Fix test
huacnlee Feb 16, 2017
6e14b7b
Remove Sinatra gem, Sidekiq Web not need now.
huacnlee Feb 16, 2017
4b89beb
Fix spec/lib/image_thumb_spec.rb 可能会失败的问题
huacnlee Feb 16, 2017
d55e095
Upgrade Twemoji, Nokogiri 1.7.x to remove Ruby 2.4 warnings
huacnlee Feb 17, 2017
75656eb
改用 ExceptionTrack 代替之前的 ExceptionLog 的代码 (#864)
huacnlee Feb 17, 2017
a2a2613
Version 2.6.2
huacnlee Feb 17, 2017
09d4482
修正搜索页面,缺少 q 参数的时候的异常;
huacnlee Feb 17, 2017
7de1e09
Upgrade exception-track 0.1.3
huacnlee Feb 20, 2017
40d98ec
Update exception-track 0.1.4
huacnlee Feb 20, 2017
6b14a14
Fix coding style (#865)
huacnlee Feb 20, 2017
48222f8
统一 Pagination 的写法,优化话题列表 total_entries,当内容大于 1500 的时候才固定 total_entries.
huacnlee Feb 21, 2017
eff4b39
Upgrade notifications, exception-track
huacnlee Feb 21, 2017
c0a47da
Use Kaminari instead of WillPaginate (#866)
huacnlee Feb 21, 2017
70dc7ff
新功能 In Reply To (#868)
huacnlee Feb 22, 2017
1cb4e71
Update routes
huacnlee Feb 23, 2017
c67918e
Merge branch 'master' of github.com:ruby-china/homeland
huacnlee Feb 23, 2017
2d99d44
Remove old Array fields, they were instead by ActionStore. (#860)
huacnlee Feb 23, 2017
f9edfbd
调整个人设置页面,将不同功能拆分为子页面 (#869)
huacnlee Feb 23, 2017
be36c66
新增打赏功能 (#871)
huacnlee Feb 24, 2017
ce7a2b0
修复老的 /account/edit -> /setting (#872)
huacnlee Feb 24, 2017
f48cd79
Fix #873, remove ruby china. (#874)
NeverMin Feb 26, 2017
a6415f2
Fix lint
huacnlee Feb 26, 2017
21a8402
Fix CI
huacnlee Feb 26, 2017
e4aabc3
新增 Youku 视频插入的支持. (#875)
huacnlee Feb 27, 2017
18229e6
Remove Code Climate badge, it no longer updated.
huacnlee Feb 27, 2017
aa1c1c4
Merge branch 'master' of github.com:ruby-china/homeland
huacnlee Feb 27, 2017
47cb9b2
Allow nested layout
huacnlee Feb 27, 2017
5ea4fca
Fix avatar_helper, use main_app.user_path
huacnlee Feb 27, 2017
ae45860
Version 2.7.0
huacnlee Feb 27, 2017
d36f032
新增插件有关的几个函数,以便于插件可以在导航栏、用户菜单显示 (#876)
huacnlee Feb 28, 2017
bb2626a
Add press module for config.yml.default.
huacnlee Feb 28, 2017
18e21e2
Homeland::Plugin 新增 admin_navbar_link, admin_path 两个参数,以便可以让 Plugin 往…
huacnlee Feb 28, 2017
59a0e75
Update homeland-press plugin 0.2.0
huacnlee Feb 28, 2017
e01c423
homeland-press 0.2.1
huacnlee Feb 28, 2017
bfcf01f
Fix bad indent
huacnlee Feb 28, 2017
79a77f5
Update CONTRIBUTE.md with #879
huacnlee Mar 1, 2017
63220fa
Gemfile special Ruby 2.4
huacnlee Mar 1, 2017
406ed9a
elasticsearch rebuild Topic error #880 (#881)
NeverMin Mar 1, 2017
728131b
Update PLUGIN_DEV.md
huacnlee Mar 2, 2017
d32964e
Update PLUGIN_DEV.md [skip ci]
huacnlee Mar 2, 2017
8e3cfaf
Add plugin migration doc [skip ci]
huacnlee Mar 2, 2017
86fd5b8
主导航用 render_list Helper 生成,以便于有准确的 active 状态。
huacnlee Mar 2, 2017
a829214
tabs -> space
huacnlee Mar 2, 2017
90aaabb
剥离 /jobs 成为 homeland-jobs 插件。
huacnlee Mar 2, 2017
ed16d30
Merge branch 'master' of github.com:ruby-china/homeland
huacnlee Mar 2, 2017
d927dd0
Merge branch 'feature/plugin-jobs'
huacnlee Mar 2, 2017
879707a
Fix typo or PLUGIN_DEV [skip ci]
huacnlee Mar 2, 2017
01ec4b7
[Break Changes] User 里面去掉 :hr 字, 实际上不太需要 (#882)
huacnlee Mar 2, 2017
0530e0d
Add fixme comment [skip ci]
huacnlee Mar 2, 2017
fdea253
Merge branch 'master' of github.com:ruby-china/homeland
huacnlee Mar 2, 2017
720b6ad
Add jobs to config.yml.default, and remove hr from profile_fields
huacnlee Mar 2, 2017
e70e1ab
Mobile View 展示不要显示非话题的导航链接;
huacnlee Mar 2, 2017
3c0ae00
Revert "elasticsearch rebuild Topic error #880 (#881)"
huacnlee Mar 3, 2017
13e64d7
Upgrade Rails 5.0.2 (#883)
Eric-Guo Mar 3, 2017
547c3d1
Add sdoc
huacnlee Mar 3, 2017
8678102
Merge branch 'master' of github.com:ruby-china/homeland
huacnlee Mar 3, 2017
e139ec7
http -> https [skip ci]
huacnlee Mar 3, 2017
026047c
Remove via from social-share-button default message
huacnlee Mar 3, 2017
392883a
homeland-press 0.3.1
huacnlee Mar 3, 2017
663d152
回复楼层编号的显示,ReplyTo 里面用楼层号代替 ReplyId
huacnlee Mar 3, 2017
16ee708
sdoc need in production
huacnlee Mar 3, 2017
2759c8e
homeland-press 0.3.2
huacnlee Mar 3, 2017
840ec47
insert the toc placeholder before article content
Martin91 Mar 4, 2017
5f247af
toc panel style design
Martin91 Mar 4, 2017
07336c4
enable too module work with extracting headers
Martin91 Mar 4, 2017
5ce7bd9
refactor to extract the toc partial
Martin91 Mar 4, 2017
08cc10d
enable toc on wiki pages
Martin91 Mar 4, 2017
65f9224
optimize the ui and clear unnecessary console.log
Martin91 Mar 5, 2017
1c7bbdd
use font awesome icon instead of text
Martin91 Mar 5, 2017
eb9e195
use translations for contents instead of TOC
Martin91 Mar 5, 2017
7d6eb71
- Extract wiki as a plugin
griffinqiu Mar 5, 2017
66beb8a
Use a fake commentable for comment spec test
griffinqiu Mar 5, 2017
facf6c0
Changed the gem source protocol
griffinqiu Mar 5, 2017
528d3e4
提取 Wiki 作为 homeland-wiki 的插件 (#886)
griffinqiu Mar 6, 2017
aeb578e
Revert "提取 Wiki 作为一个 Homeland 的插件" (#887)
huacnlee Mar 6, 2017
4eae629
Markdown 转换的文章正文,新增 TOC (Table of Contents)支持(#791)
huacnlee Mar 6, 2017
738c0e9
调整 Toc 的实现细节 #791
huacnlee Mar 6, 2017
c8f0794
Hide toc-container by default #791
huacnlee Mar 6, 2017
3e76190
Toc feature No Rails template now, just only JavaScript #791
huacnlee Mar 6, 2017
7afb7ef
Fix toc container css
huacnlee Mar 6, 2017
3b89bf8
Toc only work with .markdown-toc
huacnlee Mar 6, 2017
2d0099d
Fix z-index of Toc list
huacnlee Mar 6, 2017
5e10e33
Fix duplicate Toc button bug on turbolinks reload
huacnlee Mar 6, 2017
14f7888
Merge branch 'master' into wiki-as-a-plugin
griffinqiu Mar 6, 2017
10363e9
Changed homeland-wiki gem source
griffinqiu Mar 6, 2017
5379052
bundled
griffinqiu Mar 6, 2017
c945771
- Removed pages table migrate codes
griffinqiu Mar 6, 2017
530423d
Jobs is already extract as plugin.
Eric-Guo Mar 6, 2017
b003f04
Remove unused I18n var
huacnlee Mar 7, 2017
36d9301
提取 Wiki 作为一个 Homeland 的插件 #888
huacnlee Mar 7, 2017
95c8913
Fix Toc button margin.
huacnlee Mar 7, 2017
1f82c13
homeland-wiki 0.2.0
huacnlee Mar 7, 2017
143d54c
Fix page in search result. #888
huacnlee Mar 7, 2017
c729438
homeland 0.2.1
huacnlee Mar 7, 2017
400f246
version 3.0.0.beta
huacnlee Mar 7, 2017
2127d38
Bundle Update on 2017-03-07
deppbot Mar 7, 2017
a3044bf
Merge pull request #891 from ruby-china/bundle-update-2017-03-07-221946
huacnlee Mar 7, 2017
c3a50a1
homeland-press 0.3.3
huacnlee Mar 7, 2017
cce2035
改进个人收藏的查询方式,同时修正分页数量的问题;
huacnlee Mar 7, 2017
ee04b4c
Upgrade RuCaptcha 2.1.1
huacnlee Mar 9, 2017
7109b7b
修正 InReplyTo 展开以后,点击回复,会出现重复名称的问题
huacnlee Mar 9, 2017
9d4d7a6
Fix stupid typo with @suggest_topics cache key
huacnlee Mar 10, 2017
b2b486f
修正 closeable Topic save 失败没 rollback 的问题.
huacnlee Mar 13, 2017
5c8e13b
去掉 ETag,目前逻辑和定制功能复杂了,无法完全覆盖到刷新缓存.
huacnlee Mar 13, 2017
92ae0a0
Fix /topics/node:id
huacnlee Mar 13, 2017
018e82d
修正 Fragment Cache 在 ManyToMany 的场景 cache_key 无法计算正确的问题。
huacnlee Mar 13, 2017
c763cdc
修正 /topics/favorites 可能异常的问题
huacnlee Mar 13, 2017
2421664
搜索结果里面现在 Topic 的创建时间,因为 updated_at 不是准确的信息
huacnlee Mar 14, 2017
53d88a5
Remove russian-roll caching for topic list
huacnlee Mar 14, 2017
65521e9
Fix reopen message not present bug
huacnlee Mar 14, 2017
53079c6
Bundle Update on 2017-03-14
deppbot Mar 14, 2017
792d36b
Merge pull request #896 from ruby-china/bundle-update-2017-03-14-232618
huacnlee Mar 15, 2017
c7759e7
实现 Comment 的 Mentionable 支持,同时实现 Comment 的通知模版
huacnlee Mar 16, 2017
08f9ca1
Comment 创建的时候通知原文作者。
huacnlee Mar 16, 2017
672d3e2
修 Mentionable 的场景 Bug 以及测试.
huacnlee Mar 16, 2017
5f4b373
使 https://ruby-china.org/aerw/owier.jpg 这样的请求不返回 500
wootaw Mar 16, 2017
a24d0c1
Merge pull request #898 from wootaw/master
huacnlee Mar 17, 2017
8369689
use attr_writer
huacnlee Mar 17, 2017
f47f0ec
Merge branch 'master' of github.com:ruby-china/homeland
huacnlee Mar 17, 2017
7d10ab2
fix: resubscribe when topic change
lokyoung Mar 19, 2017
35b9c2e
Resubscribe channel when topic changed.
huacnlee Mar 20, 2017
bf920b8
Fix undefined method `match?' for nil:NilClass bug.
huacnlee Mar 20, 2017
7d77ab5
Update homeland-wiki 0.2.2
huacnlee Mar 20, 2017
26a87e4
修 Mobile View 缺少分页按钮的问题.
huacnlee Mar 20, 2017
ebcd435
主导航在移动布局的响应式效果实现.
huacnlee Mar 20, 2017
388d854
Ignore ActionController::InvalidCrossOriginRequest exceptions
huacnlee Mar 21, 2017
6ba577a
Fix admin navbar
huacnlee Mar 21, 2017
6443c5d
支持 Plugin 的菜单基于 config.modules 的排列顺序排列。
huacnlee Mar 21, 2017
05b900d
Fix PLUGIN_DEV typo
huacnlee Mar 21, 2017
3ae8d6c
Fix #903 剥离记事本成为独立插件 homeland-note
huacnlee Mar 21, 2017
3654969
homeland-note 0.1.2
huacnlee Mar 21, 2017
6b4a089
Fix test
huacnlee Mar 21, 2017
29f9474
Fix test
huacnlee Mar 21, 2017
67ac147
剥离记事本成为独立插件 homeland-note
huacnlee Mar 21, 2017
a129e7c
剥离酷站的功能到 homeland-site 插件。
huacnlee Mar 21, 2017
a29460e
剥离酷站的功能到 homeland-site 插件。
huacnlee Mar 21, 2017
3b168ea
调整默认 modules 的顺序.
huacnlee Mar 21, 2017
9638fe8
Remove SiteNode from seeds
huacnlee Mar 21, 2017
40b165f
Remove site I18n [skip ci]
huacnlee Mar 21, 2017
71f327e
新增 Vimdeo 视频插入的支持。
huacnlee Mar 22, 2017
aabe8f2
Update homeland-note.
huacnlee Mar 22, 2017
cd7bebe
Fix render_node_name route name not found bug
huacnlee Mar 22, 2017
ade2644
屏蔽的时候支持选择/编写屏蔽原因,以 SystemEvent 的方式创建 Reply 用于提示。
huacnlee Mar 22, 2017
06bdfb2
Merge pull request #909 from ruby-china/feature/ban-reason
huacnlee Mar 22, 2017
5206c00
Bundle Update on 2017-03-24
deppbot Mar 23, 2017
76e4b6b
Merge pull request #911 from ruby-china/bundle-update-2017-03-24-013634
huacnlee Mar 24, 2017
fe939f0
Fix lint
huacnlee Mar 30, 2017
2418f87
Team 页面的话题列表改为包含所有成员的话题。
huacnlee Apr 6, 2017
dce95af
version 3.0.0
huacnlee Apr 7, 2017
c2852aa
Upgrade homeland-press to fix that exception when `press` not enable.
huacnlee Apr 7, 2017
e33f979
Version 3.0.1
huacnlee Apr 7, 2017
f8c7ad9
调整头像上传逻辑,确保每次上传都是新的头像地址,已解决 #637 的问题。
huacnlee Apr 10, 2017
e94ccba
头像的随机字符串改用 id/SecureRandom.hex(3) 碰撞概率太低了
huacnlee Apr 10, 2017
ecf5543
Photo 的文件名改成 uuid
huacnlee Apr 10, 2017
47f5a71
Merge pull request #915 from ruby-china/refactor/user-avatar-url
huacnlee Apr 10, 2017
a066b60
Fix test
huacnlee Apr 11, 2017
4637790
微调正文的样式,字体 15px,图片剧中
huacnlee Apr 14, 2017
07e7453
修正 Module 关闭后,现存的 Notification 可能带来的异常,同时调整通知的文字颜色
huacnlee Apr 14, 2017
565bce4
Fix blockquote font-size
huacnlee Apr 17, 2017
9d97ff6
修正前端 Mention 的 autocomplete 列表多出现 in-reply-to 的用户名的问题
huacnlee Apr 17, 2017
6561953
再次修正话题里面 Mention AutoComplete 的用户名问题.
huacnlee Apr 17, 2017
b7ed870
admin user should also has constraint (#917)
lengshuiyulangcn Apr 18, 2017
1404e9d
Lock Rubocop version
huacnlee Apr 18, 2017
82a4796
fixed Chrome: This page is trying to load scripts from unauthenticate…
NeverMin Apr 18, 2017
b6d48f2
Merge branch 'master' of github.com:ruby-china/homeland
huacnlee Apr 28, 2017
d19ad47
Upgrade action-store for fix #922 incorrect User following_count bug
huacnlee Apr 28, 2017
57679c8
Fix #920 `can?` 方法调用要带括号,否则会导致后面逻辑错误,修正 Team 成员列表 Owner 无法显示编辑的问题。
huacnlee Apr 28, 2017
8553683
Version 3.0.2
huacnlee Apr 28, 2017
b63550e
修复了一个缺少 <% end %> 导致的问题
lgn21st May 1, 2017
5fd91c7
修复API文档一处小错误;另外在获取话题的回帖列表时,返回回帖的详细内容 (#930)
Macrow May 23, 2017
1619185
修改 API 文档一处小错误,此处应该返回的是用户列表而不是话题列表 (#934)
douo Jun 1, 2017
ba3b54f
Fixing missing i18n translation
lgn21st Jun 1, 2017
ddfed99
Gemfile use rails 5.1.0.beta, 执行 rails app:update 调整默认文件.
huacnlee Feb 24, 2017
0ce87c5
form_for -> form_with
huacnlee Feb 24, 2017
05ba529
Remove missed assets call
huacnlee Feb 24, 2017
6610c94
Fix attribuate_changed? warnning in save callbacks.
huacnlee Feb 24, 2017
6901aa7
Remove ApplicationRecord unused `push`, `pull` method
huacnlee Feb 24, 2017
c173095
Remove Devise config.secret_key, base on Rails secret_key_base
huacnlee Feb 24, 2017
5f67115
EnforcedStyle: double_quotes
huacnlee Feb 24, 2017
e9e55f3
config.read_encrypted_secrets = false 保持原有的方式,因为 Docker 的流程 secrets 是保密的
huacnlee Feb 24, 2017
abb5d0b
Fix issue that when mention a Team, will can not create Topic/Reply.
huacnlee Jun 9, 2017
4caf5d3
Merge pull request #870 from ruby-china/upgrade-rails-5.1
huacnlee Jun 9, 2017
888f9da
Version 3.0.3
huacnlee Jun 9, 2017
d647a69
Fix lint
huacnlee Jun 9, 2017
914f1f7
Fix test case
huacnlee Jun 9, 2017
6c3d36b
修正前端 reply-to 无法生效的问题;
huacnlee Jun 9, 2017
3fe1fc1
Version 3.0.4
huacnlee Jun 9, 2017
71683a6
修正创建新回复以后,文本框没清空的问题
huacnlee Jun 9, 2017
1754097
Bundle Update on 2017-06-10
deppbot Jun 10, 2017
af04a16
修正升级 Rails 5.1 以后更新打赏二维码界面的错误
huacnlee Jun 19, 2017
62658f6
Version 3.0.5
huacnlee Jun 19, 2017
5711668
运行提交
Jun 21, 2017
c88e7e1
env to request.env to avoid github login failure
lihuazhang Jun 21, 2017
83302a8
Merge pull request #939 from lihuazhang/patch-2
huacnlee Jun 21, 2017
36eb71b
挂载
Jun 21, 2017
1aad64d
Bring back navbar and title for oauth pages (#941)
larrylv Jul 4, 2017
4d705c1
Add a missing close div tag for account.html.erb (#943)
Jul 21, 2017
370d6e6
Version 3.0.6
huacnlee Aug 2, 2017
d4748c0
更新 Vagrant 开发环境 (#945)
lonre Aug 3, 2017
26710ca
Remove dotted underscore from abbr tag
huacnlee Aug 7, 2017
4742fe7
Change bg color
huacnlee Aug 7, 2017
793cb36
Merge pull request #1 from ruby-china/bundle-update-2017-06-10-183434
niejingfa Aug 7, 2017
63772c7
merge
Aug 7, 2017
883a94b
merge
Aug 12, 2017
3110eb8
Fix isLogined return false after user signed in
jasl Aug 13, 2017
e905fee
屏蔽话题对话框改成 remote: true,以修正 iOS App 无法使用的问题.
huacnlee Aug 14, 2017
625ee8e
version 3.0.7
huacnlee Aug 14, 2017
17d3846
fix typo (#948)
Aug 15, 2017
c6483f2
相关话题的搜索条件修正,采用 `more_like_this` 新的写法,避免服务器大量 WARN.
huacnlee Aug 16, 2017
13509ab
Bundle update
huacnlee Aug 28, 2017
b7bbc21
Merge branch 'master' into master
niejingfa Sep 20, 2017
3f302ea
merge
Sep 20, 2017
c319639
Gemlock
Sep 20, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
exclude_paths:
- "lib/assets/**/*"
- "app/controllers/admin/**/*"
- "public/api-doc/**/*"
35 changes: 33 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,42 @@
.bundle
tmp/
coverage/
db/*.sqlite3
tmp/
log/*.log
log/*.log*
tmp/**/*
.sass-cache/
.yardoc/
public/assets/
config/database.yml
config/mongoid.yml
config/config.yml
config/thin.yml
config/redis.yml
config/mailer_daemon.yml
config/secrets.yml
public/photo/**/*
public/user/**/*
public/uploads/**/*
public/javascripts/cached_*
public/stylesheets/cached_*
public/system/**/*
public/topics
public/topics/**/*
public/doc
.redcar
.DS_Store
*.swp
*.swo
*.sublime-workspace
.rvmrc
vendor/ruby
doc/wiki_repo
solr/data/
solr/pids/
tags
chromedriver.log
.idea/
spec/examples.txt
.vagrant
.byebug_history
.ruby-version
3 changes: 3 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--color
-f progress
--require spec_helper
93 changes: 93 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
AllCops:
Exclude:
- 'vendor/**/*'
- 'lib/templates/**/*'
- 'lib/tasks/release.rake'
- 'spec/**/*'
- 'app/models/cache_version.rb'
- 'Gemfile'
- 'db/**/*'
- 'config/**/*'
TargetRubyVersion: 2.4

Style/Documentation:
Enabled: false

Style/FrozenStringLiteralComment:
Enabled: false

Style/StringLiterals:
Enabled: true
EnforcedStyle: double_quotes

Style/UnneededPercentQ:
Enabled: true

Style/AsciiComments:
Enabled: false

Style/IfUnlessModifier:
Enabled: false

Style/NumericPredicate:
EnforcedStyle: comparison

Style/PredicateName:
Enabled: false

Style/GuardClause:
Enabled: false

Style/RedundantSelf:
Enabled: false

Style/RaiseArgs:
EnforcedStyle: compact

Style/MutableConstant:
Enabled: false

Metrics/LineLength:
Max: 1200

Metrics/ClassLength:
Max: 1200

Metrics/MethodLength:
Max: 1200

Metrics/ModuleLength:
Max: 1200

Metrics/BlockLength:
Max: 1200

Metrics/CyclomaticComplexity:
Enabled: false

Metrics/AbcSize:
Enabled: false

Metrics/PerceivedComplexity:
Enabled: false

Rails/TimeZone:
Enabled: false

Style/GlobalVars:
Enabled: false

Style/GuardClause:
Enabled: false

Rails/FindBy:
Enabled: false

Rails/HasAndBelongsToMany:
Enabled: false

Style/EmptyMethod:
EnforcedStyle: expanded

Style/LambdaCall:
Enabled: false
37 changes: 37 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
language: ruby

addons:
postgresql: "9.4"

services:
- postgresql
- memcached
- redis-server
- elasticsearch

rvm:
- 2.4.0

matrix:
fast_finish: true
allow_failures:
- rvm: ruby-head

before_install:
- sed -i "s/gems.ruby-china.org/rubygems.org/g" Gemfile.lock
- psql -c "CREATE USER \"admin\" WITH CREATEDB PASSWORD 'admin';" -U postgres
- psql -c "create database \"homeland-test\" WITH OWNER=\"admin\";" -U postgres
- cp config/config.yml.default config/config.yml
- cp config/database.yml.default config/database.yml
- cp config/redis.yml.default config/redis.yml
- cp config/elasticsearch.yml.default config/elasticsearch.yml
- cp config/secrets.yml.default config/secrets.yml
- sed -i "s/SETUP_REDIS_HOST/127.0.0.1/g" config/redis.yml
- sed -i "s/SETUP_REDIS_PORT/6379/g" config/redis.yml

before_script:
- RAILS_ENV=test bundle exec rake db:migrate

script:
- bundle exec rubocop .
- RAILS_ENV=test bundle exec rake
72 changes: 72 additions & 0 deletions API.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# API 文档

## OAuth 2 / API 认证

在使用 API 之前,你需要 [注册应用](/oauth/applications/new) 并获得可以 **OAuth App** 信息。并使用标准的 OAuth 2 实现登录,获得 `access_token` 信息。

### OAuth 路径

- /oauth/authorize
- /oauth/token
- /oauth/revoke

### Response 说明

所有 Response 采用 JSON 格式返回,请求状态通过 HTTP Status 返回。

### HTTP Status

错误的情况 Response Body 一定会是这样的格式: `{ "error" : "Error message" }`

- 200, 201 - 请求成功,或执行成功。
- 400 - 参数不符合 API 的要求、或者数据格式验证没有通过,请配合 Response Body 里面的 error 信息确定问题。
- 401 - 用户认证失败,或缺少认证信息,比如 access_token 过期,或没传,可以尝试用 refresh_token 方式获得新的 access_token。
- 403 - 当前用户对资源没有操作权限。
- 404 - 资源不存在。
- 500 - 服务器异常。

#### 资源权限描述

在部分 API 的 response 内容里面你会看到 `abilities` 节点,这是特别标识当前 `access_token` 对应的用户对此资源的权限。

请参考源代码,确定那些路径是需要用户认证的,需要用户认证的路径,你需要带上 `access_token=?` 参数。

**例如**

```json
{
"topic": {
"id": 256170,
....,
"abilities": { "update": true, "destroy": true }
}
}
```

- update 是否有权限修改
- destroy 是否有权限删除

## API 路由

API 的详细文档,请访问 [Api::V3](/api-doc/Api/V3.html) 阅读。

## 演示

我们用 Ruby 演示一下访问 [/api/v3/hello.json](/api-doc/Api/V3/RootController.html#hello-instance_method) 这个路径,其中包含 OAuth 2 的流程。

_这里用到 RubyGem [oauth2](https://github.com/intridea/oauth2)_

```rb
require "oauth2"
client = OAuth2::Client.new('client id', 'secret', site: 'https://ruby-china.org')
access_token = client.password.get_token('username', 'password')
res = Faraday.get("https://ruby-china.org/api/v3/hello.json?access_token=#{access_token.token}")
puts res.status
puts res.body
```

最后输出

```rb
{ 'current_user' : 'username' }
```
20 changes: 20 additions & 0 deletions Benchmarks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 页面响应时间记录

要点,所有统计都得基于有 cache 的情况,生产环境。

## 2015-5-28

- / = 36ms
- /topics = 45ms
- /topics/19436 = 67ms
- /wiki = 26ms
- /notifications = 39ms
- /huacnlee = 100ms
- /huacnlee/topics = 95ms
- /huacnlee/favorites = 50ms
- /huacnlee/followers = 85ms
- /wiki/about = 37ms
- /jobs = 68ms
- /topics/new = 84ms
- /sites = 25ms
- /account/edit = 73ms
75 changes: 75 additions & 0 deletions CONTRIBUTE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
Contribute Guide
----------------

## Requirements

* Ruby 2.4.0 +
* PostgreSQL 9.4 +
* Redis 2.8 +
* Memcached 1.4 +
* Elasticsearch 2.0 +

## Install in development

### Mac OS X, use Homebrew

```bash
$ brew install memcached redis postgresql imagemagick gs elasticsearch
```

### Ubuntu

```bash
$ sudo apt-get install memcached postgresql postgresql-contrib redis-server imagemagick ghostscript
```

Install Elasticsearch

```bash
curl -sSL https://git.io/vVHhm | bash
```

```bash
$ git clone https://github.com/ruby-china/homeland.git
$ cd homeland
$ ./bin/setup
Checking Package Dependencies...
--------------------------------------------------------------------------------
Redis 2.0+ [Yes]
Memcached 1.4+ [Yes]
ImageMagick 6.5+ [Yes]
--------------------------------------------------------------------------------

Installing dependencies
--------------------------------------------------------------------------------
The Gemfile's dependencies are satisfied
--------------------------------------------------------------------------------

Configure
--------------------------------------------------------------------------------
Your Redis host (default: 127.0.0.1:6379):
Your Elasticsearch host (default: 127.0.0.1:9200):
--------------------------------------------------------------------------------

Seed default data... [Done]

== Removing old logs and tempfiles ==

Homeland Successfully Installed.

$ rails s
```

## Testing

```bash
bundle exec rake
```

## Reindex ElasticSearch

```bash
rails environment elasticsearch:import:model CLASS=Page FORCE=y
rails environment elasticsearch:import:model CLASS=Topic FORCE=y
rails environment elasticsearch:import:model CLASS=User FORCE=y
```
Loading