versionist 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MzU5YWVkYTQ5ZmExNzYxZTQzODZhYjliNDNiNTgwZTkwMTBjYzlkNg==
5
- data.tar.gz: !binary |-
6
- OTI2Yjc1ODUxY2MyZWNiNThkNjVmMTdjNzkwMTY5Yzc5MWIyNTljNg==
2
+ SHA1:
3
+ metadata.gz: 8c65e59b55907757f334aa9d756ffecf623bff64
4
+ data.tar.gz: 08eda1f342cdf427a82f7445f7da93df562fb406
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- ODQ1ODMyMjA4MmZlNDQyZjhkNjZjZGE1NzNjOGMwNDhhYTI2YWNhZWVlYjIy
10
- NmQ3NmFiMWQ0ZGMzMjEwZjJlYjkzNGVhNjYyY2RkNzUwOGQ5MDAwOGIyMjQ1
11
- YmU0ZTVhMzkyMDI5ZTQxNzJiYTBlM2JmMzc3NGNkNjViMGU4YTY=
12
- data.tar.gz: !binary |-
13
- ZTM0NjA4M2NlMzRmM2ZiNzEwOGJhZTNhNWMxODNmMzFlMDJlZWZlZmQyODEy
14
- MDg0ZTE4ODg5YzllZjk3YTQ3NGI1YWZlZDFiNzFhYTQyN2M2ZWJhNzU1ZWNh
15
- NmQwNWRlYjVjMDhmMjllNWZmMGMxMjE4NmRmODIzMGY5YTg3ZWY=
6
+ metadata.gz: 832d3e240c6a4033a8552681a23731b65992801b316bb6e1b44305a3690252fd69ea49b872fd156207eb743fd53df98920ca963bdba50661b446afeddaea6a5b
7
+ data.tar.gz: 9ab37e812a37b205af78ff3186da4548ed8936e6ef3ff74a479d0c88adfd831ff951b5b4b7f63c278ada8639eb1936decc74fab29180fb100c3d08c7c4726e7e
@@ -56,26 +56,28 @@ module Versionist
56
56
  in_root do
57
57
  case Versionist.configuration.configured_test_framework
58
58
  when :test_unit
59
- if File.exists? "test/functional/#{module_name_for_path(old_module_name)}"
60
- log "Copying all files from test/functional/#{module_name_for_path(old_module_name)} to test/functional/#{module_name_for_path(new_module_name)}"
61
- FileUtils.cp_r "test/functional/#{module_name_for_path(old_module_name)}", "test/functional/#{module_name_for_path(new_module_name)}"
62
- Dir.glob("test/functional/#{module_name_for_path(new_module_name)}/*.rb").each do |f|
59
+ if File.exists? "#{test_path}/#{module_name_for_path(old_module_name)}"
60
+ log "Copying all files from #{test_path}/#{module_name_for_path(old_module_name)} to #{test_path}/#{module_name_for_path(new_module_name)}"
61
+ FileUtils.cp_r "#{test_path}/#{module_name_for_path(old_module_name)}", "#{test_path}/#{module_name_for_path(new_module_name)}"
62
+ Dir.glob("#{test_path}/#{module_name_for_path(new_module_name)}/*.rb").each do |f|
63
63
  text = File.read(f)
64
64
  File.open(f, 'w') {|f| f << text.gsub(/#{old_module_name}/, new_module_name)}
65
65
  end
66
66
  else
67
- say "No controller tests found in test/functional for #{old_version}"
67
+ say "No tests found in #{test_path} for #{old_version}"
68
68
  end
69
69
 
70
- if File.exists? "test/integration/#{module_name_for_path(old_module_name)}"
71
- log "Copying all files from test/integration/#{module_name_for_path(old_module_name)} to test/integration/#{module_name_for_path(new_module_name)}"
72
- FileUtils.cp_r "test/integration/#{module_name_for_path(old_module_name)}", "test/integration/#{module_name_for_path(new_module_name)}"
73
- Dir.glob("test/integration/#{module_name_for_path(new_module_name)}/*.rb").each do |f|
74
- text = File.read(f)
75
- File.open(f, 'w') {|f| f << text.gsub(/#{old_module_name}/, new_module_name)}
70
+ if older_than_rails_5?
71
+ if File.exists? "test/integration/#{module_name_for_path(old_module_name)}"
72
+ log "Copying all files from test/integration/#{module_name_for_path(old_module_name)} to test/integration/#{module_name_for_path(new_module_name)}"
73
+ FileUtils.cp_r "test/integration/#{module_name_for_path(old_module_name)}", "test/integration/#{module_name_for_path(new_module_name)}"
74
+ Dir.glob("test/integration/#{module_name_for_path(new_module_name)}/*.rb").each do |f|
75
+ text = File.read(f)
76
+ File.open(f, 'w') {|f| f << text.gsub(/#{old_module_name}/, new_module_name)}
77
+ end
78
+ else
79
+ say "No integration tests found in test/integration for #{old_version}"
76
80
  end
77
- else
78
- say "No integration tests found in test/integration for #{old_version}"
79
81
  end
80
82
  when :rspec
81
83
  if File.exists? "spec/controllers/#{module_name_for_path(old_module_name)}"
@@ -64,10 +64,15 @@ module Versionist
64
64
  in_root do
65
65
  case Versionist.configuration.configured_test_framework
66
66
  when :test_unit
67
- empty_directory "test/functional/#{module_name_for_path(module_name)}"
68
- template 'base_controller_functional_test.rb', File.join("test", "functional", "#{module_name_for_path(module_name)}", "base_controller_test.rb")
67
+ empty_directory "test/#{test_path}/#{module_name_for_path(module_name)}"
69
68
  empty_directory "test/integration/#{module_name_for_path(module_name)}"
70
- template 'base_controller_integration_test.rb', File.join("test", "integration", "#{module_name_for_path(module_name)}", "base_controller_test.rb")
69
+
70
+ if older_than_rails_5?
71
+ template 'base_controller_integration_test.rb', File.join("test", "integration", "#{module_name_for_path(module_name)}", "base_controller_test.rb")
72
+ template 'base_controller_functional_test.rb', File.join("test", "#{test_path}", "#{module_name_for_path(module_name)}", "base_controller_test.rb")
73
+ else
74
+ template 'base_controller_functional_test_rails_5.rb', File.join("test", "#{test_path}", "#{module_name_for_path(module_name)}", "base_controller_test_rails_5.rb")
75
+ end
71
76
  when :rspec
72
77
  @rspec_require_file = rspec_helper_filename
73
78
  empty_directory "spec/controllers/#{module_name_for_path(module_name)}"
@@ -92,7 +97,12 @@ module Versionist
92
97
  case Versionist.configuration.configured_test_framework
93
98
  when :test_unit
94
99
  empty_directory "test/presenters/#{module_name_for_path(module_name)}"
95
- template 'base_presenter_test.rb', File.join("test", "presenters", "#{module_name_for_path(module_name)}", "base_presenter_test.rb")
100
+
101
+ if older_than_rails_5?
102
+ template 'base_presenter_test.rb', File.join("test", "presenters", "#{module_name_for_path(module_name)}", "base_presenter_test.rb")
103
+ else
104
+ template 'base_presenter_test_rails_5.rb', File.join("test", "presenters", "#{module_name_for_path(module_name)}", "base_presenter_test_rails_5.rb")
105
+ end
96
106
  when :rspec
97
107
  @rspec_require_file = rspec_helper_filename
98
108
  empty_directory "spec/presenters/#{module_name_for_path(module_name)}"
@@ -0,0 +1,8 @@
1
+ require 'test_helper'
2
+
3
+ class <%= module_name %>::BaseControllerTest < ActionDispatch::IntegrationTest
4
+ # Replace this with your real tests.
5
+ test "the truth" do
6
+ assert true
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ require 'test_helper'
2
+
3
+ class <%= module_name %>::BasePresenterTest < ActiveSupport::TestCase
4
+ # Replace this with your real tests.
5
+ test "the truth" do
6
+ assert true
7
+ end
8
+ end
@@ -32,8 +32,12 @@ module Versionist
32
32
  in_root do
33
33
  case Versionist.configuration.configured_test_framework
34
34
  when :test_unit
35
- template 'new_controller_functional_test.rb', File.join("test", "functional", "#{module_name_for_path(module_name)}", "#{file_name}_controller_test.rb")
36
- template 'new_controller_integration_test.rb', File.join("test", "integration", "#{module_name_for_path(module_name)}", "#{file_name}_controller_test.rb")
35
+ if older_than_rails_5?
36
+ template 'new_controller_integration_test.rb', File.join("test", "integration", "#{module_name_for_path(module_name)}", "#{file_name}_controller_test.rb")
37
+ template 'new_controller_functional_test.rb', File.join("test", "#{test_path}", "#{module_name_for_path(module_name)}", "#{file_name}_controller_test.rb")
38
+ else
39
+ template 'new_controller_functional_test_rails_5.rb', File.join("test", "#{test_path}", "#{module_name_for_path(module_name)}", "#{file_name}_controller_test_rails_5.rb")
40
+ end
37
41
  when :rspec
38
42
  @rspec_require_file = rspec_helper_filename
39
43
  template 'new_controller_spec.rb', File.join("spec", "controllers", "#{module_name_for_path(module_name)}", "#{file_name}_controller_spec.rb"), :assigns => { :rspec_require_file => @rspec_require_file }
@@ -0,0 +1,9 @@
1
+ require 'test_helper'
2
+
3
+ class <%= module_name %>::<%= class_name%>ControllerTest < ActionDispatch::IntegrationTest
4
+
5
+ # Replace this with your real tests.
6
+ test "the truth" do
7
+ assert true
8
+ end
9
+ end
@@ -19,7 +19,11 @@ module Versionist
19
19
  in_root do
20
20
  case Versionist.configuration.configured_test_framework
21
21
  when :test_unit
22
- template 'new_presenter_test.rb', File.join("test", "presenters", "#{module_name_for_path(module_name)}", "#{file_name}_presenter_test.rb")
22
+ if older_than_rails_5?
23
+ template 'new_presenter_test.rb', File.join("test", "presenters", "#{module_name_for_path(module_name)}", "#{file_name}_presenter_test.rb")
24
+ else
25
+ template 'new_presenter_test_rails_5.rb', File.join("test", "presenters", "#{module_name_for_path(module_name)}", "#{file_name}_presenter_test_rails_5.rb")
26
+ end
23
27
  when :rspec
24
28
  @rspec_require_file = rspec_helper_filename
25
29
  template 'new_presenter_spec.rb', File.join("spec", "presenters", "#{module_name_for_path(module_name)}", "#{file_name}_presenter_spec.rb"), :assigns => { :rspec_require_file => @rspec_require_file }
@@ -0,0 +1,8 @@
1
+ require 'test_helper'
2
+
3
+ class <%= module_name %>::<%= class_name%>PresenterTest < ActiveSupport::TestCase
4
+ # Replace this with your real tests.
5
+ test "the truth" do
6
+ assert true
7
+ end
8
+ end
data/lib/versionist.rb CHANGED
@@ -17,6 +17,15 @@ module Versionist
17
17
  def self.configuration
18
18
  @@configuration ||= Configuration.new
19
19
  end
20
+
21
+ def self.older_than_rails_5?
22
+ defined?(Rails) && Rails.version.to_i < 5
23
+ end
24
+
25
+ def self.test_path
26
+ return "test/functional" if older_than_rails_5?
27
+ "test/controllers"
28
+ end
20
29
  end
21
30
 
22
31
  require 'versionist/railtie' if defined?(Rails) && Rails::VERSION::MAJOR >= 3
@@ -1,3 +1,3 @@
1
1
  module Versionist
2
- VERSION = '1.5.0'
2
+ VERSION = '1.6.0'
3
3
  end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: versionist
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Ploetz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-17 00:00:00.000000000 Z
11
+ date: 2017-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '3'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: yard
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0.7'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.7'
55
55
  description: A plugin for versioning Rails based RESTful APIs.
@@ -65,17 +65,20 @@ files:
65
65
  - lib/generators/versionist/new_api_version/new_api_version_generator.rb
66
66
  - lib/generators/versionist/new_api_version/templates/base_controller.rb
67
67
  - lib/generators/versionist/new_api_version/templates/base_controller_functional_test.rb
68
+ - lib/generators/versionist/new_api_version/templates/base_controller_functional_test_rails_5.rb
68
69
  - lib/generators/versionist/new_api_version/templates/base_controller_integration_test.rb
69
70
  - lib/generators/versionist/new_api_version/templates/base_controller_spec.rb
70
71
  - lib/generators/versionist/new_api_version/templates/base_presenter.rb
71
72
  - lib/generators/versionist/new_api_version/templates/base_presenter_spec.rb
72
73
  - lib/generators/versionist/new_api_version/templates/base_presenter_test.rb
74
+ - lib/generators/versionist/new_api_version/templates/base_presenter_test_rails_5.rb
73
75
  - lib/generators/versionist/new_api_version/templates/docs_index.rb
74
76
  - lib/generators/versionist/new_api_version/templates/docs_style.rb
75
77
  - lib/generators/versionist/new_controller/USAGE
76
78
  - lib/generators/versionist/new_controller/new_controller_generator.rb
77
79
  - lib/generators/versionist/new_controller/templates/new_controller.rb
78
80
  - lib/generators/versionist/new_controller/templates/new_controller_functional_test.rb
81
+ - lib/generators/versionist/new_controller/templates/new_controller_functional_test_rails_5.rb
79
82
  - lib/generators/versionist/new_controller/templates/new_controller_integration_test.rb
80
83
  - lib/generators/versionist/new_controller/templates/new_controller_spec.rb
81
84
  - lib/generators/versionist/new_presenter/USAGE
@@ -83,6 +86,7 @@ files:
83
86
  - lib/generators/versionist/new_presenter/templates/new_presenter.rb
84
87
  - lib/generators/versionist/new_presenter/templates/new_presenter_spec.rb
85
88
  - lib/generators/versionist/new_presenter/templates/new_presenter_test.rb
89
+ - lib/generators/versionist/new_presenter/templates/new_presenter_test_rails_5.rb
86
90
  - lib/generators/versionist/rspec_helper.rb
87
91
  - lib/versionist.rb
88
92
  - lib/versionist/configuration.rb
@@ -102,17 +106,17 @@ licenses:
102
106
  metadata: {}
103
107
  post_install_message:
104
108
  rdoc_options:
105
- - --charset=UTF-8
109
+ - "--charset=UTF-8"
106
110
  require_paths:
107
111
  - lib
108
112
  required_ruby_version: !ruby/object:Gem::Requirement
109
113
  requirements:
110
- - - ! '>='
114
+ - - ">="
111
115
  - !ruby/object:Gem::Version
112
116
  version: '0'
113
117
  required_rubygems_version: !ruby/object:Gem::Requirement
114
118
  requirements:
115
- - - ! '>='
119
+ - - ">="
116
120
  - !ruby/object:Gem::Version
117
121
  version: 1.3.6
118
122
  requirements: []
@@ -120,5 +124,5 @@ rubyforge_project:
120
124
  rubygems_version: 2.4.8
121
125
  signing_key:
122
126
  specification_version: 4
123
- summary: versionist-1.5.0
127
+ summary: versionist-1.6.0
124
128
  test_files: []