apipie-rails 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@
2
2
  Changelog
3
3
  ===========
4
4
 
5
+ v0.2.2
6
+ ------
7
+
8
+ * prevent rspec 3 from being used. It is not compatible.
9
+ [#255](https://github.com/Apipie/apipie-rails/pull/255) [@lsylvester][]
10
+ * fixed extractor root route (handle nil path)
11
+ [#257](https://github.com/Apipie/apipie-rails/pull/257) [@ctria][]
12
+ * reduced rails dependency to development only
13
+ [#266](https://github.com/Apipie/apipie-rails/pull/266) [@klobuczek][]
14
+ * reduced rails dependency to development only
15
+ [#266](https://github.com/Apipie/apipie-rails/pull/266) [@klobuczek][]
16
+ * add more options to apipie:cache to generate only parts of the
17
+ static pages
18
+ [#262](https://github.com/Apipie/apipie-rails/pull/262) [@mbacovsky][]
19
+
5
20
  v0.2.1
6
21
  ------
7
22
 
@@ -156,3 +171,6 @@ v0.0.15
156
171
  [@johanneswuerbach]: https://github.com/johanneswuerbach
157
172
  [@richardsondx]: https://github.com/richardsondx
158
173
  [@alem0lars]: https://github.com/alem0lars
174
+ [@lsylvester]: https://github.com/lsylverster
175
+ [@ctria]: https://github.com/ctria
176
+ [@klobuczek]: https://github.com/klobuczek
data/README.rst CHANGED
@@ -849,7 +849,7 @@ keyword. It specifies the versions the example is used for. When not
849
849
  specified, it's shown in all versions with given method.
850
850
 
851
851
  When referencing or quering the resource/method descripion, this
852
- format should be used: "verson#resource#method". When not specified,
852
+ format should be used: "version#resource#method". When not specified,
853
853
  the default version is used instead.
854
854
 
855
855
 
@@ -979,6 +979,10 @@ When you want to avoid any unnecessary computation in production mode,
979
979
  you can generate a cache with ``rake apipie:cache`` and configure the
980
980
  app to use it in production with ``config.use_cache = Rails.env.production?``
981
981
 
982
+ If, for some complex casese, you need to generate/re-generate just part of the cache
983
+ use ``rake apipie:cache cache_part=index`` resp. ``rake apipie:cache cache_part=resources``
984
+ To generate it to different location for further processing use ``rake apipie:cache OUT=/tmp/apipie_cache``.
985
+
982
986
  ===================
983
987
  JSON checksums
984
988
  ===================
data/apipie-rails.gemspec CHANGED
@@ -16,9 +16,9 @@ Gem::Specification.new do |s|
16
16
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
17
  s.require_paths = ["lib"]
18
18
 
19
- s.add_dependency "rails", ">= 3.0.10"
19
+ s.add_development_dependency "rails", ">= 3.0.10"
20
20
  s.add_dependency 'json'
21
- s.add_development_dependency "rspec-rails"
21
+ s.add_development_dependency "rspec-rails", "~> 2.14.2"
22
22
  s.add_development_dependency "sqlite3"
23
23
  s.add_development_dependency "minitest"
24
24
  s.add_development_dependency "maruku"
@@ -1,5 +1,5 @@
1
1
  <ul class='breadcrumb'>
2
- <li class='active'><a href='<%= @doc[:doc_url] %><%= @doc[:link_extension] %>'><%= @doc[:name] %> <%= @doc[:resources].values.first[:version] %></a></li>
2
+ <li class='active'><a href='<%= @doc[:doc_url] %><%= @doc[:link_extension] %>'><%= @doc[:name] %> <%= @doc[:resources].values.first && @doc[:resources].values.first[:version] %></a></li>
3
3
  <%= render(:partial => "languages", :locals => {:doc_url => @doc[:doc_url]}) %>
4
4
  <% if @versions && @versions.size > 1 %>
5
5
  <li class='pull-right'>
@@ -157,7 +157,7 @@ module Apipie
157
157
  method_key = "#{Apipie.get_resource_name(controller.constantize)}##{action}"
158
158
  old_apis = apis_from_docs[method_key] || []
159
159
  new_apis.each do |new_api|
160
- new_api[:path].sub!(/\(\.:format\)$/,"")
160
+ new_api[:path].sub!(/\(\.:format\)$/,"") if new_api[:path]
161
161
  old_api = old_apis.find do |api|
162
162
  api[:path] == "#{@api_prefix}#{new_api[:path]}"
163
163
  end
@@ -1,3 +1,3 @@
1
1
  module Apipie
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
@@ -51,32 +51,44 @@ namespace :apipie do
51
51
  end
52
52
  end
53
53
 
54
+ # By default the full cache is built.
55
+ # It is possible to generate index resp. resources only with
56
+ # rake apipie:cache cache_part=index (resources resp.)
57
+ # Default output dir ('public/apipie_cache') can be changed with OUT=/some/dir
54
58
  desc "Generate cache to avoid production dependencies on markup languages"
55
59
  task :cache => :environment do
56
60
  puts "#{Time.now} | Started"
61
+ cache_part = ENV['cache_part']
62
+ generate_index = (cache_part == 'resources' ? false : true)
63
+ generate_resources = (cache_part == 'index' ? false : true)
57
64
  with_loaded_documentation do
58
65
  puts "#{Time.now} | Documents loaded..."
59
66
  ([nil] + Apipie.configuration.languages).each do |lang|
60
67
  I18n.locale = lang || Apipie.configuration.default_locale
61
68
  puts "#{Time.now} | Processing docs for #{lang}"
62
- cache_dir = Apipie.configuration.cache_dir
69
+ cache_dir = ENV["OUT"] || Apipie.configuration.cache_dir
63
70
  subdir = Apipie.configuration.doc_base_url.sub(/\A\//,"")
64
-
65
71
  file_base = File.join(cache_dir, Apipie.configuration.doc_base_url)
66
- Apipie.url_prefix = "./#{subdir}"
67
- doc = Apipie.to_json(Apipie.configuration.default_version, nil, nil, lang)
68
- doc[:docs][:link_extension] = (lang ? ".#{lang}.html" : ".html")
69
- generate_index_page(file_base, doc, true, false, lang)
72
+
73
+ if generate_index
74
+ Apipie.url_prefix = "./#{subdir}"
75
+ doc = Apipie.to_json(Apipie.configuration.default_version, nil, nil, lang)
76
+ doc[:docs][:link_extension] = (lang ? ".#{lang}.html" : ".html")
77
+ generate_index_page(file_base, doc, true, false, lang)
78
+ end
70
79
  Apipie.available_versions.each do |version|
71
80
  file_base_version = File.join(file_base, version)
72
81
  Apipie.url_prefix = "../#{subdir}"
73
82
  doc = Apipie.to_json(version, nil, nil, lang)
74
83
  doc[:docs][:link_extension] = (lang ? ".#{lang}.html" : ".html")
75
- generate_index_page(file_base_version, doc, true, true, lang)
76
- Apipie.url_prefix = "../../#{subdir}"
77
- generate_resource_pages(version, file_base_version, doc, true, lang)
78
- Apipie.url_prefix = "../../../#{subdir}"
79
- generate_method_pages(version, file_base_version, doc, true, lang)
84
+
85
+ generate_index_page(file_base_version, doc, true, true, lang) if generate_index
86
+ if generate_resources
87
+ Apipie.url_prefix = "../../#{subdir}"
88
+ generate_resource_pages(version, file_base_version, doc, true, lang)
89
+ Apipie.url_prefix = "../../../#{subdir}"
90
+ generate_method_pages(version, file_base_version, doc, true, lang)
91
+ end
80
92
  end
81
93
  end
82
94
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apipie-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-05-23 00:00:00.000000000 Z
13
+ date: 2014-07-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -20,7 +20,7 @@ dependencies:
20
20
  - - ! '>='
21
21
  - !ruby/object:Gem::Version
22
22
  version: 3.0.10
23
- type: :runtime
23
+ type: :development
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  none: false
@@ -49,17 +49,17 @@ dependencies:
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
- - - ! '>='
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: 2.14.2
55
55
  type: :development
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  none: false
59
59
  requirements:
60
- - - ! '>='
60
+ - - ~>
61
61
  - !ruby/object:Gem::Version
62
- version: '0'
62
+ version: 2.14.2
63
63
  - !ruby/object:Gem::Dependency
64
64
  name: sqlite3
65
65
  requirement: !ruby/object:Gem::Requirement