multiview 0.1.1 → 0.1.2

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: 1e132d129c25fffcfa989a0dba045156cfe3bd6d
4
- data.tar.gz: f959713516300b1a16987e233707fadb0bff4c0f
3
+ metadata.gz: a9c81beca7267f95b2d01112d07991f845bf6986
4
+ data.tar.gz: 11835b806d0724d21b91b3c72f4d6c74b3f749ed
5
5
  SHA512:
6
- metadata.gz: 9a27e21c6b8cba2ebbf3041cb99c2e92aaa56b0f7b24a6086d584172fcd027502e2f6869cb57cec6121be56ae5af4da83fb7f74dd84dcd0df0b34db548818602
7
- data.tar.gz: c909c6820c06a9d87dc820d92e8ea872962becb9cd48aa12a966ecd53976ff0d2b3d47ed35586e34fe2cc3d8e74555898d70e0651d53b97bc2c1ebeacc4248e8
6
+ metadata.gz: 74add043ec97f56b08796d66247bc79e0594a7fd47fc08d4e2759d686249f11dd49cfe0e388892df754200cdbefce4a83e848a8b992dea889051116d0d957066
7
+ data.tar.gz: c1373eb0e59c7780da535a4f3073437ddaa1043bdf564b928d2d5493386b36b79889892b3195998d49ba0a3f1128769c888911ca2bda5044562b967371ec096d
data/.gitignore CHANGED
@@ -14,3 +14,4 @@
14
14
  spec/examples.txt
15
15
 
16
16
  *.swp
17
+ *.gem
data/.travis.yml CHANGED
@@ -1,5 +1,29 @@
1
- sudo: false
1
+ sudo: enable
2
+ dist: trusty
2
3
  language: ruby
4
+
5
+ cache: bundler
6
+
3
7
  rvm:
4
- - 2.2.6
5
- before_install: gem install bundler -v 1.15.1
8
+ - 2.1.10
9
+ - 2.2.7
10
+ - 2.3.4
11
+ - 2.4.1
12
+
13
+ gemfile:
14
+ - gemfiles/rails-4.1
15
+ - gemfiles/rails-4.2
16
+ - gemfiles/rails-5.0
17
+ - gemfiles/rails-5.1
18
+
19
+ matrix:
20
+ exclude:
21
+ - {rvm: '2.1.10', gemfile: 'gemfiles/rails-5.0'}
22
+ - {rvm: '2.1.10', gemfile: 'gemfiles/rails-5.1'}
23
+ - {rvm: '2.4.1', gemfile: 'gemfiles/rails-4.1'}
24
+
25
+ before_install:
26
+ - gem install bundler --no-doc
27
+
28
+ script: bundle exec rspec
29
+
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2017 Jon Xie
3
+ Copyright (c) 2017 Jiangzhi Xie
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Support multiple versions for Rails views
4
4
 
