camo 0.0.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +16 -0
- data/LICENSE.txt +2 -1
- data/README.md +25 -36
- data/lib/camo/version.rb +1 -1
- data/lib/camo.rb +20 -6
- metadata +15 -48
- data/.gitignore +0 -17
- data/Gemfile +0 -4
- data/Rakefile +0 -1
- data/camo.gemspec +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: aba71bc194731f9fdf0518c0ae2aebd228c856263e928485678e00990cbf04ab
|
4
|
+
data.tar.gz: 31b6017ef24aa772444090702572dd7b7dad32ea8de3a0849ca40dbfc66aafb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de569a318e30cf32a6623274a44a0b1fcc6274872afe55215c1d3049c6fcdc1a118efe76815be21f7c3141db325830e100139e801ca74a729ee9dcfe00adbeca
|
7
|
+
data.tar.gz: 33f8bbdefb3ca81398435cc36e83067bdb0f5a82049fbab34885b465aef5a07fca6548d2c23dbca50c91f9648f0800ce1bce52d61894f234266905aca4cf0018
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
## 0.2.0 (2022-09-05)
|
2
|
+
|
3
|
+
- Dropped support for Ruby < 2.7
|
4
|
+
|
5
|
+
## 0.1.0 (2016-10-17)
|
6
|
+
|
7
|
+
- Improved performance
|
8
|
+
- Fixed deprecation warning
|
9
|
+
|
10
|
+
## 0.0.2 (2013-11-25)
|
11
|
+
|
12
|
+
- Added support for Sinatra
|
13
|
+
|
14
|
+
## 0.0.1 (2013-11-25)
|
15
|
+
|
16
|
+
- First release
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
# Camo
|
1
|
+
# Camo Ruby
|
2
2
|
|
3
|
-
Ruby client for [Camo](https://github.com/atmos/camo)
|
3
|
+
Ruby client for [Camo](https://github.com/atmos/camo) and [Go-Camo](https://github.com/cactus/go-camo) - the SSL image proxy :lock:
|
4
4
|
|
5
|
-
|
5
|
+
[![Build Status](https://github.com/ankane/camo-ruby/workflows/build/badge.svg?branch=master)](https://github.com/ankane/camo-ruby/actions)
|
6
|
+
|
7
|
+
## Installation
|
6
8
|
|
7
9
|
Add this line to your application’s Gemfile:
|
8
10
|
|
@@ -10,7 +12,9 @@ Add this line to your application’s Gemfile:
|
|
10
12
|
gem "camo"
|
11
13
|
```
|
12
14
|
|
13
|
-
|
15
|
+
## Getting Started
|
16
|
+
|
17
|
+
Add your Camo host and key to your environment or create an initializer `config/initializers/camo.rb`.
|
14
18
|
|
15
19
|
```ruby
|
16
20
|
ENV["CAMO_HOST"] = "https://camo.herokuapp.com"
|
@@ -20,47 +24,32 @@ ENV["CAMO_KEY"] = "rzsJbU5YxDfdP3FXHjshtgEN"
|
|
20
24
|
You can now use the `camo` method in your views and controllers.
|
21
25
|
|
22
26
|
```erb
|
23
|
-
<%= image_tag camo("
|
24
|
-
```
|
25
|
-
|
26
|
-
It’s that easy!
|
27
|
-
|
28
|
-
## Deploying to Heroku
|
29
|
-
|
30
|
-
Clone the camo repository.
|
31
|
-
|
32
|
-
```sh
|
33
|
-
git clone https://github.com/atmos/camo.git
|
34
|
-
cd camo
|
35
|
-
```
|
36
|
-
|
37
|
-
Create a new project on [Heroku](https://www.heroku.com/).
|
38
|
-
|
39
|
-
```sh
|
40
|
-
heroku create camo
|
27
|
+
<%= image_tag camo("https://placekitten.com/g/200/300") %>
|
41
28
|
```
|
42
29
|
|
43
|
-
|
44
|
-
|
45
|
-
```sh
|
46
|
-
heroku config:set CAMO_KEY=rzsJbU5YxDfdP3FXHjshtgEN
|
47
|
-
```
|
48
|
-
|
49
|
-
Open your app to make sure it’s working. You should see the text “hwhat”.
|
30
|
+
## Credit
|
50
31
|
|
51
|
-
|
52
|
-
heroku open
|
53
|
-
```
|
32
|
+
Thanks to [Corey Donohoe](https://github.com/atmos) for creating Camo and providing most of the Ruby code for this gem.
|
54
33
|
|
55
|
-
##
|
34
|
+
## History
|
56
35
|
|
57
|
-
|
36
|
+
View the [changelog](CHANGELOG.md)
|
58
37
|
|
59
38
|
## Contributing
|
60
39
|
|
61
40
|
Everyone is encouraged to help improve this project. Here are a few ways you can help:
|
62
41
|
|
63
|
-
- [Report bugs](https://github.com/ankane/camo/issues)
|
64
|
-
- Fix bugs and [submit pull requests](https://github.com/ankane/camo/pulls)
|
42
|
+
- [Report bugs](https://github.com/ankane/camo-ruby/issues)
|
43
|
+
- Fix bugs and [submit pull requests](https://github.com/ankane/camo-ruby/pulls)
|
65
44
|
- Write, clarify, or fix documentation
|
66
45
|
- Suggest or add new features
|
46
|
+
|
47
|
+
To get started with development:
|
48
|
+
|
49
|
+
```sh
|
50
|
+
git clone https://github.com/ankane/camo-ruby.git
|
51
|
+
cd camo-ruby
|
52
|
+
bundle install
|
53
|
+
go-camo -k 461fbf74af826c3a1020
|
54
|
+
bundle exec rake test
|
55
|
+
```
|
data/lib/camo/version.rb
CHANGED
data/lib/camo.rb
CHANGED
@@ -1,15 +1,29 @@
|
|
1
|
-
|
1
|
+
# stdlib
|
2
2
|
require "openssl"
|
3
3
|
|
4
|
-
|
4
|
+
# modules
|
5
|
+
require "camo/version"
|
5
6
|
|
7
|
+
module Camo
|
6
8
|
def camo(image_url)
|
7
|
-
|
8
|
-
|
9
|
+
raise "No CAMO_KEY" unless ENV["CAMO_KEY"]
|
10
|
+
raise "No CAMO_HOST" unless ENV["CAMO_HOST"]
|
11
|
+
hexdigest = OpenSSL::HMAC.hexdigest("sha1", ENV["CAMO_KEY"], image_url)
|
12
|
+
encoded_image_url = image_url.unpack1("H*")
|
9
13
|
"#{ENV["CAMO_HOST"]}/#{hexdigest}/#{encoded_image_url}"
|
10
14
|
end
|
15
|
+
end
|
11
16
|
|
17
|
+
if defined?(ActiveSupport)
|
18
|
+
ActiveSupport.on_load(:action_view) do
|
19
|
+
include Camo
|
20
|
+
end
|
21
|
+
|
22
|
+
ActiveSupport.on_load(:action_controller) do
|
23
|
+
include Camo
|
24
|
+
end
|
12
25
|
end
|
13
26
|
|
14
|
-
|
15
|
-
|
27
|
+
if defined?(Sinatra)
|
28
|
+
Sinatra::Base.helpers Camo
|
29
|
+
end
|
metadata
CHANGED
@@ -1,80 +1,47 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: camo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
|
14
|
-
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ~>
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.3'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ~>
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.3'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - '>='
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - '>='
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
description: Ruby client for the camo proxy
|
42
|
-
email:
|
43
|
-
- andrew@chartkick.com
|
11
|
+
date: 2022-09-05 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email: andrew@ankane.org
|
44
15
|
executables: []
|
45
16
|
extensions: []
|
46
17
|
extra_rdoc_files: []
|
47
18
|
files:
|
48
|
-
- .
|
49
|
-
- Gemfile
|
19
|
+
- CHANGELOG.md
|
50
20
|
- LICENSE.txt
|
51
21
|
- README.md
|
52
|
-
- Rakefile
|
53
|
-
- camo.gemspec
|
54
22
|
- lib/camo.rb
|
55
23
|
- lib/camo/version.rb
|
56
|
-
homepage: https://github.com/ankane/camo
|
24
|
+
homepage: https://github.com/ankane/camo-ruby
|
57
25
|
licenses:
|
58
26
|
- MIT
|
59
27
|
metadata: {}
|
60
|
-
post_install_message:
|
28
|
+
post_install_message:
|
61
29
|
rdoc_options: []
|
62
30
|
require_paths:
|
63
31
|
- lib
|
64
32
|
required_ruby_version: !ruby/object:Gem::Requirement
|
65
33
|
requirements:
|
66
|
-
- -
|
34
|
+
- - ">="
|
67
35
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
36
|
+
version: '2.7'
|
69
37
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
38
|
requirements:
|
71
|
-
- -
|
39
|
+
- - ">="
|
72
40
|
- !ruby/object:Gem::Version
|
73
41
|
version: '0'
|
74
42
|
requirements: []
|
75
|
-
|
76
|
-
|
77
|
-
signing_key:
|
43
|
+
rubygems_version: 3.3.7
|
44
|
+
signing_key:
|
78
45
|
specification_version: 4
|
79
|
-
summary: Ruby client for the
|
46
|
+
summary: Ruby client for Camo - the SSL image proxy
|
80
47
|
test_files: []
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
data/camo.gemspec
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'camo/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "camo"
|
8
|
-
spec.version = Camo::VERSION
|
9
|
-
spec.authors = ["Andrew Kane"]
|
10
|
-
spec.email = ["andrew@chartkick.com"]
|
11
|
-
spec.description = %q{Ruby client for the camo proxy}
|
12
|
-
spec.summary = %q{Ruby client for the camo proxy}
|
13
|
-
spec.homepage = "https://github.com/ankane/camo"
|
14
|
-
spec.license = "MIT"
|
15
|
-
|
16
|
-
spec.files = `git ls-files`.split($/)
|
17
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = ["lib"]
|
20
|
-
|
21
|
-
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
-
spec.add_development_dependency "rake"
|
23
|
-
end
|