ubiquo 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/ubiquo/options.rb +13 -2
- data/lib/ubiquo/template.erb +2 -2
- data/test/ubiquo/options_test.rb +11 -0
- data/ubiquo.gemspec +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
data/lib/ubiquo/options.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
module Ubiquo
|
2
|
-
# TODO: Add a devel flag (git repos access)
|
3
|
-
# TODO: Add fields to configure e-mails for exception_notification
|
4
2
|
# TODO: Improve banner to inform of UBIQUO_OPTS env var merging
|
5
3
|
# TODO: Add git needed params for repo creation on github
|
6
4
|
class Options < Hash
|
@@ -16,6 +14,9 @@ module Ubiquo
|
|
16
14
|
self[:locale] = :en
|
17
15
|
self[:devel] = false
|
18
16
|
self[:gnuine] = args.delete('--gnuine') || false
|
17
|
+
self[:exception_recipient] = "chan@ge.me"
|
18
|
+
self[:sender_address] = "chan@ge.me"
|
19
|
+
|
19
20
|
|
20
21
|
@opts = OptionParser.new do |o|
|
21
22
|
o.banner = """Usage: #{File.basename($0)} [options] application_name"
|
@@ -42,6 +43,16 @@ module Ubiquo
|
|
42
43
|
suported_locales.each do |locale, msg|
|
43
44
|
o.on("--#{locale.to_s}", msg) { self[:locale] = locale }
|
44
45
|
end
|
46
|
+
|
47
|
+
o.separator "\nException notification options: "
|
48
|
+
|
49
|
+
o.on("--recipient [EMAIL]", "E-mail for exception notifications.") do |recipient|
|
50
|
+
self[:exception_recipient] = recipient
|
51
|
+
end
|
52
|
+
|
53
|
+
o.on("--sender [EMAIL]", "E-mail to use in from.") do |sender|
|
54
|
+
self[:sender_address] = sender
|
55
|
+
end
|
45
56
|
|
46
57
|
o.separator "\nExtra options:"
|
47
58
|
|
data/lib/ubiquo/template.erb
CHANGED
@@ -46,8 +46,8 @@ def add_plugins(plugin_names, options={})
|
|
46
46
|
end
|
47
47
|
# To ask needed settings when boostraping the app
|
48
48
|
appname = "<%= @opts[:app_name] %>"
|
49
|
-
exception_recipient = "
|
50
|
-
sender_address = "
|
49
|
+
exception_recipient = "<%= @opts[:exception_recipient] %>"
|
50
|
+
sender_address = "<%= @opts[:sender_address] %>"
|
51
51
|
# Remove rails temporary directories
|
52
52
|
["./tmp/pids", "./tmp/sessions", "./tmp/sockets", "./tmp/cache"].each do |f|
|
53
53
|
run("rmdir ./#{f}")
|
data/test/ubiquo/options_test.rb
CHANGED
@@ -47,5 +47,16 @@ class TestOptions < Test::Unit::TestCase
|
|
47
47
|
version = File.read(version_file).strip
|
48
48
|
assert_equal version, opts[:version]
|
49
49
|
end
|
50
|
+
|
51
|
+
def test_should_be_able_to_set_default_locale
|
52
|
+
opts = Options.new(%w[ --ca myaapp ])
|
53
|
+
assert_equal :ca, opts[:locale]
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_should_be_able_to_set_exception_notification_options
|
57
|
+
opts = Options.new(%w[ --recipient r@r.com --sender s@s.com myapp])
|
58
|
+
assert_equal "r@r.com", opts[:exception_recipient]
|
59
|
+
assert_equal "s@s.com", opts[:sender_address]
|
60
|
+
end
|
50
61
|
|
51
62
|
end
|
data/ubiquo.gemspec
CHANGED