shack 0.0.1 → 0.0.2
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +9 -0
- data/README.md +6 -0
- data/checksum/shack-0.0.2.sha512 +1 -0
- data/lib/shack/stamp.rb +6 -3
- data/lib/shack/version.rb +1 -1
- data/test/stamp_test.rb +6 -0
- metadata +5 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 742702322489166db2ac3b9dcc3c3d334ace1f34
|
4
|
+
data.tar.gz: a83c87895d35d86b00c91e34c7a85786c98250c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 184537f683380acacda210696328e5999771be90da3b69d9fd671a03e6639769955c28b2b39f8bf600c0382f98eb5d1d1e01b92e560763887be0db4a12159b84
|
7
|
+
data.tar.gz: b01ba9567034c0e0f5a237be0012a0054f11c32fef56133ca8094a0006c02d9898aa07976bdb6c08a89d0f2f9c0c3fed280501ce4ab9fcbcd9b0d42fd9a6ef31
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -67,6 +67,8 @@ Shack::Middleware.configure do |shack|
|
|
67
67
|
end
|
68
68
|
```
|
69
69
|
|
70
|
+
There is also a `{{short_sha}}` substition available, which returns the first 8 chars of the set `sha`.
|
71
|
+
|
70
72
|
## How do I set the sha?
|
71
73
|
|
72
74
|
Either write it to a `REVISION` file on deploy (Capistrano used to this by default, now you can [add a task](https://github.com/capistrano/capistrano/pull/757), in `mina` I'm waiting on this [pull request](https://github.com/mina-deploy/mina/pull/260)), or set an `ENV` variable containing the sha.
|
@@ -81,6 +83,10 @@ Now you can set the sha in the configure block.
|
|
81
83
|
2. Add `gem cert –add pjaspers.pem`
|
82
84
|
3. gem install shack -P HighSecurity
|
83
85
|
|
86
|
+
## I don't use Rubies
|
87
|
+
|
88
|
+
For the PHP-inclined, [here](https://github.com/turanct/shack) is a PHP version by [@tinydroptest2](https://twitter.com/tinydroptest2).
|
89
|
+
|
84
90
|
## Contributing
|
85
91
|
|
86
92
|
0. Fork it ( https://github.com/pjaspers/shack/fork )
|
@@ -0,0 +1 @@
|
|
1
|
+
26eaf95ee4efb0b488ead4f0d3867987b23958545f8f046e9fa5a23d0741cb58e8c813bd543793277df4e5bbedbdf30b73dfc178551652e0f371d1ea8c620e4a
|
data/lib/shack/stamp.rb
CHANGED
@@ -6,7 +6,8 @@ module Shack
|
|
6
6
|
# content - gets added to view
|
7
7
|
def initialize(body, sha, custom_content = nil)
|
8
8
|
@body = body
|
9
|
-
@sha = sha
|
9
|
+
@sha = sha || ""
|
10
|
+
@short_sha = @sha[0..8]
|
10
11
|
@custom_content = custom_content if custom_content
|
11
12
|
end
|
12
13
|
|
@@ -21,7 +22,9 @@ module Shack
|
|
21
22
|
|
22
23
|
def content
|
23
24
|
if @custom_content
|
24
|
-
@custom_content.gsub("{{sha}}", @sha)
|
25
|
+
c = @custom_content.gsub("{{sha}}", @sha)
|
26
|
+
c.gsub!("{{short_sha}}", @short_sha)
|
27
|
+
c
|
25
28
|
else
|
26
29
|
@sha
|
27
30
|
end
|
@@ -29,7 +32,7 @@ module Shack
|
|
29
32
|
|
30
33
|
def html
|
31
34
|
<<HTML
|
32
|
-
<div id="sha-stamp" style="position: fixed; bottom: 0; right: 0; height: 16px; background: rgb(0, 0, 0) transparent; background-color: rgba(0, 0, 0, 0.2); padding: 0 5px; border-top-left-radius: 5px;">
|
35
|
+
<div id="sha-stamp" style="position: fixed; bottom: 0; right: 0; height: 16px; background: rgb(0, 0, 0) transparent; background-color: rgba(0, 0, 0, 0.2); padding: 0 5px; border-top-left-radius: 5px; z-index: 2147483647; font-size: 12px;">
|
33
36
|
<span style="text-align: center;">
|
34
37
|
<small style="color: white; font-weight: normal;font-size: 12px;">#{content}</small>
|
35
38
|
</span>
|
data/lib/shack/version.rb
CHANGED
data/test/stamp_test.rb
CHANGED
@@ -31,5 +31,11 @@ describe Shack::Stamp do
|
|
31
31
|
s = Shack::Stamp.new("<html><body></body></html>", "Jack Vincennes", "Rollo Tomassi said {{sha}}")
|
32
32
|
assert_match(/Rollo Tomassi said Jack Vincennes/, s.result)
|
33
33
|
end
|
34
|
+
|
35
|
+
it "uses short sha in custom_content if wanted" do
|
36
|
+
s = Shack::Stamp.new("<html><body></body></html>", "Jack Vincennes", "Rollo Tomassi said {{short_sha}}")
|
37
|
+
assert_match(/Rollo Tomassi said Jack Vi/, s.result)
|
38
|
+
refute_match(/Jack Vincennes/, s.result)
|
39
|
+
end
|
34
40
|
end
|
35
41
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shack
|
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
|
- pjaspers
|
@@ -28,7 +28,7 @@ cert_chain:
|
|
28
28
|
CuJWUOdBRsHbSraLW8n/vc/fZGqVzDAghs26bxmwicw+4/VgO2soYka81t8pUuG6
|
29
29
|
vLWWrtmIv8+cmMgvltP5AR5j2oYHYPPA9YFXuO9t1JVqJiNHm9JNRseEoBc=
|
30
30
|
-----END CERTIFICATE-----
|
31
|
-
date:
|
31
|
+
date: 2015-02-01 00:00:00.000000000 Z
|
32
32
|
dependencies:
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: bundler
|
@@ -53,12 +53,14 @@ extra_rdoc_files: []
|
|
53
53
|
files:
|
54
54
|
- ".gitignore"
|
55
55
|
- ".travis.yml"
|
56
|
+
- CHANGELOG.md
|
56
57
|
- Gemfile
|
57
58
|
- LICENSE.txt
|
58
59
|
- README.md
|
59
60
|
- Rakefile
|
60
61
|
- certs/pjaspers.pem
|
61
62
|
- checksum/shack-0.0.1.sha512
|
63
|
+
- checksum/shack-0.0.2.sha512
|
62
64
|
- lib/shack.rb
|
63
65
|
- lib/shack/middleware.rb
|
64
66
|
- lib/shack/railtie.rb
|
@@ -90,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
92
|
version: '0'
|
91
93
|
requirements: []
|
92
94
|
rubyforge_project:
|
93
|
-
rubygems_version: 2.
|
95
|
+
rubygems_version: 2.4.5
|
94
96
|
signing_key:
|
95
97
|
specification_version: 4
|
96
98
|
summary: Sha + Rack = Shack
|
metadata.gz.sig
CHANGED
Binary file
|