vedeu 0.4.42 → 0.4.43

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: d52cfaf13c8adfd85fb8d7f29a66133d4d12781c
4
- data.tar.gz: 901409d56b30fad4859b55f5b188e44a16628b08
3
+ metadata.gz: cffdbe3379ae8f53f8e224ad01f554f697291aeb
4
+ data.tar.gz: 48dacd852a9ece5238fd2986a64897335416f0c6
5
5
  SHA512:
6
- metadata.gz: 46f1892cef45301eefbea271b95a06455ce30781e4b5f793cd779adb1c81e83e2f99c833db01d97b171fbfdda163f3fe890dff977d9f6108270bd8ea229b23ba
7
- data.tar.gz: 752fd49e4627635d187c7d8b73f1773f3be1b1d12a638ae2f0f15e1466a219ac4a16237a869138cb394138571c77b13b112c0b1dccb7b712b4a32f8a16ebeb56
6
+ metadata.gz: b36dc6810c4e595f8ddacb09f2c076c0b9d00d457b281a4d03b31cb980db8a547881b458707e6f456b4be1a5ab2c7cbdfd65a8da3b8d06fb7c2463a03b440857
7
+ data.tar.gz: 2709588855899d5f3d107ab9ccccc66d6b93bfb7693d59cad06865d84bff61e3be0398b8c07d532d3614ffd32bf019c1c96c576941fec30da6d075127c56f08a
@@ -40,7 +40,8 @@ module Vedeu
40
40
  # @param value [String]
41
41
  # @return [String]
42
42
  def template(value)
43
- @template = File.expand_path("./app/views/templates/#{value}.erb")
43
+ @template = Vedeu::Configuration.base_path +
44
+ "/app/views/templates/#{value}.erb"
44
45
  end
45
46
 
46
47
  end # ApplicationView
@@ -27,13 +27,18 @@ module Vedeu
27
27
  def start
28
28
  Vedeu.configure { log('/tmp/vedeu_bootstrap.log') }
29
29
 
30
+ # config/configuration.rb is already loaded so don't load it twice
31
+ Dir[File.join(Vedeu::Configuration.base_path, 'config/**/*')].each do |f|
32
+ next if f =~ %r{config/configuration\.rb}
33
+ load f
34
+ end
35
+
30
36
  [
31
- './config/**/*',
32
- './app/controllers/**/*',
33
- './app/helpers/**/*',
34
- './app/views/**/*',
35
- './app/models/keymaps/**/*',
36
- ].each { |path| load(path) }
37
+ 'app/controllers/**/*',
38
+ 'app/helpers/**/*',
39
+ 'app/views/**/*',
40
+ 'app/models/keymaps/**/*',
41
+ ].each { |path| load(File.join(Vedeu::Configuration.base_path, path)) }
37
42
 
38
43
  entry_point
39
44
 
@@ -1,3 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'vedeu', path: '~/gem'
3
+ gem 'vedeu'
@@ -1,3 +1,4 @@
1
+ require_relative 'config/configuration'
1
2
  require_relative 'app/controllers/some_controller'
2
3
 
3
4
  module <%= object.name_as_class %>
@@ -277,6 +277,16 @@ module Vedeu
277
277
  end
278
278
  alias_method :renderers, :renderer
279
279
 
280
+ # Override the base path for the application (for locating templates and
281
+ # other resources). By default the base path is just cwd but this will
282
+ # not work for many applications.
283
+ #
284
+ # @param value [String]
285
+ # @return [String]
286
+ def base_path(path = nil)
287
+ options[:base_path] = path
288
+ end
289
+
280
290
  # Sets the value of STDIN.
281
291
  #
282
292
  # @example
@@ -34,6 +34,13 @@ module Vedeu
34
34
 
35
35
  class << self
36
36
 
37
+ # Returns the base_path value
38
+ #
39
+ # @return [String]
40
+ def base_path
41
+ instance.options[:base_path]
42
+ end
43
+
37
44
  # Configure Vedeu with sensible defaults. If the client application sets
38
45
  # options, override the defaults with those, and if command-line arguments
39
46
  # are provided at application invocation, override any options with the
@@ -241,6 +248,7 @@ module Vedeu
241
248
  # @return [Hash]
242
249
  def defaults
243
250
  {
251
+ base_path: set_base_path,
244
252
  colour_mode: detect_colour_mode,
245
253
  debug: false,
246
254
  drb: false,
@@ -272,6 +280,10 @@ module Vedeu
272
280
  end
273
281
  end
274
282
 
283
+ def set_base_path
284
+ File.expand_path('.')
285
+ end
286
+
275
287
  end # Configuration
276
288
 
277
289
  end # Vedeu
@@ -1,6 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # The current version of Vedeu.
4
- VERSION = '0.4.42'
4
+ VERSION = '0.4.43'
5
5
 
6
6
  end
@@ -12,6 +12,13 @@ module Vedeu
12
12
  before { Configuration.reset! }
13
13
  after { test_configuration }
14
14
 
15
+ describe '#base_path' do
16
+ it 'sets the option to the desired value' do
17
+ configuration = Vedeu.configure { base_path 'somewhere' }
18
+ configuration.base_path.must_equal('somewhere')
19
+ end
20
+ end
21
+
15
22
  describe '.configure' do
16
23
  it 'returns the configuration singleton' do
17
24
  Vedeu.configure do
@@ -9,6 +9,14 @@ module Vedeu
9
9
  before { Configuration.reset! }
10
10
  after { test_configuration }
11
11
 
12
+ describe '#base_path' do
13
+ it { described.must_respond_to(:base_path) }
14
+
15
+ it 'returns the value of the base_path option' do
16
+ Configuration.base_path.must_equal(Dir.pwd)
17
+ end
18
+ end
19
+
12
20
  describe '#debug?' do
13
21
  it { described.must_respond_to(:debug) }
14
22
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vedeu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.42
4
+ version: 0.4.43
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Laking
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-04 00:00:00.000000000 Z
11
+ date: 2015-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard