camo 0.0.1 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 05af8738b193ee4426bce13f86aaeda6849e8cfa
4
- data.tar.gz: 31f44214ee27be4802d9c20abedbc98ac1fe92b7
2
+ SHA256:
3
+ metadata.gz: aba71bc194731f9fdf0518c0ae2aebd228c856263e928485678e00990cbf04ab
4
+ data.tar.gz: 31b6017ef24aa772444090702572dd7b7dad32ea8de3a0849ca40dbfc66aafb3
5
5
  SHA512:
6
- metadata.gz: bd508b0243bc94f1e0d46bc4adc2d8651b7a1609349a32457ade797f38f4e4da1ef6db660e01f9d4ed7d0e510f0b47328ebd2220fb6273e301d955840a496139
7
- data.tar.gz: d0ae2c4b88f0bf7831924560d175e55c39207cb9c33aded51c7dc84bee8c8c379a6fd8fce839c83ce8aafa8f18182d1ac8d056430842014ee0dc569f47b42e89
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
@@ -1,4 +1,5 @@
1
- Copyright (c) 2013 Andrew Kane
1
+ Copyright (c) 2010 Corey Donohoe, Rick Olson
2
+ Copyright (c) 2013-2022 Andrew Kane
2
3
 
3
4
  MIT License
4
5
 
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
- ## Get Started
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
- Add your camo host and key to your environment or create an initializer `config/initializers/camo.rb`.
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("http://placekitten.com/g/200/300") %>
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
- Choose a [random secret key](https://www.random.org/passwords/?num=20&len=24&format=html&rnd=new) and add it to your app.
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
- ```sh
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
- ## Credit
34
+ ## History
56
35
 
57
- Thanks to [Corey Donohoe](https://github.com/atmos) for creating camo and providing most of the Ruby code for this gem.
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
@@ -1,3 +1,3 @@
1
1
  module Camo
2
- VERSION = "0.0.1"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/camo.rb CHANGED
@@ -1,15 +1,29 @@
1
- require "camo/version"
1
+ # stdlib
2
2
  require "openssl"
3
3
 
4
- module Camo
4
+ # modules
5
+ require "camo/version"
5
6
 
7
+ module Camo
6
8
  def camo(image_url)
7
- hexdigest = OpenSSL::HMAC.hexdigest(OpenSSL::Digest::Digest.new("sha1"), ENV["CAMO_KEY"], image_url)
8
- encoded_image_url = image_url.to_enum(:each_byte).map{|byte| "%02x" % byte }.join
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
- ActionView::Base.send :include, Camo
15
- ActionController::Base.send :include, Camo
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.1
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: 2013-11-26 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
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
- - .gitignore
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: '0'
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
- rubyforge_project:
76
- rubygems_version: 2.0.0
77
- signing_key:
43
+ rubygems_version: 3.3.7
44
+ signing_key:
78
45
  specification_version: 4
79
- summary: Ruby client for the camo proxy
46
+ summary: Ruby client for Camo - the SSL image proxy
80
47
  test_files: []
data/.gitignore DELETED
@@ -1,17 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in camo.gemspec
4
- gemspec
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