ak47 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in ak47.gemspec
4
+ gemspec
@@ -0,0 +1,11 @@
1
+ # Ak47
2
+
3
+ Reload anything. Watches the current directory for file changes and restarts your process if anything changes.
4
+
5
+ ## Installation
6
+
7
+ gem install ak47
8
+
9
+ ## Usage
10
+
11
+ ak47 [Your original command]
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "ak47/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "ak47"
7
+ s.version = Ak47::VERSION
8
+ s.authors = ["Josh Hull"]
9
+ s.email = ["joshbuddy@gmail.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{Reload anything}
12
+ s.description = %q{Reload anything.}
13
+
14
+ s.rubyforge_project = "ak47"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency "guard", "~> 0.10.0"
22
+ s.add_dependency "shell_tools", "~> 0.1.0"
23
+ end
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'ak47'
4
+ Ak47.run(*$*)
@@ -0,0 +1,35 @@
1
+ require 'guard'
2
+ require 'shell_tools'
3
+ require "ak47/version"
4
+
5
+ module Ak47
6
+ class << self
7
+ def run(*argv)
8
+ command = ShellTools.escape(argv)
9
+ @listener_exited = true
10
+ raise "No command was given" if command.empty?
11
+ kill_subprocess = proc do
12
+ begin
13
+ Process.kill("INT", @pid) if @pid
14
+ rescue Errno::ESRCH
15
+ end
16
+ end
17
+ trap("INT", &kill_subprocess)
18
+ at_exit(&kill_subprocess)
19
+ listener = Guard::Listener.select_and_init(:watchdir => Dir.pwd, :watch_all_modifications => true)
20
+ listener.on_change {
21
+ @listener_exited = true
22
+ Process.kill("INT", @pid) if @pid
23
+ }
24
+ listener_thread = Thread.new { listener.start }
25
+ listener_thread.abort_on_exception = true
26
+ while @listener_exited do
27
+ @listener_exited = false
28
+ @pid = fork do
29
+ exec(command.to_s)
30
+ end
31
+ Process.waitpid(@pid)
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,3 @@
1
+ module Ak47
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ak47
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Josh Hull
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-01-04 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: guard
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ hash: 55
29
+ segments:
30
+ - 0
31
+ - 10
32
+ - 0
33
+ version: 0.10.0
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: shell_tools
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ hash: 27
45
+ segments:
46
+ - 0
47
+ - 1
48
+ - 0
49
+ version: 0.1.0
50
+ type: :runtime
51
+ version_requirements: *id002
52
+ description: Reload anything.
53
+ email:
54
+ - joshbuddy@gmail.com
55
+ executables:
56
+ - ak47
57
+ extensions: []
58
+
59
+ extra_rdoc_files: []
60
+
61
+ files:
62
+ - .gitignore
63
+ - Gemfile
64
+ - README.md
65
+ - Rakefile
66
+ - ak47.gemspec
67
+ - bin/ak47
68
+ - lib/ak47.rb
69
+ - lib/ak47/version.rb
70
+ homepage: ""
71
+ licenses: []
72
+
73
+ post_install_message:
74
+ rdoc_options: []
75
+
76
+ require_paths:
77
+ - lib
78
+ required_ruby_version: !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ hash: 3
84
+ segments:
85
+ - 0
86
+ version: "0"
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ hash: 3
93
+ segments:
94
+ - 0
95
+ version: "0"
96
+ requirements: []
97
+
98
+ rubyforge_project: ak47
99
+ rubygems_version: 1.8.10
100
+ signing_key:
101
+ specification_version: 3
102
+ summary: Reload anything
103
+ test_files: []
104
+
105
+ has_rdoc: