qiita_matome 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c28828004e752e84cbc90e62ab95234f7a1ca99
4
- data.tar.gz: 097cd2f62928e55f42ac75d500f3b2d7eba6982a
3
+ metadata.gz: b78761a26f90ad83b7da36ad300c758992084b4c
4
+ data.tar.gz: 99a59f4b7f956863870d7e1c112e83ea12a9c68b
5
5
  SHA512:
6
- metadata.gz: c4e1227e445a85e8ec077313791ddeaaa92abe213865a940811477733dba71da41dcad873cee2435543fa525967aa3f629ce5197b567243fa437648c69ab409e
7
- data.tar.gz: b39fb658de739614ff5af2fd9e7fc1cbaf7577d6adb8c993a3933a59aa68da95fe4a7c7aaa2b0f4c836f9eb7dc841facb31add61dbe8c364e90805d5a5d7104d
6
+ metadata.gz: 8dd3305300be7a857088c04ed926181f17d2c553eb36896f7704823c61825a65a1c19bca025770e55827ff9125a5a337a79d6ce6a91eeb1b7926aa5365e19c9a
7
+ data.tar.gz: 469035ec973799799af011a9185259069e58a4bf890b0f90d3a1ba5394e1bb76ca69ef57e911596587dd8311c0f70a88cee551f572469acddaf30543f1f6b1e7
@@ -1 +1 @@
1
- service_name: travis-ci
1
+ service_name: travis-ci
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
- --color
2
- --format progress
1
+ --color
2
+ --format progress
@@ -1,8 +1,7 @@
1
- language: ruby
2
- before_install:
3
- - gem update --system 2.1.11
4
- - gem --version
5
- rvm:
6
- - 1.9.3
7
- - 2.0.0
8
- - 2.1
1
+ language: ruby
2
+ before_install:
3
+ - gem update --system 2.1.11
4
+ - gem --version
5
+ rvm:
6
+ - 2.0.0
7
+ - 2.1
@@ -1,44 +1,42 @@
1
- # contributing 注意事項
2
-
3
- ## ブランチに関して
4
- * *master* を直接編集せずにトピックブランチを作成して *pull request* を行うこと
5
- * トピックブランチは修正内容を表した、わかりやすい名前にすること
6
-
7
- ## コーディング規約について
8
-
9
- * **Ruby Style Guide** に準じます
10
-
11
- * [Ruby Style Guide 英語版](https://github.com/bbatsov/ruby-style-guide)
12
- * [Ruby Style Guide 和訳版](https://github.com/fortissimo1997/ruby-style-guide/blob/japanese/README.ja.md)
13
-
14
- ## RuboCopの利用に関して
15
- * *rubocop* の警告が1件も発生しない状態で *pull request* を行うこと
16
-
17
- ~~~bash
18
- # プロジェクトルートへ移動
19
- $ cd qiita_matome
20
- # プロジェクト全体に対して rubocop のチェックを実行
21
- $ rubocop
22
- Inspecting 32 file
23
- .
24
-
25
- 32 file inspected, no offenses detected
26
-
27
- # ※ no offenses detected になっていること
28
- ~~~
29
-
30
- * *rubocop* の警告について、どうしても規約を守ることが難しい場合は警告除外用のコメントを利用してください
31
-
32
- 除外方法については [こちらの記事](http://qiita.com/tbpgr/items/a9000c5c6fa92a46c206) を参照
33
-
34
- ## RSpecのテストに関して
35
- * RSpecの単体テストを一緒に作成してください。
36
- * 事情があって **例外的に** 単体テストの作成をしない場合は、手動テストの項目・手順を *manual_test_docs* に作成してください。
37
-
38
- ※なぜ単体テストを作成しないのか、 **理由** を *pull request* 時のコメントに記述してください。
39
- 例えば、 *lib / qiita_json_loader.rb* などは、Qiita のWeb API へのアクセスが主であるため、
40
- あえて単体テストを作成していません。
41
-
42
- * テストの作成は [*rspec_piccolo gem*](https://github.com/tbpgr/rspec_piccolo) を利用していただけると体裁が整って嬉しいですが必須ではありません。
43
-
1
+ # contributing 注意事項
2
+
3
+ ## ブランチに関して
4
+ * *master* を直接編集せずにトピックブランチを作成して *pull request* を行うこと
5
+ * トピックブランチは修正内容を表した、わかりやすい名前にすること
6
+
7
+ ## コーディング規約について
8
+
9
+ * **Ruby Style Guide** に準じます
10
+
11
+ * [Ruby Style Guide 英語版](https://github.com/bbatsov/ruby-style-guide)
12
+ * [Ruby Style Guide 和訳版](https://github.com/fortissimo1997/ruby-style-guide/blob/japanese/README.ja.md)
13
+
14
+ ## RuboCopの利用に関して
15
+ * *rubocop* の警告が1件も発生しない状態で *pull request* を行うこと
16
+
17
+ ~~~bash
18
+ # プロジェクトルートへ移動
19
+ $ cd qiita_matome
20
+ # プロジェクト全体に対して rubocop のチェックを実行
21
+ $ rubocop
22
+ Inspecting 32 file
23
+ .
24
+
25
+ 32 file inspected, no offenses detected
26
+
27
+ # ※ no offenses detected になっていること
28
+ ~~~
29
+
30
+ * *rubocop* の警告について、どうしても規約を守ることが難しい場合は警告除外用のコメントを利用してください
31
+
32
+ 除外方法については [こちらの記事](http://qiita.com/tbpgr/items/a9000c5c6fa92a46c206) を参照
33
+
34
+ ## RSpecのテストに関して
35
+ * RSpecの単体テストを一緒に作成してください。
36
+ * 事情があって **例外的に** 単体テストの作成をしない場合は、手動テストの項目・手順を *manual_test_docs* に作成してください。
37
+
38
+ ※なぜ単体テストを作成しないのか、 **理由** を *pull request* 時のコメントに記述してください。
39
+
40
+ * テストの作成は [*rspec_piccolo gem*](https://github.com/tbpgr/rspec_piccolo) を利用していただけると体裁が整って嬉しいですが必須ではありません。
41
+
44
42
  ※冗長なテストよりは **DRYなテストが好みです**
data/Gemfile CHANGED
@@ -10,4 +10,5 @@ gem "simplecov", "~> 0.8.2"
10
10
  gem 'rubocop', '~> 0.23.0'
11
11
  group :test do
12
12
  gem 'coveralls', require: false
13
+ gem 'timecop', '~> 0.7.1'
13
14
  end
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # QiitaMatome
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/qiita_matome.svg)](http://badge.fury.io/rb/qiita_matome)
3
4
  [![Build Status](https://travis-ci.org/tbpgr/qiita_matome.png?branch=master)](https://travis-ci.org/tbpgr/qiita_matome)
4
5
  [![Coverage Status](https://coveralls.io/repos/tbpgr/qiita_matome/badge.png)](https://coveralls.io/r/tbpgr/qiita_matome)
5
6
  [![Code Climate](https://codeclimate.com/github/tbpgr/qiita_matome.png)](https://codeclimate.com/github/tbpgr/qiita_matome)
@@ -11,7 +12,7 @@ Qiitaのまとめページジェネレーター
11
12
  Qiitaの特定ユーザー、特定タグのリンクを一覧化したまとめ記事を生成する。
12
13
 
13
14
  ## 前提
14
- * 認証不要(認証不要APIである、`GET /api/v1/users/:url_name/items` のみを利用する)
15
+ * 認証不要(認証不要APIである、`GET /api/v2/users/:url_name/items` のみを利用する)
15
16
  * 任意のユーザーの任意の1つのタグに限定してまとめ記事を作成する
16
17
 
17
18
  ※基本的には自分のユーザーのまとめを作ることを想定しています
@@ -76,15 +77,15 @@ title "your value"
76
77
  # output_file's default value => "matome.md"
77
78
  output_file "matome.md"
78
79
 
79
- # Set your matome sort type. you can choose created_at_asc/desc, updated_at_asc/desc, title_asc/desc, stock_count_asc/desc
80
+ # Set your matome sort type. you can choose created_at_asc/desc, updated_at_asc/desc, title_asc/desc, likes_count_asc/desc
80
81
  # sort_type allow only String
81
82
  # sort_type's default value => "created_at_desc"
82
83
  sort_type "created_at_desc"
83
84
 
84
- # Set your matome display columns. you can choose :title, :created_at, :updated_at, :stock_count and :no
85
+ # Set your matome display columns. you can choose :title, :created_at, :updated_at, :likes_count and :no
85
86
  # display_columns allow only Array
86
- # display_columns's default value => [:no, :title, :created_at, :stock_count]
87
- display_columns [:no, :title, :created_at, :stock_count]
87
+ # display_columns's default value => [:no, :title, :created_at, :likes_count]
88
+ display_columns [:no, :title, :created_at, :likes_count]
88
89
 
89
90
  # Set your matome exclude files
90
91
  # excludes allow only Array
@@ -101,7 +102,7 @@ excludes []
101
102
  |title|○|なし|まとめ記事タイトル|
102
103
  |output_file|○|matome.md|出力パス|
103
104
  |sort_type|×|created_at_desc|まとめ記事内のソート順。詳しくはソート種別参照|
104
- |display_columns|×|[:no, :title, :created_at, :stock_count]|まとめ記事の表示項目指定。指定順に並ぶ。詳しくは表示項目参照|
105
+ |display_columns|×|[:no, :title, :created_at, :likes_count]|まとめ記事の表示項目指定。指定順に並ぶ。詳しくは表示項目参照|
105
106
  |exclude|×|[id1, id2...]|除外記事ID(uuid)を配列で指定。例えば、まとめ記事自信を除外するために指定|
106
107
 
107
108
  ### ソート種別
@@ -114,8 +115,8 @@ excludes []
114
115
  |updated_at_desc|更新日降順|
115
116
  |title_asc|記事タイトル昇順|
116
117
  |title_desc|記事タイトル降順|
117
- |stock_count_asc|ストック数昇順|
118
- |stock_count_desc|ストック数降順。つまり人気記事順|
118
+ |likes_count_asc|いいね数昇順|
119
+ |likes_count_desc|いいね数降順。つまり人気記事順|
119
120
 
120
121
  ### 表示項目
121
122
 
@@ -124,7 +125,7 @@ excludes []
124
125
  |:title|記事タイトル。該当記事へのリンクになる|
125
126
  |:created_at|初回投稿日 「YYYY/MM/DD hh:mi:ss」 フォーマット|
126
127
  |:updated_at|更新日 「YYYY/MM/DD hh:mi:ss」 フォーマット|
127
- |:stock_count|ストック数|
128
+ |:likes_count|いいね数|
128
129
  |:no|連番|
129
130
 
130
131
  ## インストール
@@ -166,7 +167,7 @@ tag "rubocop"
166
167
  title "RuboCop まとめ タイトル昇順"
167
168
  output_file "./matome_title_asc.md"
168
169
  sort_type "title_asc"
169
- display_columns [:no, :title, :created_at, :stock_count]
170
+ display_columns [:no, :title, :created_at, :likes_count]
170
171
  # まとめ記事を除外
171
172
  excludes ['edbfecb6a6789dd54f47']
172
173
  ~~~
data/Rakefile CHANGED
@@ -1,8 +1,8 @@
1
- require 'bundler/gem_tasks'
2
- require 'rspec/core'
3
- require 'rspec/core/rake_task'
4
- task default: [:spec]
5
-
6
- RSpec::Core::RakeTask.new(:spec) do |spec|
7
- spec.pattern = 'spec/**/*_spec.rb'
8
- end
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core'
3
+ require 'rspec/core/rake_task'
4
+ task default: [:spec]
5
+
6
+ RSpec::Core::RakeTask.new(:spec) do |spec|
7
+ spec.pattern = 'spec/**/*_spec.rb'
8
+ end
data/bin/qiitam CHANGED
@@ -1,8 +1,14 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
3
 
4
- require 'qiita_matome_core'
5
- require 'qiita_matome/version'
4
+ begin
5
+ require 'qiita_matome_core'
6
+ require 'qiita_matome/version'
7
+ rescue LoadError
8
+ $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
9
+ require 'qiita_matome_core'
10
+ require 'qiita_matome/version'
11
+ end
6
12
  require 'thor'
7
13
 
8
14
  module QiitaMatome
@@ -8,26 +8,26 @@ module QiitaMatome
8
8
  TITLE = :title.freeze
9
9
  CREATED_AT = :created_at.freeze
10
10
  UPDATED_AT = :updated_at.freeze
11
- STOCKED = :stock_count.freeze
11
+ LIKED = :likes_count.freeze
12
12
  NO = :no.freeze
13
13
 
14
14
  ALIGN_RIGHT = :right
15
15
  ALIGN_LEFT = :left
16
16
  ALIGN_CENTER = :center
17
17
 
18
- COLUMNS = [TITLE, CREATED_AT, UPDATED_AT, STOCKED, NO]
18
+ COLUMNS = [TITLE, CREATED_AT, UPDATED_AT, LIKED, NO]
19
19
  COLUMNS_ALIGN_MAP = {
20
20
  TITLE => ALIGN_LEFT,
21
21
  CREATED_AT => ALIGN_CENTER,
22
22
  UPDATED_AT => ALIGN_CENTER,
23
- STOCKED => ALIGN_RIGHT,
23
+ LIKED => ALIGN_RIGHT,
24
24
  NO => ALIGN_RIGHT
25
25
  }
26
26
  COLUMNS_TITLE_MAP = {
27
27
  TITLE => 'タイトル',
28
28
  CREATED_AT => '作成日',
29
29
  UPDATED_AT => '更新日',
30
- STOCKED => 'ストック数',
30
+ LIKED => 'いいね数',
31
31
  NO => 'No.'
32
32
  }
33
33
  end
@@ -11,7 +11,7 @@ module QiitaMatome
11
11
  attr_reader :title, :articles, :display_columns
12
12
 
13
13
  def initialize(title, articles,
14
- display_columns = [:no, :title, :created_at, :stock_count])
14
+ display_columns = [:no, :title, :created_at, :likes_count])
15
15
  Validators::ArticlesValidator.validate(articles)
16
16
  Validators::ArticleValidator.validate(articles)
17
17
  display_columns_list = Array(display_columns)
@@ -43,7 +43,7 @@ module QiitaMatome
43
43
  when :title then article.title_link
44
44
  when :created_at then article.created_at_ymdhms
45
45
  when :updated_at then article.updated_at_ymdhms
46
- when :stock_count then article.stock_count
46
+ when :likes_count then article.likes_count
47
47
  end
48
48
  end
49
49
  "|#{disp.join('|')}|"
@@ -4,20 +4,19 @@ module QiitaMatome
4
4
  # QiitaMatome::Article
5
5
  class Article
6
6
  YMDHMS_DATETIME_FORMAT = '%Y/%m/%d %H:%M:%S'.freeze
7
- attr_accessor :user, :title, :uuid, :created_at, :updated_at, :tags, :stock_count # rubocop:disable LineLength
7
+ attr_accessor :user, :title, :uuid, :created_at, :updated_at, :tags, :likes_count # rubocop:disable LineLength
8
8
 
9
9
  # rubocop:disable MethodLength
10
10
  def initialize(options = {})
11
- @uuid = options['uuid']
11
+ @uuid = options['id']
12
12
  @user = options['user']
13
13
  @title = options['title']
14
- @uuid = options['uuid']
15
14
  c_at = options['created_at']
16
15
  u_at = options['updated_at']
17
16
  @created_at = DateTime.parse(c_at) unless c_at.nil?
18
17
  @updated_at = DateTime.parse(u_at) unless u_at.nil?
19
18
  @tags = options['tags']
20
- @stock_count = options['stock_count']
19
+ @likes_count = options['likes_count']
21
20
  yield(self) if block_given?
22
21
  end
23
22
  # rubocop:enable MethodLength
@@ -31,7 +30,7 @@ module QiitaMatome
31
30
  end
32
31
 
33
32
  def title_link
34
- url_name = user['url_name']
33
+ url_name = user['id']
35
34
  "[#{title.gsub('|', '')}](http://qiita.com/#{url_name}/items/#{uuid})"
36
35
  end
37
36
  end
@@ -8,7 +8,7 @@ module QiitaMatome
8
8
  # QiitaMatome::QiitaJsonLoader
9
9
  class QiitaJsonLoader
10
10
  attr_reader :user, :articles
11
- QIITA_URL = 'https://qiita.com/api/v1/users/%s/items?page=%s&per_page=%s'
11
+ QIITA_URL = 'https://qiita.com/api/v2/users/%s/items?page=%s&per_page=%s'
12
12
  PER_PAGE = 25
13
13
  PAGE_LIMIT = 100
14
14
 
@@ -1,4 +1,4 @@
1
1
  # QiitaMatome
2
2
  module QiitaMatome
3
- VERSION = '0.0.1'
3
+ VERSION = '0.1.0'
4
4
  end
@@ -37,15 +37,15 @@ title "your value"
37
37
  # output_file's default value => "matome.md"
38
38
  output_file "matome.md"
39
39
 
40
- # Set your matome sort type. you can choose created_at_asc/desc, updated_at_asc/desc, title_asc/desc, stock_count_asc/desc
40
+ # Set your matome sort type. you can choose created_at_asc/desc, updated_at_asc/desc, title_asc/desc, likes_count_asc/desc
41
41
  # sort_type allow only String
42
42
  # sort_type's default value => "created_at_desc"
43
43
  sort_type "created_at_desc"
44
44
 
45
- # Set your matome display columns. you can choose :title, :created_at, :updated_at, :stock_count and :no
45
+ # Set your matome display columns. you can choose :title, :created_at, :updated_at, :likes_count and :no
46
46
  # display_columns allow only Array
47
- # display_columns's default value => [:no, :title, :created_at, :stock_count]
48
- display_columns [:no, :title, :created_at, :stock_count]
47
+ # display_columns's default value => [:no, :title, :created_at, :likes_count]
48
+ display_columns [:no, :title, :created_at, :likes_count]
49
49
 
50
50
  # Set your matome exclude files
51
51
  # excludes allow only Array[String, String ...]
@@ -24,7 +24,7 @@ module QiitaMatome
24
24
  @qiita_matome = QiitaMatome::DslModel.new
25
25
  @qiita_matome.output_file = 'matome.md'
26
26
  @qiita_matome.sort_type = 'created_at_desc'
27
- @qiita_matome.display_columns = [:no, :title, :create_date, :stocked]
27
+ @qiita_matome.display_columns = [:no, :title, :create_date, :likes_count]
28
28
  @qiita_matome.excludes = []
29
29
  end
30
30
  end
@@ -24,11 +24,11 @@ module QiitaMatome
24
24
 
25
25
  # Set your matome sort type.
26
26
  # you can choose created_at_asc/desc, updated_at_asc/desc,
27
- # title_asc/desc, stock_count_asc/desc
27
+ # title_asc/desc, likes_count_asc/desc
28
28
  attr_accessor :sort_type
29
29
 
30
30
  # Set your matome display columns.
31
- # you can choose :title, :create_date, :update_date, :stocked and :no
31
+ # you can choose :title, :create_date, :update_date, :likes_count and :no
32
32
  attr_accessor :display_columns
33
33
 
34
34
  # Set your matome exclude files
@@ -11,8 +11,8 @@ module QiitaMatome
11
11
  UPDATED_AT_DESC = 'updated_at_desc'.freeze
12
12
  TITLE_ASC = 'title_asc'.freeze
13
13
  TITLE_DESC = 'title_desc'.freeze
14
- STOCK_COUNT_ASC = 'stock_count_asc'.freeze
15
- STOCK_COUNT_DESC = 'stock_count_desc'.freeze
14
+ LIKES_COUNT_ASC = 'likes_count_asc'.freeze
15
+ LIKES_COUNT_DESC = 'likes_count_desc'.freeze
16
16
  ALL_TYPES = [
17
17
  CREATED_AT_ASC,
18
18
  CREATED_AT_DESC,
@@ -20,8 +20,8 @@ module QiitaMatome
20
20
  UPDATED_AT_DESC,
21
21
  TITLE_ASC,
22
22
  TITLE_DESC,
23
- STOCK_COUNT_ASC,
24
- STOCK_COUNT_DESC
23
+ LIKES_COUNT_ASC,
24
+ LIKES_COUNT_DESC,
25
25
  ]
26
26
  end
27
27
  end
@@ -19,8 +19,8 @@ module QiitaMatome
19
19
  Consts::UPDATED_AT_DESC => { send_method: :sort_desc, sort_key: :updated_at },
20
20
  Consts::TITLE_ASC => { send_method: :sort_asc, sort_key: :title },
21
21
  Consts::TITLE_DESC => { send_method: :sort_desc, sort_key: :title },
22
- Consts::STOCK_COUNT_ASC => { send_method: :sort_asc, sort_key: :stock_count },
23
- Consts::STOCK_COUNT_DESC => { send_method: :sort_desc, sort_key: :stock_count }
22
+ Consts::LIKES_COUNT_ASC => { send_method: :sort_asc, sort_key: :likes_count },
23
+ Consts::LIKES_COUNT_DESC => { send_method: :sort_desc, sort_key: :likes_count },
24
24
  }
25
25
  # rubocop:enable LineLength
26
26
 
@@ -8,7 +8,7 @@ module QiitaMatome
8
8
  class DisplayColumnsValidator
9
9
  # rubocop:disable LineLength
10
10
  DISPLAY_COLUMNS_TO_SYM_ERROR = "Invalid display_columns. Display_columns's class must be implement 'to_sym' method."
11
- DISPLAY_COLUMNS_ERROR = "Invalid display_columns '%s'. Display_columns must be :title, :created_at, :updated_at, :stock_count or :no"
11
+ DISPLAY_COLUMNS_ERROR = "Invalid display_columns '%s'. Display_columns must be :title, :created_at, :updated_at, :likes_count or :no"
12
12
  # rubocop:enable LineLength
13
13
  DCC = Display::Consts::COLUMNS
14
14
 
@@ -7,7 +7,7 @@ module QiitaMatome
7
7
  # SortTypeValidator
8
8
  class SortTypeValidator
9
9
  # rubocop:disable LineLength
10
- SORT_TYPE_ERROR = "invalid sort_type '%s'. sort_type must be 'created_at_asc', 'created_at_desc', 'updated_at_asc', 'updated_at_desc', 'title_date_asc', 'title_date_desc', 'stock_count_asc' or 'stock_count_desc'"
10
+ SORT_TYPE_ERROR = "invalid sort_type '%s'. sort_type must be 'created_at_asc', 'created_at_desc', 'updated_at_asc', 'updated_at_desc', 'title_date_asc', 'title_date_desc', 'likes_count_asc' or 'likes_count_desc'"
11
11
  # rubocop:enable LineLength
12
12
 
13
13
  def self.validate(sort_type)
@@ -25,4 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency 'simplecov', '~> 0.8', '>= 0.8.2'
26
26
  spec.add_development_dependency 'bundler', '~> 1.6'
27
27
  spec.add_development_dependency 'rake', '~> 0'
28
+ spec.add_development_dependency 'timecop', '~> 0.7.1'
28
29
  end
@@ -1,25 +1,25 @@
1
- # RuboCop まとめ タイトル昇順
2
-
3
- 更新日: 2014/07/01 22:51:13
4
-
5
- |No.|タイトル|作成日|ストック数|
6
- |--:|:--|:--:|--:|
7
- |1|[RuboCop Style/AccessModifierIndentation](http://qiita.com/tbpgr/items/706d2b93052154772f18)|2014/06/15 00:53:36|4|
8
- |2|[RuboCop Style/AlignHash EnforcedColonStyle](http://qiita.com/tbpgr/items/b23d30a3b6284e800b60)|2014/06/16 21:41:26|4|
9
- |3|[RuboCop Style/AlignHash EnforcedHashRocketStyle](http://qiita.com/tbpgr/items/36788d9da32e7a6d6f43)|2014/06/15 23:19:06|3|
10
- |4|[RuboCop Style/AlignHash EnforcedLastArgumentHashStyle](http://qiita.com/tbpgr/items/e07749ec716247f0a409)|2014/06/17 21:25:54|4|
11
- |5|[RuboCop Style/AlignParameters EnforcedStyle](http://qiita.com/tbpgr/items/414e3aad8c3b56d2ce04)|2014/06/18 22:44:12|4|
12
- |6|[RuboCop Style/BlockNesting](http://qiita.com/tbpgr/items/21cca635527eb03e64f2)|2014/06/19 21:48:37|3|
13
- |7|[RuboCop Style/BracesAroundHashParameters EnforcedStyle](http://qiita.com/tbpgr/items/8932a19d154fc3d7c142)|2014/06/20 21:27:07|3|
14
- |8|[RuboCop Style/CaseIndentation Indent One Step](http://qiita.com/tbpgr/items/d14e825f6eb9c9175d6a)|2014/06/22 21:18:23|2|
15
- |9|[RuboCop Style/CaseIndentation IndentWhenRelativeTo](http://qiita.com/tbpgr/items/7323c764e3ae046a0fde)|2014/06/21 13:31:37|2|
16
- |10|[RuboCop Style/ClassAndModuleChildren EnforcedStyle](http://qiita.com/tbpgr/items/61b9da235701df919ae5)|2014/06/23 22:12:53|2|
17
- |11|[RuboCop Style/ClassLength](http://qiita.com/tbpgr/items/44087a9f4c6548043ace)|2014/06/24 20:28:50|2|
18
- |12|[RuboCop Style/CollectionMethods PreferredMethods](http://qiita.com/tbpgr/items/a982166bbd473fcd4e6e)|2014/06/26 00:06:37|1|
19
- |13|[RuboCop Style/CommentAnnotation](http://qiita.com/tbpgr/items/5b0cee75305cef801851)|2014/06/26 21:29:33|2|
20
- |14|[RuboCop Style/CyclomaticComplexity](http://qiita.com/tbpgr/items/693f37d763c6ea5f9e9b)|2014/06/27 21:55:52|2|
21
- |15|[RuboCop Style/DotPosition](http://qiita.com/tbpgr/items/c53f86c876f73c1aa5a8)|2014/06/28 23:08:32|2|
22
- |16|[RuboCop Style/EmptyLineBetweenDefs](http://qiita.com/tbpgr/items/2872f2a27430372d43e4)|2014/06/29 19:49:56|2|
23
- |17|[RuboCop Style/FileName](http://qiita.com/tbpgr/items/97fc9186e59d607b1ecf)|2014/06/30 21:56:25|1|
24
- |18|[RuboCopの警告をコメントで無効化する方法](http://qiita.com/tbpgr/items/a9000c5c6fa92a46c206)|2014/06/08 21:27:21|6|
25
-
1
+ # RuboCop まとめ タイトル昇順
2
+
3
+ 更新日: 2014/07/01 22:51:13
4
+
5
+ |No.|タイトル|作成日|いいね数|
6
+ |--:|:--|:--:|--:|
7
+ |1|[RuboCop Style/AccessModifierIndentation](http://qiita.com/tbpgr/items/706d2b93052154772f18)|2014/06/15 00:53:36|4|
8
+ |2|[RuboCop Style/AlignHash EnforcedColonStyle](http://qiita.com/tbpgr/items/b23d30a3b6284e800b60)|2014/06/16 21:41:26|4|
9
+ |3|[RuboCop Style/AlignHash EnforcedHashRocketStyle](http://qiita.com/tbpgr/items/36788d9da32e7a6d6f43)|2014/06/15 23:19:06|3|
10
+ |4|[RuboCop Style/AlignHash EnforcedLastArgumentHashStyle](http://qiita.com/tbpgr/items/e07749ec716247f0a409)|2014/06/17 21:25:54|4|
11
+ |5|[RuboCop Style/AlignParameters EnforcedStyle](http://qiita.com/tbpgr/items/414e3aad8c3b56d2ce04)|2014/06/18 22:44:12|4|
12
+ |6|[RuboCop Style/BlockNesting](http://qiita.com/tbpgr/items/21cca635527eb03e64f2)|2014/06/19 21:48:37|3|
13
+ |7|[RuboCop Style/BracesAroundHashParameters EnforcedStyle](http://qiita.com/tbpgr/items/8932a19d154fc3d7c142)|2014/06/20 21:27:07|3|
14
+ |8|[RuboCop Style/CaseIndentation Indent One Step](http://qiita.com/tbpgr/items/d14e825f6eb9c9175d6a)|2014/06/22 21:18:23|2|
15
+ |9|[RuboCop Style/CaseIndentation IndentWhenRelativeTo](http://qiita.com/tbpgr/items/7323c764e3ae046a0fde)|2014/06/21 13:31:37|2|
16
+ |10|[RuboCop Style/ClassAndModuleChildren EnforcedStyle](http://qiita.com/tbpgr/items/61b9da235701df919ae5)|2014/06/23 22:12:53|2|
17
+ |11|[RuboCop Style/ClassLength](http://qiita.com/tbpgr/items/44087a9f4c6548043ace)|2014/06/24 20:28:50|2|
18
+ |12|[RuboCop Style/CollectionMethods PreferredMethods](http://qiita.com/tbpgr/items/a982166bbd473fcd4e6e)|2014/06/26 00:06:37|1|
19
+ |13|[RuboCop Style/CommentAnnotation](http://qiita.com/tbpgr/items/5b0cee75305cef801851)|2014/06/26 21:29:33|2|
20
+ |14|[RuboCop Style/CyclomaticComplexity](http://qiita.com/tbpgr/items/693f37d763c6ea5f9e9b)|2014/06/27 21:55:52|2|
21
+ |15|[RuboCop Style/DotPosition](http://qiita.com/tbpgr/items/c53f86c876f73c1aa5a8)|2014/06/28 23:08:32|2|
22
+ |16|[RuboCop Style/EmptyLineBetweenDefs](http://qiita.com/tbpgr/items/2872f2a27430372d43e4)|2014/06/29 19:49:56|2|
23
+ |17|[RuboCop Style/FileName](http://qiita.com/tbpgr/items/97fc9186e59d607b1ecf)|2014/06/30 21:56:25|1|
24
+ |18|[RuboCopの警告をコメントで無効化する方法](http://qiita.com/tbpgr/items/a9000c5c6fa92a46c206)|2014/06/08 21:27:21|6|
25
+
@@ -135,12 +135,12 @@ describe QiitaMatome::Display::Displayer do
135
135
 
136
136
  context :table_header do
137
137
  TABLE_HEADER_ARTICLE = QiitaMatome::Article.new(
138
- 'user' => { 'id' => 99_999, 'url_name' => 'tbpgr', 'profile_image_url' => '' },
138
+ 'user' => { 'permanent_id' => 99_999, 'id' => 'tbpgr', 'profile_image_url' => '' },
139
139
  'title' => 'title1',
140
140
  'created_at' => '2014-06-18 22:37:54 +0900',
141
141
  'updated_at' => '2014-06-26 02:25:11 +0900',
142
142
  'tags' => [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
143
- 'stock_count' => 2
143
+ 'likes_count' => 2
144
144
  )
145
145
 
146
146
  cases = [
@@ -158,9 +158,9 @@ describe QiitaMatome::Display::Displayer do
158
158
  case_no: 2,
159
159
  case_title: 'full display args',
160
160
  articles: [TABLE_HEADER_ARTICLE, QiitaMatome::Article.new],
161
- display_columns: [:no, :title, :created_at, :stock_count],
161
+ display_columns: [:no, :title, :created_at, :likes_count],
162
162
  expected: <<-EOS
163
- |No.|タイトル|作成日|ストック数|
163
+ |No.|タイトル|作成日|いいね数|
164
164
  |--:|:--|:--:|--:|
165
165
  EOS
166
166
  }
@@ -196,13 +196,13 @@ describe QiitaMatome::Display::Displayer do
196
196
 
197
197
  context :display_article do
198
198
  DISPLAY_ARTICLE = QiitaMatome::Article.new(
199
- 'uuid' => 'd1ed617093609ccedbee',
200
- 'user' => { 'id' => 99_999, 'url_name' => 'tbpgr', 'profile_image_url' => '' },
199
+ 'id' => 'd1ed617093609ccedbee',
200
+ 'user' => { 'permanent_id' => 99_999, 'id' => 'tbpgr', 'profile_image_url' => '' },
201
201
  'title' => 'title1',
202
202
  'created_at' => '2014-06-18 22:37:54 +0900',
203
203
  'updated_at' => '2014-06-26 02:25:11 +0900',
204
204
  'tags' => [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
205
- 'stock_count' => 2
205
+ 'likes_count' => 2
206
206
  )
207
207
 
208
208
  cases = [
@@ -221,7 +221,7 @@ describe QiitaMatome::Display::Displayer do
221
221
  articles: [DISPLAY_ARTICLE, QiitaMatome::Article.new],
222
222
  article: DISPLAY_ARTICLE,
223
223
  no: 1,
224
- display_columns: [:no, :title, :created_at, :stock_count],
224
+ display_columns: [:no, :title, :created_at, :likes_count],
225
225
  expected: '|1|[title1](http://qiita.com/tbpgr/items/d1ed617093609ccedbee)|2014/06/18 22:37:54|2|'
226
226
  }
227
227
  ]
@@ -257,31 +257,31 @@ describe QiitaMatome::Display::Displayer do
257
257
  context :display_articles do
258
258
  DISPLAY_ARTICLES = [
259
259
  QiitaMatome::Article.new(
260
- 'uuid' => 'd1ed617093609ccedbee',
261
- 'user' => { 'id' => 99_999, 'url_name' => 'tbpgr', 'profile_image_url' => '' },
260
+ 'id' => 'd1ed617093609ccedbee',
261
+ 'user' => { 'permanent_id' => 99_999, 'id' => 'tbpgr', 'profile_image_url' => '' },
262
262
  'title' => 'title1',
263
263
  'created_at' => '2014-06-18 22:37:54 +0900',
264
264
  'updated_at' => '2014-06-26 02:25:11 +0900',
265
265
  'tags' => [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
266
- 'stock_count' => 2
266
+ 'likes_count' => 2
267
267
  ),
268
268
  QiitaMatome::Article.new(
269
- 'uuid' => 'd1ed617093609ccedbef',
270
- 'user' => { 'id' => 99_999, 'url_name' => 'tbpgr', 'profile_image_url' => '' },
269
+ 'id' => 'd1ed617093609ccedbef',
270
+ 'user' => { 'permanent_id' => 99_999, 'id' => 'tbpgr', 'profile_image_url' => '' },
271
271
  'title' => 'title2',
272
272
  'created_at' => '2014-06-18 22:37:53 +0900',
273
273
  'updated_at' => '2014-06-26 02:25:09 +0900',
274
274
  'tags' => [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
275
- 'stock_count' => 3
275
+ 'likes_count' => 3
276
276
  ),
277
277
  QiitaMatome::Article.new(
278
- 'uuid' => 'd1ed617093609ccedbeg',
279
- 'user' => { 'id' => 99_999, 'url_name' => 'tbpgr', 'profile_image_url' => '' },
278
+ 'id' => 'd1ed617093609ccedbeg',
279
+ 'user' => { 'permanent_id' => 99_999, 'id' => 'tbpgr', 'profile_image_url' => '' },
280
280
  'title' => 'title3',
281
281
  'created_at' => '2014-06-18 22:37:52 +0900',
282
282
  'updated_at' => '2014-06-26 02:25:10 +0900',
283
283
  'tags' => [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
284
- 'stock_count' => 10
284
+ 'likes_count' => 10
285
285
  )
286
286
  ]
287
287
 
@@ -301,7 +301,7 @@ describe QiitaMatome::Display::Displayer do
301
301
  case_no: 2,
302
302
  case_title: 'full display args',
303
303
  articles: DISPLAY_ARTICLES,
304
- display_columns: [:no, :title, :created_at, :updated_at, :stock_count],
304
+ display_columns: [:no, :title, :created_at, :updated_at, :likes_count],
305
305
  expected: <<-EOS
306
306
  |1|[title1](http://qiita.com/tbpgr/items/d1ed617093609ccedbee)|2014/06/18 22:37:54|2014/06/26 02:25:11|2|
307
307
  |2|[title2](http://qiita.com/tbpgr/items/d1ed617093609ccedbef)|2014/06/18 22:37:53|2014/06/26 02:25:09|3|
@@ -93,8 +93,8 @@ describe QiitaMatome::Article do
93
93
  case_title: '2 list case',
94
94
  init: {
95
95
  'title' => 'title | subtitle',
96
- 'uuid' => '123',
97
- 'user' => { 'url_name' => 'tbpgr' }
96
+ 'id' => '123',
97
+ 'user' => { 'id' => 'tbpgr' }
98
98
  },
99
99
  expected: '[title subtitle](http://qiita.com/tbpgr/items/123)'
100
100
  }
@@ -240,34 +240,34 @@ describe QiitaMatome::Articles do
240
240
  cases = [
241
241
  {
242
242
  case_no: 1,
243
- case_title: 'exclude uuid case',
243
+ case_title: 'exclude id case',
244
244
  init: [
245
- QiitaMatome::Article.new('title' => 'title1', 'uuid' => '1'),
246
- QiitaMatome::Article.new('title' => 'title2', 'uuid' => '2'),
247
- QiitaMatome::Article.new('title' => 'title3', 'uuid' => '3'),
248
- QiitaMatome::Article.new('title' => 'title4', 'uuid' => '4')
245
+ QiitaMatome::Article.new('title' => 'title1', 'id' => '1'),
246
+ QiitaMatome::Article.new('title' => 'title2', 'id' => '2'),
247
+ QiitaMatome::Article.new('title' => 'title3', 'id' => '3'),
248
+ QiitaMatome::Article.new('title' => 'title4', 'id' => '4')
249
249
  ],
250
250
  uuids: %w(2 3),
251
251
  expected: [
252
- QiitaMatome::Article.new('title' => 'title1', 'uuid' => '1'),
253
- QiitaMatome::Article.new('title' => 'title4', 'uuid' => '4')
252
+ QiitaMatome::Article.new('title' => 'title1', 'id' => '1'),
253
+ QiitaMatome::Article.new('title' => 'title4', 'id' => '4')
254
254
  ]
255
255
  },
256
256
  {
257
257
  case_no: 2,
258
- case_title: 'exclude uuid case(no target)',
258
+ case_title: 'exclude id case(no target)',
259
259
  init: [
260
- QiitaMatome::Article.new('title' => 'title1', 'uuid' => '1'),
261
- QiitaMatome::Article.new('title' => 'title2', 'uuid' => '2'),
262
- QiitaMatome::Article.new('title' => 'title3', 'uuid' => '3'),
263
- QiitaMatome::Article.new('title' => 'title4', 'uuid' => '4')
260
+ QiitaMatome::Article.new('title' => 'title1', 'id' => '1'),
261
+ QiitaMatome::Article.new('title' => 'title2', 'id' => '2'),
262
+ QiitaMatome::Article.new('title' => 'title3', 'id' => '3'),
263
+ QiitaMatome::Article.new('title' => 'title4', 'id' => '4')
264
264
  ],
265
265
  uuids: ['5'],
266
266
  expected: [
267
- QiitaMatome::Article.new('title' => 'title1', 'uuid' => '1'),
268
- QiitaMatome::Article.new('title' => 'title2', 'uuid' => '2'),
269
- QiitaMatome::Article.new('title' => 'title3', 'uuid' => '3'),
270
- QiitaMatome::Article.new('title' => 'title4', 'uuid' => '4')
267
+ QiitaMatome::Article.new('title' => 'title1', 'id' => '1'),
268
+ QiitaMatome::Article.new('title' => 'title2', 'id' => '2'),
269
+ QiitaMatome::Article.new('title' => 'title3', 'id' => '3'),
270
+ QiitaMatome::Article.new('title' => 'title4', 'id' => '4')
271
271
  ]
272
272
  }
273
273
  ]
@@ -0,0 +1,62 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+ require 'qiita_json_loader'
4
+ require 'json'
5
+ require 'open-uri'
6
+ require 'openssl'
7
+ require 'models/article'
8
+ require 'models/articles'
9
+
10
+ describe QiitaMatome::QiitaJsonLoader do
11
+ context :load do
12
+ cases = [
13
+ {
14
+ case_no: 1,
15
+ case_title: 'valid case',
16
+ user: 'user',
17
+ expected: 200
18
+ }
19
+ ]
20
+
21
+ # Dummy
22
+ class Dummy
23
+ def read
24
+ <<-EOS
25
+ [
26
+ {"uuid":"a655ad5e017d28f8982e"},
27
+ {"uuid":"a655ad5e017d28f8982f"}
28
+ ]
29
+ EOS
30
+ end
31
+ end
32
+
33
+ cases.each do |c|
34
+ it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
35
+ begin
36
+ case_before c
37
+
38
+ # -- given --
39
+ qiita_matome_qiita_json_loader = QiitaMatome::QiitaJsonLoader.new
40
+ qiita_matome_qiita_json_loader.stub(:open).and_return(Dummy.new)
41
+
42
+ # -- when --
43
+ qiita_matome_qiita_json_loader.load(c[:user])
44
+ actual = qiita_matome_qiita_json_loader.articles
45
+
46
+ # -- then --
47
+ expect(actual.articles.size).to eq(c[:expected])
48
+ ensure
49
+ case_after c
50
+ end
51
+ end
52
+
53
+ def case_before(c) # rubocop:disable UnusedMethodArgument
54
+ # implement each case before
55
+ end
56
+
57
+ def case_after(c) # rubocop:disable UnusedMethodArgument
58
+ # implement each case after
59
+ end
60
+ end
61
+ end
62
+ end
@@ -1,15 +1,110 @@
1
1
  # encoding: utf-8
2
2
  require 'spec_helper'
3
3
  require 'qiita_matome_core'
4
+ require 'qiita_json_loader'
5
+ require 'models/article'
6
+ require 'models/articles'
7
+ require 'timecop'
4
8
 
5
9
  # rubocop:disable LineLength, UnusedMethodArgument, UselessAssignment
6
10
  describe QiitaMatome::Core do
7
- context :execute do
11
+ context :init do
8
12
  cases = [
9
13
  {
10
14
  case_no: 1,
11
- case_title: 'case_title',
12
- expected: 'expected'
15
+ case_title: 'output template',
16
+ expected: QiitaMatome::Core::QIITA_MATOME_TEMPLATE
17
+ }
18
+ ]
19
+
20
+ cases.each do |c|
21
+ it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
22
+ begin
23
+ case_before c
24
+
25
+ # -- given --
26
+ core = QiitaMatome::Core.new
27
+
28
+ # -- when --
29
+ core.init
30
+
31
+ # -- then --
32
+ actual = File.open(QiitaMatome::Core::QIITA_MATOME_FILE) { |f|f.read }
33
+ expect(actual).to eq(c[:expected])
34
+ ensure
35
+ case_after c
36
+ end
37
+ end
38
+
39
+ def case_before(c)
40
+ # implement each case before
41
+ end
42
+
43
+ def case_after(c)
44
+ return unless File.exist? QiitaMatome::Core::QIITA_MATOME_FILE
45
+ File.delete(QiitaMatome::Core::QIITA_MATOME_FILE)
46
+ end
47
+ end
48
+ end
49
+
50
+ context :matome do
51
+ TMP_DIR = 'tmp'
52
+ TEMPLATE = <<-EOS
53
+ # encoding: utf-8
54
+ user "tbpgr"
55
+ tag "Ruby"
56
+ title "some title"
57
+ output_file "output.md"
58
+ sort_type "created_at_desc"
59
+ display_columns [:no, :title, :created_at, :likes_count]
60
+ excludes []
61
+ EOS
62
+
63
+ MOCK_ARTICLES = QiitaMatome::Articles.new([
64
+ QiitaMatome::Article.new(
65
+ 'user' => { 'permanent_id' => 99_999, 'id' => 'tbpgr', 'profile_image_url' => '' },
66
+ 'title' => 'title1',
67
+ 'created_at' => '2014-06-18 22:37:54 +0900',
68
+ 'updated_at' => '2014-06-26 02:25:11 +0900',
69
+ 'tags' => [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
70
+ 'likes_count' => 1
71
+ ),
72
+ QiitaMatome::Article.new(
73
+ 'user' => { 'permanent_id' => 99_999, 'id' => 'tbpgr', 'profile_image_url' => '' },
74
+ 'title' => 'title2',
75
+ 'created_at' => '2014-06-18 22:37:54 +0900',
76
+ 'updated_at' => '2014-06-26 02:25:11 +0900',
77
+ 'tags' => [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
78
+ 'likes_count' => 2
79
+ ),
80
+ QiitaMatome::Article.new(
81
+ 'user' => { 'permanent_id' => 99_999, 'id' => 'tbpgr', 'profile_image_url' => '' },
82
+ 'title' => 'title3',
83
+ 'created_at' => '2014-06-18 22:37:54 +0900',
84
+ 'updated_at' => '2014-06-26 02:25:11 +0900',
85
+ 'tags' => [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
86
+ 'likes_count' => 3
87
+ )
88
+ ])
89
+
90
+ cases = [
91
+ {
92
+ case_no: 1,
93
+ case_title: 'valid case',
94
+ define_src: TEMPLATE,
95
+ output: 'output.md',
96
+ expected: <<-EOS
97
+ # some title
98
+
99
+ 更新日: 2014/04/01 00:00:00
100
+
101
+ |No.|タイトル|作成日|いいね数|
102
+ |--:|:--|:--:|--:|
103
+ |1|[title3](http://qiita.com/tbpgr/items/)|2014/06/18 22:37:54|3|
104
+ |2|[title2](http://qiita.com/tbpgr/items/)|2014/06/18 22:37:54|2|
105
+ |3|[title1](http://qiita.com/tbpgr/items/)|2014/06/18 22:37:54|1|
106
+
107
+ EOS
13
108
  }
14
109
  ]
15
110
 
@@ -20,14 +115,16 @@ describe QiitaMatome::Core do
20
115
 
21
116
  # -- given --
22
117
  qiita_matome_core = QiitaMatome::Core.new
118
+ QiitaMatome::QiitaJsonLoader.any_instance.stub(:load).and_return(nil)
119
+ QiitaMatome::QiitaJsonLoader.any_instance.stub(:articles).and_return(MOCK_ARTICLES)
120
+ Timecop.freeze(Time.local(2014, 4, 1))
23
121
 
24
122
  # -- when --
25
- # TODO: implement execute code
26
- # actual = qiita_matome_core.execute
123
+ qiita_matome_core.matome
124
+ actual = File.open(c[:output], 'r:UTF-8') { |f|f.read }
27
125
 
28
126
  # -- then --
29
- # TODO: implement assertion code
30
- # expect(actual).to eq(c[:expected])
127
+ expect(actual).to eq(c[:expected])
31
128
  ensure
32
129
  case_after c
33
130
  end
@@ -35,10 +132,15 @@ describe QiitaMatome::Core do
35
132
 
36
133
  def case_before(c)
37
134
  # implement each case before
135
+ Dir.mkdir(TMP_DIR) unless Dir.exist? TMP_DIR
136
+ Dir.chdir(TMP_DIR)
137
+ File.open(QiitaMatome::Core::QIITA_MATOME_FILE, 'w') { |f|f.puts c[:define_src] }
38
138
  end
39
139
 
40
140
  def case_after(c)
41
141
  # implement each case after
142
+ Dir.chdir('../')
143
+ FileUtils.rm_rf(TMP_DIR) if Dir.exist? TMP_DIR
42
144
  end
43
145
  end
44
146
  end
@@ -80,7 +80,7 @@ describe QiitaMatome::Sort::Sorter do
80
80
  created_at: '2014-06-18 22:37:54 +0900',
81
81
  updated_at: '2014-06-26 02:25:11 +0900',
82
82
  tags: [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
83
- stock_count: 2
83
+ likes_count: 2
84
84
  ),
85
85
  QiitaMatome::Article.new(
86
86
  user: { 'id' => 99_999, 'url_name' => 'tbpgr', 'profile_image_url' => '' },
@@ -88,7 +88,7 @@ describe QiitaMatome::Sort::Sorter do
88
88
  created_at: '2014-06-18 22:37:53 +0900',
89
89
  updated_at: '2014-06-26 02:25:09 +0900',
90
90
  tags: [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
91
- stock_count: 3
91
+ likes_count: 3
92
92
  ),
93
93
  QiitaMatome::Article.new(
94
94
  user: { 'id' => 99_999, 'url_name' => 'tbpgr', 'profile_image_url' => '' },
@@ -96,7 +96,7 @@ describe QiitaMatome::Sort::Sorter do
96
96
  created_at: '2014-06-18 22:37:52 +0900',
97
97
  updated_at: '2014-06-26 02:25:10 +0900',
98
98
  tags: [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
99
- stock_count: 10
99
+ likes_count: 10
100
100
  )
101
101
  ]
102
102
  cases = [
@@ -112,7 +112,7 @@ describe QiitaMatome::Sort::Sorter do
112
112
  created_at: '2014-06-18 22:37:52 +0900',
113
113
  updated_at: '2014-06-26 02:25:10 +0900',
114
114
  tags: [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
115
- stock_count: 10
115
+ likes_count: 10
116
116
  ),
117
117
  QiitaMatome::Article.new(
118
118
  user: { 'id' => 99_999, 'url_name' => 'tbpgr', 'profile_image_url' => '' },
@@ -120,7 +120,7 @@ describe QiitaMatome::Sort::Sorter do
120
120
  created_at: '2014-06-18 22:37:53 +0900',
121
121
  updated_at: '2014-06-26 02:25:09 +0900',
122
122
  tags: [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
123
- stock_count: 3
123
+ likes_count: 3
124
124
  ),
125
125
  QiitaMatome::Article.new(
126
126
  user: { 'id' => 99_999, 'url_name' => 'tbpgr', 'profile_image_url' => '' },
@@ -128,7 +128,7 @@ describe QiitaMatome::Sort::Sorter do
128
128
  created_at: '2014-06-18 22:37:54 +0900',
129
129
  updated_at: '2014-06-26 02:25:11 +0900',
130
130
  tags: [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
131
- stock_count: 2
131
+ likes_count: 2
132
132
  )
133
133
  ]
134
134
  },
@@ -144,7 +144,7 @@ describe QiitaMatome::Sort::Sorter do
144
144
  created_at: '2014-06-18 22:37:54 +0900',
145
145
  updated_at: '2014-06-26 02:25:11 +0900',
146
146
  tags: [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
147
- stock_count: 2
147
+ likes_count: 2
148
148
  ),
149
149
  QiitaMatome::Article.new(
150
150
  user: { 'id' => 99_999, 'url_name' => 'tbpgr', 'profile_image_url' => '' },
@@ -152,7 +152,7 @@ describe QiitaMatome::Sort::Sorter do
152
152
  created_at: '2014-06-18 22:37:53 +0900',
153
153
  updated_at: '2014-06-26 02:25:09 +0900',
154
154
  tags: [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
155
- stock_count: 3
155
+ likes_count: 3
156
156
  ),
157
157
  QiitaMatome::Article.new(
158
158
  user: { 'id' => 99_999, 'url_name' => 'tbpgr', 'profile_image_url' => '' },
@@ -160,7 +160,7 @@ describe QiitaMatome::Sort::Sorter do
160
160
  created_at: '2014-06-18 22:37:52 +0900',
161
161
  updated_at: '2014-06-26 02:25:10 +0900',
162
162
  tags: [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
163
- stock_count: 10
163
+ likes_count: 10
164
164
  )
165
165
  ]
166
166
  },
@@ -176,7 +176,7 @@ describe QiitaMatome::Sort::Sorter do
176
176
  created_at: '2014-06-18 22:37:53 +0900',
177
177
  updated_at: '2014-06-26 02:25:09 +0900',
178
178
  tags: [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
179
- stock_count: 3
179
+ likes_count: 3
180
180
  ),
181
181
  QiitaMatome::Article.new(
182
182
  user: { 'id' => 99_999, 'url_name' => 'tbpgr', 'profile_image_url' => '' },
@@ -184,7 +184,7 @@ describe QiitaMatome::Sort::Sorter do
184
184
  created_at: '2014-06-18 22:37:52 +0900',
185
185
  updated_at: '2014-06-26 02:25:10 +0900',
186
186
  tags: [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
187
- stock_count: 10
187
+ likes_count: 10
188
188
  ),
189
189
  QiitaMatome::Article.new(
190
190
  user: { 'id' => 99_999, 'url_name' => 'tbpgr', 'profile_image_url' => '' },
@@ -192,7 +192,7 @@ describe QiitaMatome::Sort::Sorter do
192
192
  created_at: '2014-06-18 22:37:54 +0900',
193
193
  updated_at: '2014-06-26 02:25:11 +0900',
194
194
  tags: [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
195
- stock_count: 2
195
+ likes_count: 2
196
196
  )
197
197
  ]
198
198
  },
@@ -208,7 +208,7 @@ describe QiitaMatome::Sort::Sorter do
208
208
  created_at: '2014-06-18 22:37:54 +0900',
209
209
  updated_at: '2014-06-26 02:25:11 +0900',
210
210
  tags: [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
211
- stock_count: 2
211
+ likes_count: 2
212
212
  ),
213
213
  QiitaMatome::Article.new(
214
214
  user: { 'id' => 99_999, 'url_name' => 'tbpgr', 'profile_image_url' => '' },
@@ -216,7 +216,7 @@ describe QiitaMatome::Sort::Sorter do
216
216
  created_at: '2014-06-18 22:37:52 +0900',
217
217
  updated_at: '2014-06-26 02:25:10 +0900',
218
218
  tags: [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
219
- stock_count: 10
219
+ likes_count: 10
220
220
  ),
221
221
  QiitaMatome::Article.new(
222
222
  user: { 'id' => 99_999, 'url_name' => 'tbpgr', 'profile_image_url' => '' },
@@ -224,7 +224,7 @@ describe QiitaMatome::Sort::Sorter do
224
224
  created_at: '2014-06-18 22:37:53 +0900',
225
225
  updated_at: '2014-06-26 02:25:09 +0900',
226
226
  tags: [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
227
- stock_count: 3
227
+ likes_count: 3
228
228
  )
229
229
  ]
230
230
  },
@@ -240,7 +240,7 @@ describe QiitaMatome::Sort::Sorter do
240
240
  created_at: '2014-06-18 22:37:54 +0900',
241
241
  updated_at: '2014-06-26 02:25:11 +0900',
242
242
  tags: [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
243
- stock_count: 2
243
+ likes_count: 2
244
244
  ),
245
245
  QiitaMatome::Article.new(
246
246
  user: { 'id' => 99_999, 'url_name' => 'tbpgr', 'profile_image_url' => '' },
@@ -248,7 +248,7 @@ describe QiitaMatome::Sort::Sorter do
248
248
  created_at: '2014-06-18 22:37:53 +0900',
249
249
  updated_at: '2014-06-26 02:25:09 +0900',
250
250
  tags: [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
251
- stock_count: 3
251
+ likes_count: 3
252
252
  ),
253
253
  QiitaMatome::Article.new(
254
254
  user: { 'id' => 99_999, 'url_name' => 'tbpgr', 'profile_image_url' => '' },
@@ -256,7 +256,7 @@ describe QiitaMatome::Sort::Sorter do
256
256
  created_at: '2014-06-18 22:37:52 +0900',
257
257
  updated_at: '2014-06-26 02:25:10 +0900',
258
258
  tags: [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
259
- stock_count: 10
259
+ likes_count: 10
260
260
  )
261
261
  ]
262
262
  },
@@ -272,7 +272,7 @@ describe QiitaMatome::Sort::Sorter do
272
272
  created_at: '2014-06-18 22:37:52 +0900',
273
273
  updated_at: '2014-06-26 02:25:10 +0900',
274
274
  tags: [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
275
- stock_count: 10
275
+ likes_count: 10
276
276
  ),
277
277
  QiitaMatome::Article.new(
278
278
  user: { 'id' => 99_999, 'url_name' => 'tbpgr', 'profile_image_url' => '' },
@@ -280,7 +280,7 @@ describe QiitaMatome::Sort::Sorter do
280
280
  created_at: '2014-06-18 22:37:53 +0900',
281
281
  updated_at: '2014-06-26 02:25:09 +0900',
282
282
  tags: [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
283
- stock_count: 3
283
+ likes_count: 3
284
284
  ),
285
285
  QiitaMatome::Article.new(
286
286
  user: { 'id' => 99_999, 'url_name' => 'tbpgr', 'profile_image_url' => '' },
@@ -288,15 +288,15 @@ describe QiitaMatome::Sort::Sorter do
288
288
  created_at: '2014-06-18 22:37:54 +0900',
289
289
  updated_at: '2014-06-26 02:25:11 +0900',
290
290
  tags: [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
291
- stock_count: 2
291
+ likes_count: 2
292
292
  )
293
293
  ]
294
294
  },
295
295
  {
296
296
  case_no: 7,
297
- case_title: 'stock_count asc',
297
+ case_title: 'likes_count asc',
298
298
  articles: ARTICLES,
299
- sort_type: QiitaMatome::Sort::Consts::STOCK_COUNT_ASC,
299
+ sort_type: QiitaMatome::Sort::Consts::LIKES_COUNT_ASC,
300
300
  expected: [
301
301
  QiitaMatome::Article.new(
302
302
  user: { 'id' => 99_999, 'url_name' => 'tbpgr', 'profile_image_url' => '' },
@@ -304,7 +304,7 @@ describe QiitaMatome::Sort::Sorter do
304
304
  created_at: '2014-06-18 22:37:54 +0900',
305
305
  updated_at: '2014-06-26 02:25:11 +0900',
306
306
  tags: [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
307
- stock_count: 2
307
+ likes_count: 2
308
308
  ),
309
309
  QiitaMatome::Article.new(
310
310
  user: { 'id' => 99_999, 'url_name' => 'tbpgr', 'profile_image_url' => '' },
@@ -312,7 +312,7 @@ describe QiitaMatome::Sort::Sorter do
312
312
  created_at: '2014-06-18 22:37:53 +0900',
313
313
  updated_at: '2014-06-26 02:25:09 +0900',
314
314
  tags: [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
315
- stock_count: 3
315
+ likes_count: 3
316
316
  ),
317
317
  QiitaMatome::Article.new(
318
318
  user: { 'id' => 99_999, 'url_name' => 'tbpgr', 'profile_image_url' => '' },
@@ -320,15 +320,15 @@ describe QiitaMatome::Sort::Sorter do
320
320
  created_at: '2014-06-18 22:37:52 +0900',
321
321
  updated_at: '2014-06-26 02:25:10 +0900',
322
322
  tags: [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
323
- stock_count: 10
323
+ likes_count: 10
324
324
  )
325
325
  ]
326
326
  },
327
327
  {
328
328
  case_no: 8,
329
- case_title: 'stock_count desc',
329
+ case_title: 'likes_count desc',
330
330
  articles: ARTICLES,
331
- sort_type: QiitaMatome::Sort::Consts::STOCK_COUNT_DESC,
331
+ sort_type: QiitaMatome::Sort::Consts::LIKES_COUNT_DESC,
332
332
  expected: [
333
333
  QiitaMatome::Article.new(
334
334
  user: { 'id' => 99_999, 'url_name' => 'tbpgr', 'profile_image_url' => '' },
@@ -336,7 +336,7 @@ describe QiitaMatome::Sort::Sorter do
336
336
  created_at: '2014-06-18 22:37:52 +0900',
337
337
  updated_at: '2014-06-26 02:25:10 +0900',
338
338
  tags: [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
339
- stock_count: 10
339
+ likes_count: 10
340
340
  ),
341
341
  QiitaMatome::Article.new(
342
342
  user: { 'id' => 99_999, 'url_name' => 'tbpgr', 'profile_image_url' => '' },
@@ -344,7 +344,7 @@ describe QiitaMatome::Sort::Sorter do
344
344
  created_at: '2014-06-18 22:37:53 +0900',
345
345
  updated_at: '2014-06-26 02:25:09 +0900',
346
346
  tags: [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
347
- stock_count: 3
347
+ likes_count: 3
348
348
  ),
349
349
  QiitaMatome::Article.new(
350
350
  user: { 'id' => 99_999, 'url_name' => 'tbpgr', 'profile_image_url' => '' },
@@ -352,7 +352,7 @@ describe QiitaMatome::Sort::Sorter do
352
352
  created_at: '2014-06-18 22:37:54 +0900',
353
353
  updated_at: '2014-06-26 02:25:11 +0900',
354
354
  tags: [{ 'name' => 'Ruby', 'url_name' => 'ruby', 'icon_url' => '', 'versions' => [] }],
355
- stock_count: 2
355
+ likes_count: 2
356
356
  )
357
357
  ]
358
358
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qiita_matome
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - tbpgr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-02 00:00:00.000000000 Z
11
+ date: 2017-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -112,6 +112,20 @@ dependencies:
112
112
  - - ~>
113
113
  - !ruby/object:Gem::Version
114
114
  version: '0'
115
+ - !ruby/object:Gem::Dependency
116
+ name: timecop
117
+ requirement: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ~>
120
+ - !ruby/object:Gem::Version
121
+ version: 0.7.1
122
+ type: :development
123
+ prerelease: false
124
+ version_requirements: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ~>
127
+ - !ruby/object:Gem::Version
128
+ version: 0.7.1
115
129
  description: Qiita article matome generator
116
130
  email:
117
131
  - tbpgr@tbpgr.jp
@@ -157,6 +171,7 @@ files:
157
171
  - spec/file_writer_spec.rb
158
172
  - spec/models/article_spec.rb
159
173
  - spec/models/articles_spec.rb
174
+ - spec/qiita_json_loader_spec.rb
160
175
  - spec/qiita_matome_core_spec.rb
161
176
  - spec/sort/sorter_spec.rb
162
177
  - spec/spec_helper.rb
@@ -193,6 +208,7 @@ test_files:
193
208
  - spec/file_writer_spec.rb
194
209
  - spec/models/article_spec.rb
195
210
  - spec/models/articles_spec.rb
211
+ - spec/qiita_json_loader_spec.rb
196
212
  - spec/qiita_matome_core_spec.rb
197
213
  - spec/sort/sorter_spec.rb
198
214
  - spec/spec_helper.rb
@@ -200,3 +216,4 @@ test_files:
200
216
  - spec/validators/articles_validator_spec.rb
201
217
  - spec/validators/display_columns_validator_spec.rb
202
218
  - spec/validators/sort_type_validator_spec.rb
219
+ has_rdoc: