Skip to content

Commit 9475634

Browse files
committed
Remove to_i. Let commander gem do it jekyll#1004
1 parent 20a837d commit 9475634

File tree

3 files changed

+3
-14
lines changed

3 files changed

+3
-14
lines changed

bin/jekyll

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ command :build do |c|
4848

4949
c.option '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file'
5050
c.option '--future', 'Publishes posts with a future date'
51-
c.option '--limit_posts MAX_POSTS', 'Limits the number of posts to parse and publish'
51+
c.option '--limit_posts MAX_POSTS', Integer, 'Limits the number of posts to parse and publish'
5252
c.option '-w', '--watch', 'Watch for changes and rebuild'
5353
c.option '--lsi', 'Use LSI for improved related posts'
5454
c.option '--drafts', 'Render posts in the _drafts folder'
@@ -66,7 +66,7 @@ command :serve do |c|
6666

6767
c.option '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file'
6868
c.option '--future', 'Publishes posts with a future date'
69-
c.option '--limit_posts MAX_POSTS', 'Limits the number of posts to parse and publish'
69+
c.option '--limit_posts MAX_POSTS', Integer, 'Limits the number of posts to parse and publish'
7070
c.option '-w', '--watch', 'Watch for changes and rebuild'
7171
c.option '--lsi', 'Use LSI for improved related posts'
7272
c.option '--drafts', 'Render posts in the _drafts folder'

lib/jekyll/site.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ def initialize(config)
2727
self.include = config['include']
2828
self.future = config['future']
2929
self.show_drafts = config['show_drafts']
30-
# given as String if it is came from CLI option
31-
self.limit_posts = config['limit_posts'].to_i
30+
self.limit_posts = config['limit_posts']
3231
self.keep_files = config['keep_files']
3332

3433
self.reset

test/test_generated_site.rb

-10
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,5 @@ class TestGeneratedSite < Test::Unit::TestCase
6868
@site = Site.new(Jekyll.configuration)
6969
end
7070
end
71-
72-
should "ensure if limit_posts is a String (from CLI option)" do
73-
clear_dest
74-
stub(Jekyll).configuration do
75-
Jekyll::Configuration::DEFAULTS.merge({'limit_posts' => "3"})
76-
end
77-
@site = Site.new(Jekyll.configuration)
78-
79-
assert_equal 3, @site.limit_posts
80-
end
8171
end
8272
end

0 commit comments

Comments
 (0)