drumherum 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile.rb +0 -10
- data/lib/drumherum/rake.rb +5 -2
- data/lib/drumherum/smart_init.rb +71 -5
- data/lib/drumherum.rb +5 -60
- data/version.rb +5 -4
- metadata +1 -1
data/Rakefile.rb
CHANGED
@@ -1,15 +1,5 @@
|
|
1
1
|
# ruby encoding: utf-8
|
2
2
|
|
3
|
-
if $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
4
|
-
#puts 'Path schon aktuell'
|
5
|
-
else
|
6
|
-
$:.unshift(File.dirname(__FILE__))
|
7
|
-
end
|
8
|
-
|
9
|
-
puts "Hallo"
|
10
|
-
|
11
|
-
require 'kyanite/smart_load_path'
|
12
|
-
|
13
3
|
require 'drumherum'
|
14
4
|
smart_init
|
15
5
|
require 'version'
|
data/lib/drumherum/rake.rb
CHANGED
@@ -247,8 +247,11 @@ end
|
|
247
247
|
desc 'VERSION of the current project'
|
248
248
|
task :version do
|
249
249
|
|
250
|
-
|
251
|
-
|
250
|
+
puts "\n#{Drumherum.project_name} (#{Drumherum.project_version})\n\n"
|
251
|
+
|
252
|
+
$LOAD_PATH.each do |path|
|
253
|
+
puts path
|
254
|
+
end
|
252
255
|
end
|
253
256
|
|
254
257
|
|
data/lib/drumherum/smart_init.rb
CHANGED
@@ -1,6 +1,62 @@
|
|
1
1
|
# ruby encoding: utf-8
|
2
2
|
# ü
|
3
3
|
|
4
|
+
module Drumherum
|
5
|
+
|
6
|
+
|
7
|
+
class << self
|
8
|
+
|
9
|
+
def project_name=(pn)
|
10
|
+
@project_name = pn
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
# Name of the actual project
|
15
|
+
def project_name
|
16
|
+
@project_name || 'Drumherum'
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
# Class of the actual project
|
21
|
+
def project_class
|
22
|
+
classname = project_name.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
|
23
|
+
unless /\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/ =~ classname
|
24
|
+
raise NameError, "#{classname.inspect} is not a valid constant name!"
|
25
|
+
end
|
26
|
+
Object.module_eval("::#{$1}", __FILE__, __LINE__)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Version of the actual project
|
30
|
+
def project_version
|
31
|
+
project_class.const_get('VERSION')
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
# Set your github username
|
37
|
+
def github_username=(gn)
|
38
|
+
@github_username = gn
|
39
|
+
end
|
40
|
+
|
41
|
+
# Your github username
|
42
|
+
def github_username
|
43
|
+
@github_username || 'gleer'
|
44
|
+
end
|
45
|
+
|
46
|
+
# Set the main directory (as array)
|
47
|
+
def directory_main=(mn)
|
48
|
+
@directory_main = mn
|
49
|
+
end
|
50
|
+
|
51
|
+
# The main directory (as array)
|
52
|
+
def directory_main
|
53
|
+
@directory_main || []
|
54
|
+
end
|
55
|
+
|
56
|
+
end # moduldefinitionen
|
57
|
+
|
58
|
+
end
|
59
|
+
|
4
60
|
|
5
61
|
module SmartInit
|
6
62
|
|
@@ -26,19 +82,29 @@ module SmartInit
|
|
26
82
|
break if File.directory?( File.join(patharray, 'lib') )
|
27
83
|
patharray << '..'
|
28
84
|
end
|
85
|
+
|
86
|
+
Drumherum::directory_main = patharray.dup
|
87
|
+
|
88
|
+
# Lib-Pfad anfügen
|
29
89
|
newpath = File.join(patharray,'lib')
|
30
|
-
|
31
|
-
return false
|
32
|
-
else
|
90
|
+
unless $:.include?(newpath)
|
33
91
|
$:.unshift(newpath)
|
34
|
-
|
35
|
-
|
92
|
+
end
|
93
|
+
|
94
|
+
# Hauptpfad anfügen
|
95
|
+
newpath = File.join(patharray)
|
96
|
+
unless $:.include?(newpath)
|
97
|
+
$:.unshift(newpath)
|
98
|
+
end
|
99
|
+
|
100
|
+
|
36
101
|
|
37
102
|
end #def
|
38
103
|
|
39
104
|
|
40
105
|
end # module
|
41
106
|
|
107
|
+
|
42
108
|
class Object
|
43
109
|
include SmartInit
|
44
110
|
end
|
data/lib/drumherum.rb
CHANGED
@@ -1,16 +1,13 @@
|
|
1
1
|
# ruby encoding: utf-8
|
2
2
|
# ü
|
3
3
|
|
4
|
-
if $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
5
|
-
#puts 'Path schon aktuell'
|
6
|
-
else
|
7
|
-
$:.unshift(File.dirname(__FILE__))
|
8
|
-
end
|
9
|
-
|
10
4
|
|
11
5
|
require 'hoe'
|
12
6
|
require 'rbconfig'
|
13
|
-
require 'drumherum/smart_init' unless defined?
|
7
|
+
require 'drumherum/smart_init' unless defined? SmartInit
|
8
|
+
|
9
|
+
|
10
|
+
|
14
11
|
|
15
12
|
unless defined? WINDOWS
|
16
13
|
WINDOWS = /djgpp|(cyg|ms|bcc)win|mingw/ =~ RUBY_PLATFORM ? RUBY_PLATFORM : false
|
@@ -24,59 +21,7 @@ end
|
|
24
21
|
|
25
22
|
|
26
23
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
class << self
|
31
|
-
|
32
|
-
def project_name=(pn)
|
33
|
-
@project_name = pn
|
34
|
-
end
|
35
|
-
|
36
|
-
|
37
|
-
# Name of the actual project
|
38
|
-
def project_name
|
39
|
-
@project_name || 'Drumherum'
|
40
|
-
end
|
41
|
-
|
42
|
-
|
43
|
-
# Class of the actual project
|
44
|
-
def project_class
|
45
|
-
classname = project_name.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
|
46
|
-
unless /\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/ =~ classname
|
47
|
-
raise NameError, "#{classname.inspect} is not a valid constant name!"
|
48
|
-
end
|
49
|
-
Object.module_eval("::#{$1}", __FILE__, __LINE__)
|
50
|
-
end
|
51
|
-
|
52
|
-
# Version of the actual project
|
53
|
-
def project_version
|
54
|
-
project_class.const_get('VERSION')
|
55
|
-
end
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
# Set your github username
|
60
|
-
def github_username=(gn)
|
61
|
-
@github_username = gn
|
62
|
-
end
|
63
|
-
|
64
|
-
# Your github username
|
65
|
-
def github_username
|
66
|
-
@github_username || 'gleer'
|
67
|
-
end
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
end # moduldefinitionen
|
78
|
-
|
79
|
-
end
|
24
|
+
|
80
25
|
|
81
26
|
|
82
27
|
|
data/version.rb
CHANGED