rubymon 0.0.10

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.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/bin/rubymon +18 -0
  3. data/lib/rubymon.rb +59 -0
  4. metadata +62 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5cd53d0bf9c33377b87768ef653c7e1be294ef2c
4
+ data.tar.gz: 192302e7ef5560b259a924470d97b3fa874ddad5
5
+ SHA512:
6
+ metadata.gz: d84721595264092f58f62efa801434b1c5bb0c8d816c55057099c0bb0fab2a21d00b131509c923e01fc53c8d98f6faf33762cf2f9cda8809f6a485dc36087636
7
+ data.tar.gz: c006b82a8b68202bedad3956321c663d89afa011eba28c30963b6c25474ea54a5b3c142852d570764260926bb5db3669c8ce44ab7468f0d7329c694c1fc3c5b7
data/bin/rubymon ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # bin/rubymon
3
+ require_relative '../lib/rubymon.rb'
4
+ require 'listen'
5
+
6
+ if ARGV[0].to_s.include?("f")
7
+ puts "Input filename ..."
8
+ path = STDIN.gets.chomp
9
+
10
+ while File.file?(path) == false
11
+ puts "File not existing ..."
12
+ path = STDIN.gets.chomp
13
+ end
14
+
15
+ Rubymon.file(path)
16
+ else
17
+ Rubymon.dir
18
+ end
data/lib/rubymon.rb ADDED
@@ -0,0 +1,59 @@
1
+ class Rubymon
2
+
3
+ def self.dir
4
+ begin
5
+ puts "Can't run RubyMon in the home directory. Exiting ..." if Dir.pwd == Dir.home
6
+ exit if Dir.pwd == Dir.home
7
+
8
+ puts "Listening to directory: #{Dir.pwd} ..."
9
+
10
+ listener = Listen.to(Dir.pwd, only: /\.rb$/) { |modified|
11
+ if modified.join("").include?(".rb")
12
+ puts "RubyMon executing file #{modified.join("")} ..."
13
+ puts "************************\n"
14
+ system("ruby #{modified.join("")}")
15
+ puts "************************"
16
+ puts "End of file ..."
17
+ end
18
+ }
19
+ listener.start
20
+ sleep
21
+ rescue SystemExit, Interrupt => e
22
+ puts "Exited program using CTRL + C"
23
+ end
24
+ end
25
+
26
+ def self.file path
27
+ begin
28
+ puts "Can't run RubyMon in the home directory. Exiting ..." if Dir.pwd == Dir.home
29
+ exit if Dir.pwd == Dir.home
30
+
31
+
32
+ @path = path
33
+
34
+ puts "#{Dir.pwd}/#{@path}"
35
+
36
+
37
+ #if auto_execute == false
38
+ #puts "Do you want to run the modified file #{modified}? (y/n)"
39
+ #run_file = STDIN.gets.chomp
40
+ puts "Listening to file: #{Dir.pwd}/#{@path} ..."
41
+
42
+ listener = Listen.to(Dir.pwd) { |modified|
43
+ if modified.join("") == @path
44
+ puts "RubyMon executing file #{modified.join("")} .."
45
+ puts "************************\n"
46
+ system("ruby #{modified.join("")}")
47
+ puts "************************"
48
+ puts "End of file ..."
49
+ end
50
+ }
51
+ listener.start
52
+ sleep
53
+ rescue SystemExit, Interrupt => e
54
+ puts "Exited program using CTRL + C"
55
+ end
56
+ end
57
+ rescue Exception => e
58
+ puts "Error: #{e}"
59
+ end
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubymon
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.10
5
+ platform: ruby
6
+ authors:
7
+ - Nick
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-06-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: listen
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.1.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.1.0
27
+ description: 'RubyMon automatically reruns your ruby file when changes are made. Simply
28
+ switch to your working directory and type ''rubymon'' into the command line. To
29
+ explicitly listen to a single file use: ''rubymon file''.'
30
+ email:
31
+ executables:
32
+ - rubymon
33
+ extensions: []
34
+ extra_rdoc_files: []
35
+ files:
36
+ - bin/rubymon
37
+ - lib/rubymon.rb
38
+ homepage: http://rubygems.org/gems/rubymon
39
+ licenses:
40
+ - MIT
41
+ metadata: {}
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - "~>"
49
+ - !ruby/object:Gem::Version
50
+ version: '2.0'
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ requirements: []
57
+ rubyforge_project:
58
+ rubygems_version: 2.6.12
59
+ signing_key:
60
+ specification_version: 4
61
+ summary: RubyMon - Restart gems.
62
+ test_files: []