5
+ [![Build Status](https://travis-ci.org/xiejiangzhi/multiview.svg?branch=master)](https://travis-ci.org/xiejiangzhi/multiview)
6
+
5
7
 
6
8
  ## Installation
7
9
 
@@ -18,7 +20,7 @@ And then execute:
18
20
 
19
21
  ## Usage
20
22
 
21
- ### We project
23
+ ### Example Project
22
24
 
23
25
  `app/controllers/topics_controller.rb`
24
26
 
@@ -61,12 +63,13 @@ $multiview = Multiview::Manager.new({
61
63
 
62
64
  ### Redispatch request by filter of controller
63
65
 
64
- When get `/topics`, should redispatch to V2::TopicsController, don't call `TopicsController#index`, if we delete `V2::TopicsController` or change that config `{'topics' => 'v1'}`, it will call `TopicsController`
66
+ When get `/topics`, should redispatch to `V2::TopicsController#index`, rether than `TopicsController#index`
67
+ If delete `V2::TopicsController` or change that config `{'topics' => nil}`, it will call `TopicsController#index`
65
68
 
66
69
  ```
67
70
  class ApplicationController < ActionController::Base
68
71
  before_aciton :set_view_version_filter
69
-
72
+ .
70
73
  def set_view_version_filter
71
74
  $multiview.redispatch(self)
72
75
 
@@ -75,7 +78,7 @@ class ApplicationController < ActionController::Base
75
78
 
76
79
  # if exist V3::XxxController, should to call V3::XxxController
77
80
  # if not, should to call XxxController and prepend v3 views path
78
- # when you just want to change something for views, you should not to redefined a controller for the version
81
+ # when you only want to change something for views, you should not to create V3::XxxController for the version, just to make a view folder `app/views/v3/xxx`
79
82
  # $multiview.redispatch(self, params[:controller], params[:action], 'v3')
80
83
  end
81
84
  end
@@ -126,7 +129,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
126
129
 
127
130
  ## Contributing
128
131
 
129
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/multiview. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
132
+ Bug reports and pull requests are welcome on GitHub at https://github.com/xiejiangzhi/multiview. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
130
133
 
131
134
  ## License
132
135
 
@@ -134,4 +137,4 @@ The gem is available as open source under the terms of the [MIT License](http://
134
137
 
135
138
  ## Code of Conduct
136
139
 
137
- Everyone interacting in the Multiview project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/multiview/blob/master/CODE_OF_CONDUCT.md).
140
+ Everyone interacting in the Multiview project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/xiejiangzhi/multiview/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in influx_orm.gemspec
4
+ gemspec path: '../'
5
+
6
+ gem 'rails', '~> 4.1.0'
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in influx_orm.gemspec
4
+ gemspec path: '../'
5
+
6
+ gem 'rails', '~> 4.2.0'
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in influx_orm.gemspec
4
+ gemspec path: '../'
5
+
6
+ gem 'rails', '~> 5.0.0'
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in influx_orm.gemspec
4
+ gemspec path: '../'
5
+
6
+ gem 'rails', '~> 5.1.0'
@@ -33,7 +33,8 @@ module Multiview
33
33
  version ||= find_version(controller_path)
34
34
  return unless version
35
35
 
36
- if result = dispatch(controller.request.env, controller_path, action_name, version)
36
+ result = try_dispatch(controller.request.env, controller_path, action_name, version)
37
+ if result
37
38
  res = controller.response
38
39
  status, headers, body = result
39
40
  res.status = status
@@ -50,6 +51,7 @@ module Multiview
50
51
  versions_map[path.to_sym]
51
52
  end
52
53
 
54
+
53
55
  private
54
56
 
55
57
  def load_version_view(controller, version)
@@ -57,5 +59,10 @@ module Multiview
57
59
  Rails.logger.warn("[Multiview] Prepend view path app/views/#{version}")
58
60
  controller.prepend_view_path(Rails.root.join("app/views/#{version}"))
59
61
  end
62
+
63
+ def try_dispatch(env, path, action, version)
64
+ return if env['multiview']
65
+ dispatch(env, path, action, version)
66
+ end
60
67
  end
61
68
  end
@@ -1,3 +1,3 @@
1
1
  module Multiview
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multiview
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Xie
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-05 00:00:00.000000000 Z
11
+ date: 2017-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -97,6 +97,10 @@ files:
97
97
  - Rakefile
98
98
  - bin/console
99
99
  - bin/setup
100
+ - gemfiles/rails-4.1
101
+ - gemfiles/rails-4.2
102
+ - gemfiles/rails-5.0
103
+ - gemfiles/rails-5.1
100
104
  - lib/multiview.rb
101
105
  - lib/multiview/manager.rb
102
106
  - lib/multiview/version.rb
@@ -121,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
125
  version: '0'
122
126
  requirements: []
123
127
  rubyforge_project:
124
- rubygems_version: 2.6.11
128
+ rubygems_version: 2.4.5.2
125
129
  signing_key:
126
130
  specification_version: 4
127
131
  summary: Support multiple versions for Rails view.