standup 0.6.8 → 0.6.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/standup.rb +5 -1
- data/lib/standup/scripts/base.rb +16 -16
- data/lib/standup/version.rb +1 -1
- metadata +2 -2
data/lib/standup.rb
CHANGED
@@ -29,11 +29,15 @@ module Standup
|
|
29
29
|
def self.local_scripts_path
|
30
30
|
File.expand_path('config/standup') rescue nil
|
31
31
|
end
|
32
|
+
|
33
|
+
def self.conf_scripts_path
|
34
|
+
File.expand_path("#{Settings.conf_scripts_path}/config/standup") rescue nil
|
35
|
+
end
|
32
36
|
|
33
37
|
def self.scripts
|
34
38
|
unless class_variable_defined? :@@scripts
|
35
39
|
@@scripts = {}
|
36
|
-
[gem_scripts_path, local_scripts_path].each do |dir|
|
40
|
+
[gem_scripts_path, conf_scripts_path, local_scripts_path].compact.each do |dir|
|
37
41
|
Dir.foreach dir do |name|
|
38
42
|
next unless File.file? "#{dir}/#{name}"
|
39
43
|
next unless name =~ /\.rb$/
|
data/lib/standup/scripts/base.rb
CHANGED
@@ -7,50 +7,50 @@ module Standup
|
|
7
7
|
merge_params self.class.default_params
|
8
8
|
merge_params Settings[name]
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
class_attribute :name
|
12
|
-
|
12
|
+
|
13
13
|
class_attribute :default_params
|
14
14
|
self.default_params = {}
|
15
|
-
|
15
|
+
|
16
16
|
class_attribute :description
|
17
|
-
|
17
|
+
|
18
18
|
attr_accessor :params
|
19
|
-
|
19
|
+
|
20
20
|
def name
|
21
21
|
self.class.name
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
def put_title
|
25
25
|
bright_p name, HighLine::CYAN
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
def script_file filename
|
29
|
-
[Standup.local_scripts_path, Standup.gem_scripts_path].each do |dir|
|
29
|
+
[Standup.local_scripts_path, Standup.conf_scripts_path, Standup.gem_scripts_path].compact.each do |dir|
|
30
30
|
next unless dir
|
31
31
|
path = File.expand_path("#{name}/#{filename}", dir)
|
32
32
|
return path if File.exists? path
|
33
33
|
end
|
34
34
|
nil
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
def with_processed_file filename
|
38
38
|
Dir.mktmpdir do |dir|
|
39
39
|
erb = ERB.new File.read(filename)
|
40
40
|
erb.filename = filename
|
41
41
|
result = erb.result get_binding
|
42
|
-
tmp_filename = File.expand_path File.basename(filename), dir
|
42
|
+
tmp_filename = File.expand_path File.basename(filename), dir
|
43
43
|
File.open(tmp_filename, 'w') {|f| f.write result}
|
44
44
|
yield tmp_filename
|
45
45
|
end
|
46
46
|
end
|
47
|
-
|
47
|
+
|
48
48
|
def self.execute
|
49
49
|
new.run
|
50
50
|
end
|
51
|
-
|
51
|
+
|
52
52
|
protected
|
53
|
-
|
53
|
+
|
54
54
|
def merge_params param_overrides
|
55
55
|
@params = if param_overrides.is_a? Hash
|
56
56
|
ActiveSupport::HashWithIndifferentAccess.new((@params || {}).merge(param_overrides))
|
@@ -58,7 +58,7 @@ module Standup
|
|
58
58
|
param_overrides || @params
|
59
59
|
end
|
60
60
|
end
|
61
|
-
|
61
|
+
|
62
62
|
def argument arg_pattern, arg_name = arg_pattern, variants = nil
|
63
63
|
self.class.argument arg_pattern, arg_name, variants
|
64
64
|
end
|
@@ -89,14 +89,14 @@ module Standup
|
|
89
89
|
opt_parser.parse ARGV
|
90
90
|
raise Trollop::HelpNeeded if ARGV.empty?
|
91
91
|
end
|
92
|
-
|
92
|
+
|
93
93
|
result = ARGV.shift
|
94
94
|
if variants && !variants.include?(result)
|
95
95
|
opt_parser.die "unknown #{arg_name} #{result}", nil
|
96
96
|
end
|
97
97
|
result
|
98
98
|
end
|
99
|
-
|
99
|
+
|
100
100
|
def get_binding
|
101
101
|
binding
|
102
102
|
end
|
data/lib/standup/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: standup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-
|
14
|
+
date: 2012-12-14 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: trollop
|