carlosbrando-autotest-notification 1.7.2 → 1.7.3

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.
@@ -1,79 +0,0 @@
1
- require 'optparse'
2
-
3
- module AnInstall
4
- class CLI
5
- def self.execute(stdout, arguments=[])
6
-
7
- # NOTE: the option -p/--path= is given as an example, and should be replaced in your application.
8
-
9
- options = {
10
- :path => '~',
11
- :speaking => false,
12
- :doom => false,
13
- :sticky => false,
14
- :pending => false,
15
- :buuf => false
16
- }
17
- mandatory_options = %w( )
18
-
19
- parser = OptionParser.new do |opts|
20
- opts.banner = <<-BANNER.gsub(/^ /,'')
21
- This application is wonderful because...
22
-
23
- Usage: #{File.basename($0)} [options]
24
-
25
- Options are:
26
- BANNER
27
- opts.separator ""
28
- opts.on("-p", "--path=PATH", String,
29
- "This is a sample message.",
30
- "For multiple lines, add more strings.",
31
- "Default: ~") { |arg| options[:path] = arg }
32
- opts.on("-s", "--speaking",
33
- "If a test failed, the computer will speak.",
34
- "For all plataforms.") { options[:speaking] = true }
35
- opts.on("-d", "--doom",
36
- "Special Doom Edition.",
37
- "Only for Mac.") { options[:doom] = true }
38
- opts.on("-b", "--buuf",
39
- "Special Buuf Images.",
40
- "For all platforms") { options[:buuf] = true }
41
- opts.on("--pending",
42
- "Shows a different image when there are no errors/failures",
43
- "but there are pending specs. Only for Mac.") { options[:pending] = true }
44
- opts.on("--sticky",
45
- "Keep notification on screen in case of errros/failures or pending specs.",
46
- "Only for Mac.") { options[:sticky] = true }
47
- opts.on("-h", "--help",
48
- "Show this help message.") { stdout.puts opts; exit }
49
- opts.parse!(arguments)
50
-
51
- if mandatory_options && mandatory_options.find { |option| options[option.to_sym].nil? }
52
- stdout.puts opts; exit
53
- end
54
- end
55
-
56
- path = options[:path]
57
-
58
- autotest_path = File.expand_path(path)
59
-
60
- if File.exists?("#{autotest_path}/.autotest")
61
- puts "\nYou Already have a .autotest file, renamed to .autotest.backup"
62
- FileUtils.cp "#{autotest_path}/.autotest", "#{autotest_path}/.autotest.backup"
63
- end
64
-
65
- f = File.new("#{autotest_path}/.autotest", "w")
66
- f.write "# ~.autotest\n"
67
- f.write "require 'autotest_notification'\n"
68
- f.write("SPEAKING = #{options[:speaking]}\n")
69
- f.write("DOOM_EDITION = #{options[:doom]}\n")
70
- f.write("BUUF = #{options[:buuf]}\n")
71
- f.write("PENDING = #{options[:pending]}\n")
72
- f.write("STICKY = #{options[:sticky]}\n")
73
- f.close
74
-
75
- puts "\nAs from now all tests will be notified automatically."
76
- puts "" # a blank line
77
- end
78
- end
79
- end
@@ -1,46 +0,0 @@
1
- require 'optparse'
2
-
3
- module AnUninstall
4
- class CLI
5
- def self.execute(stdout, arguments=[])
6
-
7
- # NOTE: the option -p/--path= is given as an example, and should be replaced in your application.
8
-
9
- options = {
10
- :path => '~'
11
- }
12
- mandatory_options = %w( )
13
-
14
- parser = OptionParser.new do |opts|
15
- opts.banner = <<-BANNER.gsub(/^ /,'')
16
- This application is wonderful because...
17
-
18
- Usage: #{File.basename($0)} [options]
19
-
20
- Options are:
21
- BANNER
22
- opts.separator ""
23
- opts.on("-p", "--path=PATH", String,
24
- "This is a sample message.",
25
- "For multiple lines, add more strings.",
26
- "Default: ~") { |arg| options[:path] = arg }
27
- opts.on("-h", "--help",
28
- "Show this help message.") { stdout.puts opts; exit }
29
- opts.parse!(arguments)
30
-
31
- if mandatory_options && mandatory_options.find { |option| options[option.to_sym].nil? }
32
- stdout.puts opts; exit
33
- end
34
- end
35
-
36
- path = options[:path]
37
-
38
- autotest_file = File.expand_path(path) + "/.autotest"
39
- if File.exist?(autotest_file)
40
- File.delete(autotest_file)
41
- puts "\nYou no longer receive notifications of your tests."
42
- puts "" # a blank line
43
- end
44
- end
45
- end
46
- end
@@ -1,19 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "test_helper.rb")
2
- require 'an_install/cli'
3
-
4
- class TestAnInstallCli < Test::Unit::TestCase
5
- def setup
6
- @stdout_io = StringIO.new
7
- AnInstall::CLI.execute(@stdout_io, [])
8
- @stdout_io.rewind
9
- @stdout = @stdout_io.read
10
- end
11
-
12
- def test_not_print_default_output
13
- assert_no_match(/To update this executable/, @stdout)
14
- end
15
-
16
- # def test_print_successful_message
17
- # assert_match(/As from now all tests will be notified automatically/, @stdout)
18
- # end
19
- end
@@ -1,19 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "test_helper.rb")
2
- require 'an_uninstall/cli'
3
-
4
- class TestAnUninstallCli < Test::Unit::TestCase
5
- def setup
6
- @stdout_io = StringIO.new
7
- AnUninstall::CLI.execute(@stdout_io, [])
8
- @stdout_io.rewind
9
- @stdout = @stdout_io.read
10
- end
11
-
12
- def test_not_print_default_output
13
- assert_no_match(/To update this executable/, @stdout)
14
- end
15
-
16
- # def test_print_successful_message
17
- # assert_match(/You no longer receive notifications of your tests/, @stdout)
18
- # end
19
- end