kaminari 0.14.0 → 0.14.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of kaminari might be problematic. Click here for more details.

@@ -3,11 +3,15 @@ script: "bundle exec rake spec"
3
3
  rvm:
4
4
  - 1.8.7
5
5
  - 1.9.3
6
- - ruby-head
7
6
 
8
7
  gemfile:
9
8
  - gemfiles/active_record_32.gemfile
10
9
  - gemfiles/data_mapper_12.gemfile
11
10
  - gemfiles/mongo_mapper.gemfile
12
- - gemfiles/mongoid_24.gemfile
11
+ - gemfiles/mongoid_30.gemfile
13
12
  - gemfiles/sinatra.gemfile
13
+
14
+ matrix:
15
+ exclude:
16
+ - rvm: 1.8.7
17
+ gemfile: gemfiles/mongoid_30.gemfile
data/CHANGELOG CHANGED
@@ -1,3 +1,11 @@
1
+ == 0.14.1
2
+
3
+ * Changed the default "truncation" String from "..." to … #264 [pjaspers]
4
+
5
+ * The theme generator is Github API v3 compatible now! #279 [eitoball]
6
+
7
+ * Made Kaminari.config.default_per_page changeable again #280 [yuki24]
8
+
1
9
  == 0.14.0
2
10
 
3
11
  * Grape framework support! #218 [mrplum]
@@ -7,7 +7,7 @@ en:
7
7
  last: "Last »"
8
8
  previous: "‹ Prev"
9
9
  next: "Next ›"
10
- truncate: "..."
10
+ truncate: "…"
11
11
  helpers:
12
12
  page_entries_info:
13
13
  one_page:
@@ -1,7 +1,5 @@
1
1
  module Kaminari
2
2
  module Generators
3
- SHOW_API = 'http://github.com/api/v2/json/blob/show/amatsuda/kaminari_themes'
4
- ALL_API = 'http://github.com/api/v2/json/blob/all/amatsuda/kaminari_themes/master'
5
3
 
6
4
  class ViewsGenerator < Rails::Generators::NamedBase
7
5
  source_root File.expand_path('../../../../app/views/kaminari', __FILE__)
@@ -37,13 +35,8 @@ BANNER
37
35
  private
38
36
  def self.themes
39
37
  begin
40
- @themes ||= open ALL_API do |json|
41
- # @themes ||= open(File.join(File.dirname(__FILE__), '../../../spec/generators/sample.json')) do |json|
42
- files = ActiveSupport::JSON.decode(json)['blobs']
43
- hash = files.group_by {|fn, _| fn[0...(fn.index('/') || 0)]}.delete_if {|fn, _| fn.blank?}
44
- hash.map do |name, files|
45
- Theme.new name, files
46
- end
38
+ @themes ||= GitHubApiHelper.get_files_in_master.group_by {|fn, _| fn[0...(fn.index('/') || 0)]}.delete_if {|fn, _| fn.blank?}.map do |name, files|
39
+ Theme.new name, files
47
40
  end
48
41
  rescue SocketError
49
42
  []
@@ -53,7 +46,7 @@ BANNER
53
46
  def download_templates(theme)
54
47
  theme.templates_for(template_engine).each do |template|
55
48
  say " downloading #{template.name} from kaminari_themes..."
56
- get "#{SHOW_API}/#{template.sha}", template.name
49
+ create_file template.name, GitHubApiHelper.get_content_for("#{theme.name}/#{template.name}")
57
50
  end
58
51
  end
59
52
 
@@ -92,12 +85,34 @@ BANNER
92
85
  def description #:nodoc:
93
86
  file = @templates.detect(&:description?)
94
87
  return "#{' ' * 12}#{name}" unless file
95
- open("#{SHOW_API}/#{file.sha}").read.chomp.gsub /^/, ' ' * 12
88
+ GitHubApiHelper.get_content_for("#{@name}/#{file.name}").chomp.gsub(/^/, ' ' * 12)
96
89
  end
97
90
 
98
91
  def templates_for(template_engine) #:nodoc:
99
92
  @templates.select {|t| !t.description?}.select {|t| !t.view? || (t.engine == template_engine)}
100
93
  end
101
94
  end
95
+
96
+ module GitHubApiHelper
97
+ def get_files_in_master
98
+ master_tree_sha = open('https://api.github.com/repos/amatsuda/kaminari_themes/git/refs/heads/master') do |json|
99
+ ActiveSupport::JSON.decode(json)['object']['sha']
100
+ end
101
+ open('https://api.github.com/repos/amatsuda/kaminari_themes/git/trees/' + master_tree_sha + '?recursive=1') do |json|
102
+ blobs = ActiveSupport::JSON.decode(json)['tree'].find_all {|i| i['type'] == 'blob' }
103
+ blobs.map do |blob|
104
+ [blob['path'], blob['sha']]
105
+ end
106
+ end
107
+ end
108
+ module_function :get_files_in_master
109
+
110
+ def get_content_for(path)
111
+ open('https://api.github.com/repos/amatsuda/kaminari_themes/contents/' + path) do |json|
112
+ Base64.decode64(ActiveSupport::JSON.decode(json)['content'])
113
+ end
114
+ end
115
+ module_function :get_content_for
116
+ end
102
117
  end
103
118
  end
@@ -27,7 +27,7 @@ module Kaminari
27
27
  # This model's max +per_page+ value
28
28
  # returns +max_per_page+ value unless explicitly overridden via <tt>max_paginates_per</tt>
29
29
  def max_per_page
30
- @_max_per_page ||= Kaminari.config.max_per_page
30
+ @_max_per_page || Kaminari.config.max_per_page
31
31
  end
32
32
  end
33
33
  end
@@ -1,3 +1,3 @@
1
1
  module Kaminari
2
- VERSION = '0.14.0'
2
+ VERSION = '0.14.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kaminari
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.14.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-02 00:00:00.000000000 Z
12
+ date: 2012-09-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -308,7 +308,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
308
308
  version: '0'
309
309
  segments:
310
310
  - 0
311
- hash: 3342355439431297487
311
+ hash: -1633849575199426851
312
312
  required_rubygems_version: !ruby/object:Gem::Requirement
313
313
  none: false
314
314
  requirements:
@@ -317,7 +317,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
317
317
  version: '0'
318
318
  segments:
319
319
  - 0
320
- hash: 3342355439431297487
320
+ hash: -1633849575199426851
321
321
  requirements: []
322
322
  rubyforge_project: kaminari
323
323
  rubygems_version: 1.8.24