binrb 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/exe/bin.rb +43 -9
- data/lib/binrb/version.rb +1 -1
- metadata +1 -3
- data/LICENSE.txt +0 -21
- data/README.md +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6a1939b1cc2e667aeb963323030bd3dbfa461999ae82febebb8506c8ae89d1d
|
4
|
+
data.tar.gz: e0c28544e5c96d348d9e4d5edb04ddc9f669b0e231c5432eebbdf2c605f2537d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9665d396f9a39ead255d01a80af9e911ce9f5f8ee72c3ac4983b387bbc02dd29489e9ba0078f3db45fb779c68721615324546b14fa3d1ad533946ba01b8ddfc
|
7
|
+
data.tar.gz: 8690ca79e5cc4e9385de9ea899749deee515d539f7618092b0d555f88c8b1b397f58730e15fd9b466bd5ed291cd83fa70c7d5de6f57b8554d8b0273bee73edbb
|
data/Gemfile.lock
CHANGED
data/exe/bin.rb
CHANGED
@@ -1,6 +1,34 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
3
|
+
class << ((bin = Struct.new(:rb).new).rb = Object.new)
|
4
|
+
def do_stuff
|
5
|
+
complain_unless_argv
|
6
|
+
open_in_editor if already_a_thing?
|
7
|
+
|
8
|
+
write_skeleton
|
9
|
+
make_executable
|
10
|
+
open_in_editor
|
11
|
+
end
|
12
|
+
|
13
|
+
def complain_unless_argv
|
14
|
+
(puts "!ARGV.first"; abort) unless name_of_bin
|
15
|
+
end
|
16
|
+
|
17
|
+
def open_in_editor
|
18
|
+
exec("vim #{path}")
|
19
|
+
end
|
20
|
+
|
21
|
+
def make_executable
|
22
|
+
exec("chmod +x #{path}")
|
23
|
+
end
|
24
|
+
|
25
|
+
def already_a_thing?
|
26
|
+
File.exist? path
|
27
|
+
end
|
28
|
+
|
29
|
+
def write_skeleton
|
30
|
+
File.write(path,
|
31
|
+
<<-SKELETON
|
4
32
|
#!/usr/bin/env ruby
|
5
33
|
require "fileutils"
|
6
34
|
require "open-uri"
|
@@ -8,15 +36,21 @@ require "pry"
|
|
8
36
|
|
9
37
|
binding.pry
|
10
38
|
SKELETON
|
39
|
+
)
|
40
|
+
end
|
11
41
|
|
12
|
-
|
42
|
+
def path
|
43
|
+
@path ||= File.expand_path("~/bin/#{name_of_bin}")
|
44
|
+
end
|
13
45
|
|
14
|
-
|
46
|
+
def fake
|
47
|
+
@name_of_bin = '123.fake.sasdftree'
|
48
|
+
self
|
49
|
+
end
|
15
50
|
|
16
|
-
|
51
|
+
def name_of_bin
|
52
|
+
@name_of_bin ||= ARGV.first
|
53
|
+
end
|
54
|
+
end
|
17
55
|
|
18
|
-
|
19
|
-
|
20
|
-
File.write(path, skeleton)
|
21
|
-
|
22
|
-
exec("chmod +x #{path}; vi #{path}")
|
56
|
+
bin.rb.do_stuff
|
data/lib/binrb/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: binrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- andydna
|
@@ -23,8 +23,6 @@ files:
|
|
23
23
|
- ".travis.yml"
|
24
24
|
- Gemfile
|
25
25
|
- Gemfile.lock
|
26
|
-
- LICENSE.txt
|
27
|
-
- README.md
|
28
26
|
- Rakefile
|
29
27
|
- bin/console
|
30
28
|
- bin/setup
|
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2020 andydna
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
data/README.md
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
# Binrb
|
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/binrb`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
|
-
|
7
|
-
## Installation
|
8
|
-
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
gem 'binrb'
|
13
|
-
```
|
14
|
-
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle install
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install binrb
|
22
|
-
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
TODO: Write usage instructions here
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
-
|
33
|
-
## Contributing
|
34
|
-
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/binrb.
|
36
|
-
|
37
|
-
|
38
|
-
## License
|
39
|
-
|
40
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|