bitmarkable 0.0.2.1 → 0.0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/bitmarkable/bitmark.rb +5 -1
- data/lib/bitmarkable.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0bec79f9601e2054b1fd014cd9fdf1de43c2d0b
|
4
|
+
data.tar.gz: 677a4e1bf013f1c3d4c7b3ef4b4290a68f8cb82e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48bc55c4eb9f963e1c8ad26cad06eaf701366a9c426b63e100c5e3e847a40016af4bbb61949730ce64547788bc5c08c30ab92c35858aa0485a3ed257f2bce05e
|
7
|
+
data.tar.gz: 1f139cddb7c2a0309fd33bae936aa40b0faf23e3d6f4ea9e38a3c619a66e925792e0e3c5822bd04147f73a204b8fac26176f89c9d0548d3204910a81f219ccf0
|
data/README.md
CHANGED
@@ -37,6 +37,8 @@ The short URL can then be fetched using `instance.bitmark`. The value is stored
|
|
37
37
|
|
38
38
|
If the bitmarkable class responds to `.delay` (e.g. you're using DelayedJob or Sidekiq) then bitmarks will be processed asynchronously.
|
39
39
|
|
40
|
+
If running in Rails and in development or test environments, the bitmark will be set to the full localhost URL and the bitly API will not be called (because it will not shorten localhost URLs). The URL will still be set asynchronously to mimic production behavior.
|
41
|
+
|
40
42
|
## Contributing
|
41
43
|
|
42
44
|
1. Fork it
|
data/lib/bitmarkable/bitmark.rb
CHANGED
@@ -26,7 +26,11 @@ module Bitmarkable
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def save_bitmark(object, url)
|
29
|
-
|
29
|
+
if defined?(Rails) && !(Rails.env.development? || Rails.env.test?)
|
30
|
+
object.bitmark = Bitly.shorten(url)
|
31
|
+
else
|
32
|
+
object.bitmark = url
|
33
|
+
end
|
30
34
|
end
|
31
35
|
end
|
32
36
|
|
data/lib/bitmarkable.rb
CHANGED