rails_view 2.3.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 902427dce201a12545c66af4470b370523cf94b6
4
+ data.tar.gz: bc3a624a41d51d52c17a65266ebc015d53e26aa7
5
+ SHA512:
6
+ metadata.gz: b78fcb2498bf64f3408b45a57e8b9bdfca5ba9565581f291a33387990e72bf2c5f2fbd0215ec5a4239e8eddfea18c0748a20184028c09d45add2c0a61eee2986
7
+ data.tar.gz: a43936f1ffb973373cf3360770c654ef4b708591fb147a07fde95e904f137ce7c14e2f10e3a46cf64e0503c2ce8bf26849a68b2961f49483f783eec7d5b73b7a
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ This.email = "ara.t.howard@gmail.com"
4
4
  This.homepage = "https://github.com/ahoward/#{ This.lib }"
5
5
 
6
6
  task :license do
7
- open('LICENSE', 'w'){|fd| fd.puts "same as ruby's"}
7
+ open('LICENSE', 'w'){|fd| fd.puts "Ruby"}
8
8
  end
9
9
 
10
10
  task :default do
@@ -93,7 +93,7 @@ task :gemspec do
93
93
  test_files = "test/#{ lib }.rb" if File.file?("test/#{ lib }.rb")
94
94
  summary = object.respond_to?(:summary) ? object.summary : "summary: #{ lib } kicks the ass"
95
95
  description = object.respond_to?(:description) ? object.description : "description: #{ lib } kicks the ass"
96
- license = object.respond_to?(:license) ? object.license : "same as ruby's"
96
+ license = object.respond_to?(:license) ? object.license : "Ruby"
97
97
 
98
98
  if This.extensions.nil?
99
99
  This.extensions = []
@@ -104,39 +104,51 @@ task :gemspec do
104
104
  end
105
105
  extensions = [extensions].flatten.compact
106
106
 
107
+ if This.dependencies.nil?
108
+ dependencies = []
109
+ else
110
+ case This.dependencies
111
+ when Hash
112
+ dependencies = This.dependencies.values
113
+ when Array
114
+ dependencies = This.dependencies
115
+ end
116
+ end
117
+
107
118
  template =
108
119
  if test(?e, 'gemspec.erb')
109
120
  Template{ IO.read('gemspec.erb') }
110
121
  else
