Skip to content
This repository was archived by the owner on Oct 22, 2020. It is now read-only.

Commit c03407e

Browse files
committed
Load gemspec from file to facilitate direct execution during development
1 parent 940f588 commit c03407e

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

lib/wpxf.rb

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
require 'yaml'
88
require 'zip'
99

10-
Gem.loaded_specs['wpxf'].dependencies.each do |d|
11-
require d.name unless d.type == :development || d.name == 'rubyzip'
12-
end
13-
1410
# The root namespace.
1511
module Wpxf
12+
def self.gemspec
13+
spec_path = File.join(Wpxf.app_path, 'wpxf.gemspec')
14+
Gem::Specification.load(spec_path)
15+
end
16+
1617
def self.data_directory
1718
File.join(app_path, 'data')
1819
end
@@ -22,7 +23,7 @@ def self.app_path
2223
end
2324

2425
def self.version
25-
Gem.loaded_specs['wpxf'].version
26+
gemspec.version.to_s
2627
end
2728

2829
def self.home_directory
@@ -43,4 +44,8 @@ def self.change_stdout_sync(enabled)
4344
end
4445
end
4546

47+
Wpxf.gemspec.dependencies.each do |d|
48+
require d.name unless d.type == :development || d.name == 'rubyzip'
49+
end
50+
4651
require_relative '../db/env'

0 commit comments

Comments
 (0)