aid 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.rspec +1 -0
- data/CHANGELOG.md +7 -0
- data/README.md +5 -5
- data/lib/aid/inheritable.rb +1 -1
- data/lib/aid/script.rb +4 -0
- data/lib/aid/scripts/doctor.rb +95 -0
- data/lib/aid/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e7ddbdb9940084ffb7cb80cc7a8bab11b55be7e
|
4
|
+
data.tar.gz: cd4394ea900d7f0e998d61122020f7e7a3465e4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3084b847b65d7fcedbd37f13fa823146f256191bc377943aaac33f70959fdf7416f9cf058586dbcaa346ac66f191448b921add091abd33c641de3abb1bb93628
|
7
|
+
data.tar.gz: 9df4181994fa6316fc18f2d0ab08a1da73b380ed52463fb4a807cfd709c23236eba58baf632953c0214b6760d64442b07bfcd880ab58279fd7b86d4d60c31f21
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# Aid
|
2
2
|
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/aid`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
4
|
|
5
5
|
TODO: Delete this and the text above, and describe your gem
|
6
6
|
|
@@ -9,7 +9,7 @@ TODO: Delete this and the text above, and describe your gem
|
|
9
9
|
Add this line to your application's Gemfile:
|
10
10
|
|
11
11
|
```ruby
|
12
|
-
gem '
|
12
|
+
gem 'aid'
|
13
13
|
```
|
14
14
|
|
15
15
|
And then execute:
|
@@ -18,7 +18,7 @@ And then execute:
|
|
18
18
|
|
19
19
|
Or install it yourself as:
|
20
20
|
|
21
|
-
$ gem install
|
21
|
+
$ gem install aid
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
@@ -32,7 +32,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
32
|
|
33
33
|
## Contributing
|
34
34
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/dbalatero/
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/dbalatero/aid.
|
36
36
|
|
37
37
|
## License
|
38
38
|
|
data/lib/aid/inheritable.rb
CHANGED
data/lib/aid/script.rb
CHANGED
@@ -0,0 +1,95 @@
|
|
1
|
+
module Aid
|
2
|
+
module Scripts
|
3
|
+
class Doctor < Aid::Script
|
4
|
+
class Check
|
5
|
+
include Aid::Colorize
|
6
|
+
|
7
|
+
attr_reader :name, :command, :remedy, :problems
|
8
|
+
|
9
|
+
def initialize(name:, command:, remedy:)
|
10
|
+
@name = name
|
11
|
+
@command = command
|
12
|
+
@remedy = remedy
|
13
|
+
@problems = []
|
14
|
+
end
|
15
|
+
|
16
|
+
def run!
|
17
|
+
print "Checking: #{name}... "
|
18
|
+
|
19
|
+
success = if command.respond_to?(:call)
|
20
|
+
command.call
|
21
|
+
else
|
22
|
+
system "#{command} > /dev/null 2>&1"
|
23
|
+
end
|
24
|
+
|
25
|
+
if success
|
26
|
+
puts 'OK'
|
27
|
+
else
|
28
|
+
print colorize(:error, 'F')
|
29
|
+
fix = remedy.respond_to?(:join) ? remedy.join(" ") : remedy
|
30
|
+
puts "\n To fix: #{colorize(:command, fix)}\n\n"
|
31
|
+
|
32
|
+
problems << name
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.description
|
38
|
+
"Checks the health of your development environment"
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.help
|
42
|
+
"doctor - helps you diagnose any setup issues with this application"
|
43
|
+
end
|
44
|
+
|
45
|
+
def initialize(*args)
|
46
|
+
super
|
47
|
+
@checks = []
|
48
|
+
end
|
49
|
+
|
50
|
+
def check(**options)
|
51
|
+
check = Check.new(options)
|
52
|
+
@checks << check
|
53
|
+
|
54
|
+
check.run!
|
55
|
+
end
|
56
|
+
|
57
|
+
def run
|
58
|
+
puts <<~HELP
|
59
|
+
To implement this script for your repository, create the following
|
60
|
+
file in #{colorize(:green, "#{aid_directory}/doctor.rb")}:
|
61
|
+
|
62
|
+
class Doctor < Aid::Scripts::Doctor
|
63
|
+
def run
|
64
|
+
check_phantomjs_installed
|
65
|
+
end
|
66
|
+
|
67
|
+
private
|
68
|
+
|
69
|
+
def check_phantomjs_installed
|
70
|
+
check name: "PhantomJS installed",
|
71
|
+
command: "which phantomjs",
|
72
|
+
remedy: command("brew install phantomjs")
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
You can add as many checks to your script as you want.
|
77
|
+
HELP
|
78
|
+
|
79
|
+
exit
|
80
|
+
end
|
81
|
+
|
82
|
+
def problems
|
83
|
+
@checks.map(&:problems).flatten
|
84
|
+
end
|
85
|
+
|
86
|
+
def exit_code
|
87
|
+
problems.size
|
88
|
+
end
|
89
|
+
|
90
|
+
def command(s)
|
91
|
+
"run #{colorize :command, s}"
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
data/lib/aid/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Balatero
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -63,6 +63,7 @@ files:
|
|
63
63
|
- ".gitignore"
|
64
64
|
- ".rspec"
|
65
65
|
- ".travis.yml"
|
66
|
+
- CHANGELOG.md
|
66
67
|
- Gemfile
|
67
68
|
- LICENSE.txt
|
68
69
|
- README.md
|
@@ -76,6 +77,7 @@ files:
|
|
76
77
|
- lib/aid/inheritable.rb
|
77
78
|
- lib/aid/script.rb
|
78
79
|
- lib/aid/scripts.rb
|
80
|
+
- lib/aid/scripts/doctor.rb
|
79
81
|
- lib/aid/scripts/help.rb
|
80
82
|
- lib/aid/scripts/init.rb
|
81
83
|
- lib/aid/scripts/new.rb
|