111
122
  Template {
112
123
  <<-__
113
- ## #{ lib }.gemspec
124
+ ## <%= lib %>.gemspec
114
125
  #
115
126
 
116
127
  Gem::Specification::new do |spec|
117
- spec.name = #{ lib.inspect }
118
- spec.version = #{ version.inspect }
128
+ spec.name = <%= lib.inspect %>
129
+ spec.version = <%= version.inspect %>
119
130
  spec.platform = Gem::Platform::RUBY
120
- spec.summary = #{ lib.inspect }
121
- spec.description = #{ description.inspect }
122
- spec.license = #{ license.inspect }
131
+ spec.summary = <%= lib.inspect %>
132
+ spec.description = <%= description.inspect %>
133
+ spec.license = <%= license.inspect %>
123
134
 
124
- spec.files =\n#{ files.sort.pretty_inspect }
125
- spec.executables = #{ executables.inspect }
135
+ spec.files =\n<%= files.sort.pretty_inspect %>
136
+ spec.executables = <%= executables.inspect %>
126
137
 
127
138
  spec.require_path = "lib"
128
139
 
129
- spec.test_files = #{ test_files.inspect }
140
+ spec.test_files = <%= test_files.inspect %>
130
141
 
131
- ### spec.add_dependency 'lib', '>= version'
132
- #### spec.add_dependency 'map'
142
+ <% dependencies.each do |lib_version| %>
143
+ spec.add_dependency(*<%= Array(lib_version).flatten.inspect %>)
144
+ <% end %>
133
145
 
134
- spec.extensions.push(*#{ extensions.inspect })
146
+ spec.extensions.push(*<%= extensions.inspect %>)
135
147
 
136
- spec.rubyforge_project = #{ This.rubyforge_project.inspect }
137
- spec.author = #{ This.author.inspect }
138
- spec.email = #{ This.email.inspect }
139
- spec.homepage = #{ This.homepage.inspect }
148
+ spec.rubyforge_project = <%= This.rubyforge_project.inspect %>
149
+ spec.author = <%= This.author.inspect %>
150
+ spec.email = <%= This.email.inspect %>
151
+ spec.homepage = <%= This.homepage.inspect %>
140
152
  end
141
153
  __
142
154
  }
@@ -180,8 +192,8 @@ task :readme do
180
192
  end
181
193
 
182
194
  template =
183
- if test(?e, 'readme.erb')
184
- Template{ IO.read('readme.erb') }
195
+ if test(?e, 'README.erb')
196
+ Template{ IO.read('README.erb') }
185
197
  else
186
198
  Template {
187
199
  <<-__
@@ -249,28 +261,35 @@ BEGIN {
249
261
  #
250
262
  This = OpenStruct.new
251
263
 
252
- This.file = File.expand_path(__FILE__)
253
- This.dir = File.dirname(This.file)
264
+ This.file = File.expand_path(__FILE__)
265
+ This.dir = File.dirname(This.file)
254
266
  This.pkgdir = File.join(This.dir, 'pkg')
255
267
 
256
- # grok lib
268
+ This.lib = File.basename(Dir.pwd)
269
+ This._lib = "#{ This.dir }/lib/#{ This.lib }/_lib.rb"
270
+
271
+ # load meta lib info
257
272
  #
258
- lib = ENV['LIB']
259
- unless lib
260
- lib = File.basename(Dir.pwd).sub(/[-].*$/, '')
273
+ a = Object.constants.dup
274
+ require This._lib
275
+ b = Object.constants.dup
276
+ added = b - a
277
+ const = added.first
278
+
279
+ if added.size > 1
280
+ STDERR.puts "WARNING: defined multiple constants #{ added.inspect } in #{ _lib }, using #{ const } !!!"
261
281
  end
262
- This.lib = lib
263
282
 
264
- # grok version
283
+ This.const = const
284
+ This.object = Object.const_get(This.const)
285
+ This.name = This.object.name
286
+ This.version = This.object.send(:version)
287
+
288
+ # see if dependencies are export by the module
265
289
  #
266
- version = ENV['VERSION']
267
- unless version
268
- require "./lib/#{ This.lib }"
269
- This.name = lib.capitalize
270
- This.object = eval(This.name)
271
- version = This.object.send(:version)
290
+ if This.object.respond_to?(:dependencies)
291
+ This.dependencies = This.object.dependencies
272
292
  end
273
- This.version = version
274
293
 
275
294
  # we need to know the name of the lib an it's version
276
295
  #
@@ -279,12 +298,12 @@ BEGIN {
279
298
 
280
299
  # discover full path to this ruby executable
281
300
  #
282
- c = Config::CONFIG
283
- bindir = c["bindir"] || c['BINDIR']
301
+ c = RbConfig::CONFIG
302
+ bindir = c["bindir"] || c['BINDIR']
284
303
  ruby_install_name = c['ruby_install_name'] || c['RUBY_INSTALL_NAME'] || 'ruby'
285
- ruby_ext = c['EXEEXT'] || ''
286
- ruby = File.join(bindir, (ruby_install_name + ruby_ext))
287
- This.ruby = ruby
304
+ ruby_ext = c['EXEEXT'] || ''
305
+ ruby = File.join(bindir, (ruby_install_name + ruby_ext))
306
+ This.ruby = ruby
288
307
 
289
308
  # some utils
290
309
  #
@@ -0,0 +1,13 @@
1
+ class View
2
+ VERSION = '3.0.0'
3
+
4
+ def View.version
5
+ View::VERSION
6
+ end
7
+
8
+ def View.dependencies
9
+ {
10
+ 'rails_current' => [ 'rails_current' , '~> 1' ]
11
+ }
12
+ end
13
+ end
data/lib/rails_view.rb CHANGED
@@ -1,72 +1,24 @@
1
- require 'rails' unless defined?(::Rails)
2
- require 'action_controller' unless defined?(::ActionController)
3
1
 
4
2
  class View
5
- VERSION = '2.3.0'
3
+ require_relative '../_lib.rb'
6
4
 
7
- def View.version
8
- View::VERSION
5
+ begin
6
+ require 'rubygems'
7
+ rescue LoadError
8
+ nil
9
9
  end
10
10
 
11
- def View.load_shit!
12
- @loaded_shit ||= (
13
- unless defined?(::Rails)
14
- require 'rails'
15
- end
11
+ require 'rails' unless defined?(::Rails)
12
+ require 'action_controller' unless defined?(::ActionController)
16
13
 
17
- unless defined?(::ActionController)
18
- require 'action_controller'
19
- end
20
-
21
- unless defined?(::ActionDispatch::TestRequest)
22
- require 'action_dispatch/testing/test_request.rb'
23
- end
24
-
25
- unless defined?(::ActionDispatch::TestResponse)
26
- require 'action_dispatch/testing/test_response.rb'
27
- end
28
-
29
- true
30
- )
14
+ View.dependencies.each do |lib, dependency|
15
+ gem(*dependency) if defined?(gem)
16
+ require(lib)
31
17
  end
32
18
 
33
- if defined?(::Rails_current) && defined?(::Current)
34
- def View.controller(&block)
35
- controller = ::Current.controller ? ::Current.controller.dup : ::Current.mock_controller
36
- block ? controller.instance_eval(&block) : controller
37
- end
38
- else
39
- def View.controller(&block)
40
- load_shit!
41
-
42
- controller_class = Class.new(::ActionController::Base) do
43
- layout false
44
- helper :all
45
- end
46
-
47
- default_url_options =
48
- begin
49
- require 'rails_default_url_options'
50
- DefaultUrlOptions
51
- rescue LoadError
52
- options[:default_url_options] || {}
53
- end
54
-
55
- store = ActiveSupport::Cache::MemoryStore.new
56
- request = ActionDispatch::TestRequest.new
57
- response = ActionDispatch::TestResponse.new
58
-
59
- controller = controller_class.new()
60
-
61
- controller.perform_caching = false
62
- controller.cache_store = store
63
- controller.request = request
64
- controller.response = response
65
- #controller.send(:initialize_template_class, response)
66
- #controller.send(:assign_shortcuts, request, response)
67
- controller.send(:default_url_options).merge!(default_url_options)
68
- block ? controller.instance_eval(&block) : controller
69
- end
19
+ def View.controller(&block)
20
+ controller = ::Current.controller ? ::Current.controller.dup : ::Current.mock_controller
21
+ block ? controller.instance_eval(&block) : controller
70
22
  end
71
23
 
72
24
  def View.render(*args)
data/rails_view.gemspec CHANGED
@@ -3,17 +3,19 @@
3
3
 
4
4
  Gem::Specification::new do |spec|
5
5
  spec.name = "rails_view"
6
- spec.version = "2.3.0"
6
+ spec.version = "3.0.0"
7
7
  spec.platform = Gem::Platform::RUBY
8
8
  spec.summary = "rails_view"
9
9
  spec.description = "description: rails_view kicks the ass"
10
- spec.license = "same as ruby's"
10
+ spec.license = "Ruby"
11
11
 
12
12
  spec.files =
13
13
  ["README.md",
14
14
  "Rakefile",
15
15
  "lib",
16
+ "lib/rails_view",
16
17
  "lib/rails_view.rb",
18
+ "lib/rails_view/_lib.rb",
17
19
  "rails_view.gemspec",
18
20
  "test",
19
21
  "test/rails_view_test.rb",
@@ -25,8 +27,9 @@ Gem::Specification::new do |spec|
25
27
 
26
28
  spec.test_files = nil
27
29
 
28
- ### spec.add_dependency 'lib', '>= version'
29
- #### spec.add_dependency 'map'
30
+
31
+ spec.add_dependency(*["rails_current", "~> 1"])
32
+
30
33
 
31
34
  spec.extensions.push(*[])
32
35
 
metadata CHANGED
@@ -1,17 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_view
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
5
- prerelease:
4
+ version: 3.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ara T. Howard
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2016-01-06 00:00:00.000000000 Z
13
- dependencies: []
14
- description: ! 'description: rails_view kicks the ass'
11
+ date: 2018-03-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails_current
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1'
27
+ description: 'description: rails_view kicks the ass'
15
28
  email: ara.t.howard@gmail.com
16
29
  executables: []
17
30
  extensions: []
@@ -20,33 +33,33 @@ files:
20
33
  - README.md
21
34
  - Rakefile
22
35
  - lib/rails_view.rb
36
+ - lib/rails_view/_lib.rb
23
37
  - rails_view.gemspec
24
38
  - test/rails_view_test.rb
25
39
  - test/testing.rb
26
40
  homepage: https://github.com/ahoward/rails_view
27
41
  licenses:
28
- - same as ruby's
42
+ - Ruby
43
+ metadata: {}
29
44
  post_install_message:
30
45
  rdoc_options: []
31
46
  require_paths:
32
47
  - lib
33
48
  required_ruby_version: !ruby/object:Gem::Requirement
34
- none: false
35
49
  requirements:
36
- - - ! '>='
50
+ - - ">="
37
51
  - !ruby/object:Gem::Version
38
52
  version: '0'
39
53
  required_rubygems_version: !ruby/object:Gem::Requirement
40
- none: false
41
54
  requirements:
42
- - - ! '>='
55
+ - - ">="
43
56
  - !ruby/object:Gem::Version
44
57
  version: '0'
45
58
  requirements: []
46
59
  rubyforge_project: codeforpeople
47
- rubygems_version: 1.8.23.2
60
+ rubygems_version: 2.6.8
48
61
  signing_key:
49
- specification_version: 3
62
+ specification_version: 4
50
63
  summary: rails_view
51
64
  test_files: []
52
65
  has_rdoc: