spirit_hands 2.1.10-universal-java-12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.pryrc +1 -0
- data/.ruby-gemset +1 -0
- data/CHANGELOG.md +150 -0
- data/CONTRIBUTING.md +18 -0
- data/CONTRIBUTORS.md +12 -0
- data/Gemfile +3 -0
- data/LICENSE.md +22 -0
- data/README.md +153 -0
- data/Rakefile +128 -0
- data/gem-public_cert.pem +31 -0
- data/lib/spirit_hands.rb +20 -0
- data/lib/spirit_hands/hirb.rb +2 -0
- data/lib/spirit_hands/hirb/fixes.rb +5 -0
- data/lib/spirit_hands/hirb/fixes/enabled.rb +36 -0
- data/lib/spirit_hands/hirb/fixes/pager.rb +157 -0
- data/lib/spirit_hands/hirb/fixes/util.rb +19 -0
- data/lib/spirit_hands/hirb/fixes/view.rb +11 -0
- data/lib/spirit_hands/mattr_accessor_with_default.rb +44 -0
- data/lib/spirit_hands/melody.rb +68 -0
- data/lib/spirit_hands/options.rb +99 -0
- data/lib/spirit_hands/options/color.rb +10 -0
- data/lib/spirit_hands/options/coolline.rb +60 -0
- data/lib/spirit_hands/options/hirb.rb +34 -0
- data/lib/spirit_hands/options/less.rb +2 -0
- data/lib/spirit_hands/options/less/colorize.rb +41 -0
- data/lib/spirit_hands/options/less/show_raw_unicode.rb +36 -0
- data/lib/spirit_hands/print.rb +76 -0
- data/lib/spirit_hands/prompt.rb +12 -0
- data/lib/spirit_hands/prompt/base.rb +25 -0
- data/lib/spirit_hands/prompt/base/render.rb +239 -0
- data/lib/spirit_hands/prompt/main.rb +18 -0
- data/lib/spirit_hands/prompt/multiline.rb +17 -0
- data/lib/spirit_hands/railtie.rb +11 -0
- data/lib/spirit_hands/terminal.rb +16 -0
- data/lib/spirit_hands/version.rb +3 -0
- data/note.txt +2 -0
- data/spirit_hands.gemspec +39 -0
- metadata +202 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 323c4acafe6e2280b1ae9108c1922b7193269a8930cc7c506dd57372b0c25eed
|
4
|
+
data.tar.gz: 3dcfb28de8ecdc02d71c3b4beff75ad91626ae9c6d1d46d66f1c208fb01ff11f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 85f1f25e789e5702c2e760bd9353903848df864eca9cf5d7a62733aa28d4f2c3a8013bac730e7d1df4b4c056a9e0ab0fa2889dfaea20d28910a173b82c5cee1a
|
7
|
+
data.tar.gz: cb506de1340460527a23eca5e868a678227bfacf859bc8661daf2a8f107cb7a743e7735b6372544da0cda83ef3b9bb574579da240eb7d832a92fa6b93a6cb5e6
|
data/.gitignore
ADDED
data/.pryrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'spirit_hands'
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
jazz_fingers
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,150 @@
|
|
1
|
+
## 2.1.0 (2016-11-19)
|
2
|
+
* Remove [pry-remote][pry-remote]
|
3
|
+
|
4
|
+
## 2.0.0 (2015-05-27)
|
5
|
+
* Way more configurable
|
6
|
+
|
7
|
+
## 1.0.0 (2015-02-05)
|
8
|
+
* Downgrade [pry-byebug][pry-byebug] to v1.3.3
|
9
|
+
|
10
|
+
## 0.5.5 (2015-02-03)
|
11
|
+
|
12
|
+
* Update [pry-byebug][pry-byebug] to v2.0.0
|
13
|
+
* Update [awesome_print][awesome_print] to v1.6.1
|
14
|
+
|
15
|
+
## 0.5.4 (2014-11-06)
|
16
|
+
|
17
|
+
* Remove [pry-stack_explorer][pry-stack_explorer]
|
18
|
+
|
19
|
+
## 0.5.3 (2014-11-04)
|
20
|
+
|
21
|
+
* Using [pry-byebug][pry-byebug] to use ruby >= 2.0.0.
|
22
|
+
* Switched [coolline][coolline] with [pry-coolline][pry-coolline]
|
23
|
+
* Upgrade [pry][pry] to 0.10, [pry-doc][pry-doc] to 0.6
|
24
|
+
* Rename to `SpiritHands` to allow releasing.
|
25
|
+
|
26
|
+
## 0.5.2 (2013-10-24)
|
27
|
+
|
28
|
+
* Upgrade [pry-rails][pry-rails] to the latest 0.3.2,
|
29
|
+
[awesome_print][awesome_print] to 1.2 and loosen it's dependency, and removed
|
30
|
+
[coderay][coderay] as an explicit dependency since [pry][pry] already includes
|
31
|
+
it.
|
32
|
+
|
33
|
+
## 0.5.1 (2013-06-28)
|
34
|
+
|
35
|
+
* Upgrade [pry-rails][pry-rails] to the latest 0.3.1, [pry-doc][pry-doc] 0.4.6,
|
36
|
+
[coolline][coolline] 0.4.2.
|
37
|
+
|
38
|
+
|
39
|
+
## 0.5.0 (2013-03-13)
|
40
|
+
|
41
|
+
* Rails 4, Ruby 2.0.0 compatibility.
|
42
|
+
* Upgrade [pry][pry] to the latest 0.9.12,
|
43
|
+
[pry-stack_explorer][pry-stack_explorer] 0.4.9, [pry-remote][pry-remote]
|
44
|
+
0.1.7, [pry-debugger][pry-debugger] 0.2.2, [hirb][hirb] 0.7.1,
|
45
|
+
[coderay][coderay] 1.0.9.
|
46
|
+
|
47
|
+
|
48
|
+
## 0.4.0 (2012-12-27)
|
49
|
+
|
50
|
+
* Add [pry-rails][pry-rails] 0.2.2 for maintained console hooks and new
|
51
|
+
`show-routes`, `show-models`, and `show-middleware` commands.
|
52
|
+
* Add `SpiritHands.colored_prompt` and `SpiritHands.prompt_separator` options.
|
53
|
+
Detect readline library to turn off incompatible colored prompt or Unicode
|
54
|
+
prompt separator where appropriate. Fixes #1 and #2.
|
55
|
+
* Upgrade [pry][pry] to the latest 0.9.10, [pry-doc][pry-doc] 0.4.4,
|
56
|
+
[pry-stack_explorer][pry-stack_explorer] 0.4.7, [pry-remote][pry-remote]
|
57
|
+
0.1.6, [pry-debugger][pry-debugger] 0.2.1, [hirb][hirb] 0.7.0,
|
58
|
+
[Coolline][coolline] 0.4.0, [coderay][coderay] 1.0.8,
|
59
|
+
[awesome_print][awesome_print] 1.1.0. Fixes #4.
|
60
|
+
|
61
|
+
## 0.3.1 (2012-06-11)
|
62
|
+
|
63
|
+
* Upgrade [pry-debugger][pry-debugger] to 0.2.0.
|
64
|
+
|
65
|
+
## 0.3.0 (2012-06-07)
|
66
|
+
|
67
|
+
* Replace [pry-nav][pry-nav] with [pry-debugger][pry-debugger] for improved
|
68
|
+
performance and no segfaults. `SpiritHands.enable_pry_nav` removed.
|
69
|
+
* Upgrade [pry][pry] to the latest 0.9.9, [pry-doc][pry-doc] 0.4.2,
|
70
|
+
[pry-git][pry-git] 0.2.3, [pry-stack_explorer][pry-stack_explorer] 0.4.2,
|
71
|
+
[pry-remote][pry-remote] 0.1.4, [coderay][coderay] 1.0.6.
|
72
|
+
|
73
|
+
## 0.2.0 (2012-03-19)
|
74
|
+
|
75
|
+
* Add [pry-stack_explorer][pry-stack_explorer] 0.4.1.
|
76
|
+
* Upgrade [pry-remote][pry-remote] to 0.1.1 and [pry-nav][pry-nav] to 0.2.0.
|
77
|
+
* Upgrade recommended gem minor versions: [pry][pry] 0.9.8.4, [pry-doc][pry-doc]
|
78
|
+
0.4.1, [hirb][hirb] 0.6.2, and [coderay][coderay] 1.0.5.
|
79
|
+
|
80
|
+
## 0.1.2 (2012-01-23)
|
81
|
+
|
82
|
+
* Improved Rails 3.2 compatibility. Console methods like `app`, `new_session`,
|
83
|
+
`reload!`, `helper`, and `controller` work as expected.
|
84
|
+
|
85
|
+
## 0.1.1 (2012-01-20)
|
86
|
+
|
87
|
+
* Rails 3.2 compatibility
|
88
|
+
|
89
|
+
## 0.1.0 (2012-01-04)
|
90
|
+
|
91
|
+
* For performance, enable [pry-nav][pry-nav] only on MRI 1.9.3 by default. To
|
92
|
+
use on MRI 1.9.2, add `SpiritHands.enable_pry_nav` to a Rails initializer.
|
93
|
+
* Due to buggy behavior, syntax highlighting as you type via
|
94
|
+
[Coolline][coolline] and [Coderay][coderay] is disabled by default. Enable
|
95
|
+
with `SpiritHands.enable_syntax_highlighting_as_you_type` in a Rails
|
96
|
+
initializer. MRI 1.9.3 only.
|
97
|
+
* Fix [Hirb][hirb] support.
|
98
|
+
* Upgrade [awesome_print][awesome_print] to 1.0.2.
|
99
|
+
|
100
|
+
## 0.0.6 (2011-12-03)
|
101
|
+
|
102
|
+
* Add line numbers to the prompt for easy reference when using `_in_` and
|
103
|
+
`_out`.
|
104
|
+
* Upgrade [pry-nav][pry-nav] to 0.0.4.
|
105
|
+
|
106
|
+
|
107
|
+
## 0.0.5 (2011-12-01)
|
108
|
+
|
109
|
+
* Add [Hirb][hirb] support. Enable with `Hirb.enable` in the console.
|
110
|
+
* Upgrade [pry-nav][pry-nav] to 0.0.3.
|
111
|
+
|
112
|
+
|
113
|
+
## 0.0.4 (2011-11-30)
|
114
|
+
|
115
|
+
* Add explicit requires for pry plugin gems.
|
116
|
+
|
117
|
+
|
118
|
+
## 0.0.3 (2011-11-30)
|
119
|
+
|
120
|
+
* Add [pry-nav][pry-nav].
|
121
|
+
* Upgrade [awesome_print][awesome_print] to 1.0.1.
|
122
|
+
|
123
|
+
|
124
|
+
## 0.0.2 (2011-11-25)
|
125
|
+
|
126
|
+
* Add [pry-doc][pry-doc].
|
127
|
+
|
128
|
+
|
129
|
+
## 0.0.1 (2011-11-25)
|
130
|
+
|
131
|
+
* First release. Combine [pry][pry], [awesome_print][awesome_print],
|
132
|
+
[coolline][coolline] + [coderay][coderay], [pry-remote][pry-remote],
|
133
|
+
[pry-git][pry-git]. Bit of glue to replace IRB with pry in Rails console,
|
134
|
+
pretty colors.
|
135
|
+
|
136
|
+
|
137
|
+
[pry]: http://pry.github.com
|
138
|
+
[awesome_print]: https://github.com/michaeldv/awesome_print
|
139
|
+
[pry-doc]: https://github.com/pry/pry-doc
|
140
|
+
[pry-git]: https://github.com/pry/pry-git
|
141
|
+
[pry-nav]: https://github.com/nixme/pry-nav
|
142
|
+
[pry-remote]: https://github.com/Mon-Ouie/pry-remote
|
143
|
+
[coolline]: https://github.com/Mon-Ouie/coolline
|
144
|
+
[pry-coolline]: https://github.com/pry/pry-coolline
|
145
|
+
[coderay]: https://github.com/rubychan/coderay
|
146
|
+
[hirb]: https://github.com/cldwalker/hirb
|
147
|
+
[pry-stack_explorer]: https://github.com/pry/pry-stack_explorer
|
148
|
+
[pry-debugger]: https://github.com/nixme/pry-debugger
|
149
|
+
[pry-rails]: https://github.com/rweng/pry-rails
|
150
|
+
[pry-byebug]: https://github.com/deivid-rodriguez/pry-byebug
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
## Getting Involved
|
2
|
+
|
3
|
+
New contributors are always welcome, when it doubt please ask questions. We strive to be an open and welcoming community. Please be nice to one another.
|
4
|
+
|
5
|
+
### Coding
|
6
|
+
|
7
|
+
* Pick a task:
|
8
|
+
* Offer feedback on open [pull requests](https://github.com/plribeiro3000/spirit_hands/pulls).
|
9
|
+
* Review open [issues](https://github.com/plribeiro3000/spirit_hands/issues) for things to help on.
|
10
|
+
* [Create an issue](https://github.com/plribeiro3000/spirit_hands/issues/new) to start a discussion on additions or features.
|
11
|
+
* Fork the project, add your changes and tests to cover them in a topic branch.
|
12
|
+
* Commit your changes and rebase against `plribeiro3000/spirit_hands` to ensure everything is up to date.
|
13
|
+
* [Submit a pull request](https://github.com/plribeiro3000/spirit_hands/compare/)
|
14
|
+
|
15
|
+
### Non-Coding
|
16
|
+
|
17
|
+
* Offer feedback on open [issues](https://github.com/plribeiro3000/spirit_hands/issues).
|
18
|
+
* Organize or volunteer at events.
|
data/CONTRIBUTORS.md
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# Current Maintainers
|
2
|
+
* Barry Allard <barry.allard@gmail.com>
|
3
|
+
|
4
|
+
# Original Author
|
5
|
+
* Gopal Patel <nixme@stillhope.com>
|
6
|
+
|
7
|
+
# Past Contributors
|
8
|
+
* Andrew Volozhanin <linuxheadrus@gmail.com>
|
9
|
+
* Casey Lang <hello@casey-lang.com>
|
10
|
+
* Fernando Paredes <nano@fdp.io>
|
11
|
+
* Micah Gates <github@mgates.com>
|
12
|
+
* Paulo Henrique Lopes Ribeiro <plribeiro3000@gmail.com>
|
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014-2015 [**Contributors**](Contributors)
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
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, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
[Contributors]: https://raw.githubusercontent.com/steakknife/spirit_hands/master/CONTRIBUTORS.md
|
data/README.md
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
# Spirit Hands
|
2
|
+
|
3
|
+
This repo is an improved fork with real configuration syntax, with updates and bug fixes based on [`jazz_hands`](https://github.com/nixme/jazz_hands).
|
4
|
+
|
5
|
+
Spending hours in the rails console? Spruce it up and show off those
|
6
|
+
hard-working hands!
|
7
|
+
|
8
|
+
**spirit_hands** is an opinionated set of console-related gems and a bit of glue:
|
9
|
+
|
10
|
+
* [**Pry**][pry] for a powerful shell alternative to IRB.
|
11
|
+
* [**Awesome Print**][awesome_print] for stylish pretty print.
|
12
|
+
* [**Hirb**][hirb] for tabular collection output.
|
13
|
+
* [**Hirb Unicode**][hirb-unicode-steakknife] for aligned Unicode output.
|
14
|
+
* [**Pry Rails**][pry-rails] for additional commands (`show-routes`,
|
15
|
+
`show-models`, `show-middleware`) in the Rails console.
|
16
|
+
* [**Pry Doc**][pry-doc] to browse Ruby source, including C, directly from the
|
17
|
+
console.
|
18
|
+
commits on methods and classes, not just files. (non-JRuby only)
|
19
|
+
* [**Pry Remote**][pry-remote] to connect remotely to a Pry console.
|
20
|
+
* [**Pry Coolline**][pry-coolline] for syntax highlighting as you type.
|
21
|
+
* **Debugging** (`next`, `step`, ...): Ruby (MRI) [**Pry Byebug**][pry-byebug], JRuby [**Pry Nav**][pry-nav].
|
22
|
+
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
### Rails or Ruby Project Integration
|
27
|
+
|
28
|
+
Ruby 2.0.0+, Rails 3, 4, 5 or 6 Ruby project, add this to your project Gemfile:
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
group :development, :test do
|
32
|
+
gem 'spirit_hands'
|
33
|
+
end
|
34
|
+
```
|
35
|
+
|
36
|
+
### Global usage
|
37
|
+
`[sudo] gem install spirit_hands`
|
38
|
+
|
39
|
+
That's it. Run `rails console` as usual.
|
40
|
+
|
41
|
+
Ruby compiled against a proper readline library, ideally GNU readline, is
|
42
|
+
recommended. Alternatively, [`gem install rb-readline`][rb-readline] for an
|
43
|
+
acceptible backup. Using ruby compiled against a `libedit` wrapper (primarily OS
|
44
|
+
X) will work but is not recommended.
|
45
|
+
|
46
|
+
|
47
|
+
## Options
|
48
|
+
|
49
|
+
Change the following options by creating a .pryrc in your Rails or Ruby project
|
50
|
+
|
51
|
+
### Example `.pryrc`
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
begin
|
55
|
+
require 'spirit_hands'
|
56
|
+
SpiritHands.colored_prompt = false
|
57
|
+
SpiritHands.hirb = false
|
58
|
+
rescue LoadError => e
|
59
|
+
raise unless e.message =~ /.*such file.*spirit_hands/
|
60
|
+
puts 'no SpiritHands'
|
61
|
+
end
|
62
|
+
```
|
63
|
+
|
64
|
+
### `awesome_print`
|
65
|
+
|
66
|
+
[**AwesomePrint**][awesome_print] is enabled by default.
|
67
|
+
`SpiritHands.awesome_print = false` to disable.
|
68
|
+
|
69
|
+
### `color`
|
70
|
+
|
71
|
+
An alias for getting and setting `Pry.color`
|
72
|
+
|
73
|
+
### `colored_prompt`
|
74
|
+
|
75
|
+
Color the console prompt? Defaults to `true` when the current ruby is compiled
|
76
|
+
against GNU readline or `rb-readline`, which don't have issues counting
|
77
|
+
characters in colored prompts. `false` for libedit.
|
78
|
+
|
79
|
+
**Note:** `Pry.color = false` trumps this setting and disables all console coloring.
|
80
|
+
|
81
|
+
### `coolline`
|
82
|
+
|
83
|
+
Control whether pry-coolline is activated.
|
84
|
+
|
85
|
+
~~Cooline is **enabled** by default.~~
|
86
|
+
|
87
|
+
**NOTE** Pry-coolline is *currently disabled* by default because it doesn't support full Readline Vi and Emacs emulation. If you really want live syntax highlighting anyhow without full Readline support, specify `SpiritHands.coolline=true` in `~/.pryrc` after `require 'spirit_hands'`. Also, consider contributing a coolline/pry-coolline PR/fork if you must have this functionality.
|
88
|
+
|
89
|
+
### `hirb`
|
90
|
+
[**Hirb**][hirb] is **enabled** by default.
|
91
|
+
`SpiritHands.hirb = false` to disable.
|
92
|
+
|
93
|
+
### `hirb_unicode`
|
94
|
+
[**Hirb-unicode**][hirb-unicode-steakknife] is enabled by default when hirb is enabled.
|
95
|
+
`SpiritHands.hirb_unicode = false` to disable.
|
96
|
+
No effect when hirb is disabled.
|
97
|
+
|
98
|
+
|
99
|
+
### `prompt`
|
100
|
+
|
101
|
+
#### Pseudo-XML-like Syntax as follows
|
102
|
+
|
103
|
+
```
|
104
|
+
current command number <cmd/>
|
105
|
+
app name <app/>
|
106
|
+
|
107
|
+
literal less-than < \< ( "\\<" in Ruby strings )
|
108
|
+
bold <bold>....<bold>
|
109
|
+
|
110
|
+
Foreground color:
|
111
|
+
|
112
|
+
black <black>...</black>
|
113
|
+
and red green yellow blue magenta cyan white
|
114
|
+
|
115
|
+
Background color:
|
116
|
+
|
117
|
+
bgblack bgred bggreen bgyellow bgblue bgmagenta bgcyan bgwhite
|
118
|
+
|
119
|
+
Even the frightening blink tag, where available <blink>...</blink>
|
120
|
+
|
121
|
+
More at: SpiritHands::Prompt::Render::MATCHED_TAG_CODES.keys
|
122
|
+
|
123
|
+
```
|
124
|
+
|
125
|
+
### `prompt_separator`
|
126
|
+
|
127
|
+
Separator string between the application name and line input. Defaults to `»`
|
128
|
+
for GNU readline or libedit. Defaults to `>` for `rb-readline` which fails on
|
129
|
+
mixed encodings.
|
130
|
+
|
131
|
+
|
132
|
+
[pry]: http://pry.github.com
|
133
|
+
[awesome_print]: https://github.com/michaeldv/awesome_print
|
134
|
+
[hirb]: https://github.com/cldwalker/hirb
|
135
|
+
[hirb-unicode-steakknife]: https://github.com/steakknife/hirb-unicode
|
136
|
+
[pry-rails]: https://github.com/rweng/pry-rails
|
137
|
+
[pry-doc]: https://github.com/pry/pry-doc
|
138
|
+
[pry-remote]: https://github.com/Mon-Ouie/pry-remote
|
139
|
+
[pry-coolline]: https://github.com/pry/pry-coolline
|
140
|
+
[coderay]: https://github.com/rubychan/coderay
|
141
|
+
[rb-readline]: https://github.com/luislavena/rb-readline
|
142
|
+
[pullrequests]: https://github.com/steakknife/spirit_hands/pulls
|
143
|
+
[issues]: https://github.com/steakknife/spirit_hands/issues
|
144
|
+
[changelog]: https://github.com/steakknife/spirit_hands/blob/master/CHANGELOG.md
|
145
|
+
[pry-nav]: https://github.com/nixme/pry-nav
|
146
|
+
[pry-byebug]: https://github.com/deivid-rodriguez/pry-byebug
|
147
|
+
|
148
|
+
### Security
|
149
|
+
|
150
|
+
```
|
151
|
+
$ gem cert --add <(curl -Ls https://raw.githubusercontent.com/steakknife/spirit_hands/master/gem-public_cert.pem)
|
152
|
+
$ gem install spirit_hands -P MediumSecurity
|
153
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
|
5
|
+
require 'shellwords'
|
6
|
+
|
7
|
+
def gemspec_file
|
8
|
+
@gemspec_file ||= Dir['*.gemspec'].first
|
9
|
+
end
|
10
|
+
|
11
|
+
def gemspec
|
12
|
+
@gemspec ||= Gem::Specification::load(gemspec_file)
|
13
|
+
end
|
14
|
+
|
15
|
+
def version
|
16
|
+
gemspec.version
|
17
|
+
end
|
18
|
+
|
19
|
+
def name
|
20
|
+
gemspec.name
|
21
|
+
end
|
22
|
+
|
23
|
+
def platform
|
24
|
+
gemspec.platform
|
25
|
+
end
|
26
|
+
|
27
|
+
# output .gem filename, per platform
|
28
|
+
def gem_file(platform)
|
29
|
+
r = "#{name}-#{version}"
|
30
|
+
plat_suffix = "-#{platform}" unless platform == 'ruby'
|
31
|
+
r + '.gem'
|
32
|
+
end
|
33
|
+
|
34
|
+
def git_dirty?
|
35
|
+
r = `git diff --shortstat`.chop != ''
|
36
|
+
fail unless $?.success?
|
37
|
+
r
|
38
|
+
end
|
39
|
+
|
40
|
+
def assert_git_clean
|
41
|
+
raise 'Git working directory must be clean before continuing' if git_dirty?
|
42
|
+
end
|
43
|
+
|
44
|
+
def assert_gem_is_signed(gem)
|
45
|
+
files = `tar tf #{gem}`.split("\n")
|
46
|
+
fail "#{gem} bad" unless $?.success?
|
47
|
+
signed_files = %w[metadata data checksums.yaml].map { |x| "#{x}.gz.sig" }
|
48
|
+
missing_files = files - signed_files
|
49
|
+
fail "#{gem} is unsigned, check gem-public_cert.pem" if !missing_files.empty?
|
50
|
+
end
|
51
|
+
|
52
|
+
### release ruby gem
|
53
|
+
|
54
|
+
desc 'make the current git commit into a tag equal the current version.rb'
|
55
|
+
task :tag do
|
56
|
+
assert_git_clean
|
57
|
+
return if `git tag --points-at HEAD`.split("\n").map(&:strip).include?(version)
|
58
|
+
sh "git tag -s #{version} -m #{version}"
|
59
|
+
sh "git push --tags origin master"
|
60
|
+
end
|
61
|
+
|
62
|
+
desc 'before any release(s)'
|
63
|
+
task :prerelease => [:tag]
|
64
|
+
|
65
|
+
def gem_build(chruby_engine)
|
66
|
+
rubies_dir = ENV['RUBIES_ROOT'] || '/opt/rubies'
|
67
|
+
rubies = Dir[File.join(rubies_dir, '*')]
|
68
|
+
rubies_escaped = rubies.map { |rb| Shellwords.escape rb }.join(' ')
|
69
|
+
sh "chruby-exec RUBIES=(#{rubies_escaped}) #{chruby_engine} -- gem build #{gemspec_file}"
|
70
|
+
end
|
71
|
+
|
72
|
+
desc 'release JRuby gem'
|
73
|
+
task 'release-jruby' do #=> :prerelease do
|
74
|
+
gem_build('jruby')
|
75
|
+
gem = gem_file('java')
|
76
|
+
assert_gem_is_signed(gem)
|
77
|
+
sh "gem push #{gem}"
|
78
|
+
end
|
79
|
+
|
80
|
+
desc 'release Ruby gem'
|
81
|
+
task 'release-ruby' => :prerelease do
|
82
|
+
gem_build('ruby-2')
|
83
|
+
gem = gem_file('ruby')
|
84
|
+
assert_gem_is_signed(gem)
|
85
|
+
sh "gem push #{gem}"
|
86
|
+
end
|
87
|
+
|
88
|
+
desc 'release all gems'
|
89
|
+
task :release => ['release-ruby', 'release-jruby']
|
90
|
+
|
91
|
+
|
92
|
+
## version bumping
|
93
|
+
|
94
|
+
def bump(idx)
|
95
|
+
assert_git_clean
|
96
|
+
|
97
|
+
old_version = version.to_s
|
98
|
+
v = old_version.split('.').map(&:to_i)
|
99
|
+
v[idx] += 1
|
100
|
+
(v.size-idx-1).times { |i| v[idx+1+i] = 0 }
|
101
|
+
new_version = v.map(&:to_s).join('.')
|
102
|
+
|
103
|
+
version_file = 'lib/spirit_hands/version.rb'
|
104
|
+
sh "sed -i'' -e 's/#{old_version}/#{new_version}/' #{version_file}"
|
105
|
+
sh "git add #{version_file}"
|
106
|
+
sh "git commit -sS -m 'bump to #{new_version}'"
|
107
|
+
sh "git push --tags origin master"
|
108
|
+
end
|
109
|
+
|
110
|
+
desc 'bump release version'
|
111
|
+
task :bump do
|
112
|
+
bump 2
|
113
|
+
end
|
114
|
+
|
115
|
+
desc 'bump minor version'
|
116
|
+
task 'bump:minor' do
|
117
|
+
bump 1
|
118
|
+
end
|
119
|
+
|
120
|
+
desc 'bump major version'
|
121
|
+
task 'bump:major' do
|
122
|
+
bump 0
|
123
|
+
end
|
124
|
+
|
125
|
+
desc 'show version'
|
126
|
+
task :version do
|
127
|
+
puts version
|
128
|
+
end
|