command_exec 0.1.0 → 0.1.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.
data/.gitignore CHANGED
@@ -50,3 +50,4 @@ tmp/
50
50
  *.pdf
51
51
  !doc/*/*.pdf
52
52
  *.pid
53
+ doc/yard
data/Gemfile CHANGED
@@ -20,4 +20,5 @@ end
20
20
 
21
21
  group :development do
22
22
  gem 'tmrb'
23
+ gem 'activesupport'
23
24
  end
data/Gemfile.lock CHANGED
@@ -12,6 +12,9 @@ GEM
12
12
  Platform (>= 0.4.0)
13
13
  open4
14
14
  Platform (0.4.0)
15
+ activesupport (3.2.6)
16
+ i18n (~> 0.6)
17
+ multi_json (~> 1.0)
15
18
  aruba (0.4.11)
16
19
  childprocess (>= 0.2.3)
17
20
  cucumber (>= 1.1.1)
@@ -34,35 +37,37 @@ GEM
34
37
  ruby-progressbar (~> 0.0.10)
35
38
  gherkin (2.11.1)
36
39
  json (>= 1.4.6)
37
- github-markup (0.7.1)
40
+ github-markup (0.7.4)
41
+ i18n (0.6.0)
38
42
  json (1.7.3)
39
- multi_json (1.1.0)
43
+ multi_json (1.3.6)
40
44
  open4 (1.3.0)
41
45
  rake (0.9.2.2)
42
- redcarpet (1.17.2)
43
- rspec (2.9.0)
44
- rspec-core (~> 2.9.0)
45
- rspec-expectations (~> 2.9.0)
46
- rspec-mocks (~> 2.9.0)
47
- rspec-core (2.9.0)
48
- rspec-expectations (2.9.0)
46
+ redcarpet (2.1.1)
47
+ rspec (2.11.0)
48
+ rspec-core (~> 2.11.0)
49
+ rspec-expectations (~> 2.11.0)
50
+ rspec-mocks (~> 2.11.0)
51
+ rspec-core (2.11.1)
52
+ rspec-expectations (2.11.1)
49
53
  diff-lcs (~> 1.1.3)
50
- rspec-instafail (0.2.2)
51
- rspec-mocks (2.9.0)
54
+ rspec-instafail (0.2.4)
55
+ rspec-mocks (2.11.1)
52
56
  ruby-progressbar (0.0.10)
53
- simplecov (0.6.1)
57
+ simplecov (0.6.4)
54
58
  multi_json (~> 1.0)
55
59
  simplecov-html (~> 0.5.3)
56
60
  simplecov-html (0.5.3)
57
61
  thor (0.15.4)
58
62
  tmrb (1.2.7)
59
63
  thor
60
- yard (0.7.5)
64
+ yard (0.8.2.1)
61
65
 
62
66
  PLATFORMS
63
67
  ruby
64
68
 
65
69
  DEPENDENCIES
70
+ activesupport
66
71
  aruba
67
72
  command_exec!
68
73
  fuubar
data/README.md CHANGED
@@ -19,18 +19,81 @@ command = CommandExec::Command.execute( 'command')
19
19
 
20
20
  #full path to commadn
21
21
  command = CommandExec::Command.execute( 'path/to/command')
22
+ ```
23
+
24
+ ## Options
25
+
26
+ * `:logger`: Logger for output of information
22
27
 
23
- # available options
28
+ ```ruby
24
29
  command = CommandExec::Command.new(
25
30
  'command',
26
31
  :logger => Logger.new($stderr),
32
+ }
33
+ command.run
34
+ ```
35
+
36
+ * `:options`: Commandline options for executed command
37
+
38
+ ```ruby
39
+ command = CommandExec::Command.new(
40
+ 'command',
27
41
  :options => '--command options',
28
- :parameter => 'command parameter',
42
+ }
43
+ command.run
44
+ ```
45
+
46
+ * `error_keywords`: Keywords which indicate error(s)
47
+
48
+ Are there any keywords in stdout of the command which should be executed, which
49
+ indicate errors?
50
+
51
+ ```ruby
52
+ command = CommandExec::Command.new(
53
+ 'command',
29
54
  :error_keywords => ['key words in', 'stdout with indicate errors' ],
55
+ }
56
+ command.run
57
+ ```
58
+
59
+ * `:working_directory`: Change working directory of command
60
+
61
+ Change working directory to given one before command execution.
62
+
63
+ ```ruby
64
+ command = CommandExec::Command.new(
65
+ 'command',
30
66
  :working_directory => 'working/directory/where/the/command/should/be/executed/in',
67
+ }
68
+ command.run
69
+ ```
70
+
71
+ * `logfile`: Logfile of command
72
+
73
+ The first 30 lines of the command-logfile will be output by logger if an error
74
+ occured.
75
+
76
+ ```ruby
77
+ command = CommandExec::Command.new(
78
+ 'command',
79
+ :logfile => 'path/to/logfile.log',
80
+ }
81
+ command.run
82
+ ```
83
+
84
+ * `:log_level`:
85
+
86
+ What should be put to logger? Available choices are :debug, :info, :warn,
87
+ :error, :fatal, :unkonwn, :silent. If you choose :silent nothing will be
88
+ output.
89
+
90
+
91
+ ```ruby
92
+ command = CommandExec::Command.new(
93
+ 'command',
31
94
  :logfile => 'path/to/logfile.log',
32
- :debug => false,
33
- )
95
+ :log_level => :debug
96
+ }
34
97
  command.run
35
98
  ```
36
99
 
data/Rakefile CHANGED
@@ -2,6 +2,7 @@
2
2
  require 'bundler/gem_tasks'
3
3
  require 'yard'
4
4
  require 'rubygems/package_task'
5
+ require 'active_support/core_ext/string/strip'
5
6
 
6
7
  YARD::Rake::YardocTask.new do |t|
7
8
  t.files = ['lib/**/*.rb', 'README.md', 'LICENCE.md']
@@ -22,9 +23,13 @@ namespace :version do
22
23
 
23
24
  new_version = ENV['VERSION']
24
25
 
25
- version_string = %Q{ module DataUri
26
- VERSION = '#{new_version}'
27
- end}
26
+ raw_module_name = File.open(version_file, "r").readlines.grep(/module/).first
27
+ module_name = raw_module_name.chomp.match(/module\s+(\S+)/) {$1}
28
+
29
+ version_string = %Q{#main #{module_name}
30
+ module #{module_name}
31
+ VERSION = '#{new_version}'
32
+ end}
28
33
 
29
34
  File.open(version_file, "w") do |f|
30
35
  f.write version_string.strip_heredoc
@@ -46,4 +51,9 @@ namespace :version do
46
51
  end
47
52
 
48
53
  end
54
+
55
+ task :restore do
56
+ sh "git checkout #{version_file}"
57
+ end
58
+
49
59
  end
@@ -147,7 +147,7 @@ module CommandExec
147
147
  # Read the content of the logfile
148
148
  #
149
149
  # @param [Path] file path to logfile
150
- # @param [Integer num_of_lines the number of lines which should be read -- e.g. 30 lines = -30
150
+ # @param [Integer] num_of_lines the number of lines which should be read -- e.g. 30 lines = -30
151
151
  def read_logfile(file, num_of_lines=-30)
152
152
  content = StringIO.new
153
153
 
@@ -1,3 +1,4 @@
1
+ #main CommandExec
1
2
  module CommandExec
2
- VERSION='0.1.0'
3
- end
3
+ VERSION = '0.1.3'
4
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: command_exec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: