mysql_make_scrambled_password 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3deb3a9fa97e4c9f96f9ced92c128b68ecf488bb
4
+ data.tar.gz: 071aee0cbf0b28f0a1c245242913d77f2a9cf693
5
+ SHA512:
6
+ metadata.gz: d7c0b1b005ba9e2b1a6b8dda0ea17309356d14f1ffaf1f11c75355ea020f2472237071213144949621584770f530c41f0f41f8fe7cab01f37fd7f2a759eda7e0
7
+ data.tar.gz: f382e68ef8ba0592bd750c129ad003c8c2fdcf28add5d82f1d6c9353aa2090a6a8b6e661eb7bb080580f16b6d1d8da736b7525a37ebc5e1dea87aa1193172fc9
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ Makefile
11
+ mkmf.log
12
+ *.bundle
13
+ *.o
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,10 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.0.0
5
+ - 2.1.10
6
+ - 2.2.5
7
+ - 2.3.1
8
+ script:
9
+ - bundle install
10
+ - bundle exec rake
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in mysql_make_scrambled_password.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Genki Sugawara
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all 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,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # mysql_make_scrambled_password
2
+
3
+ Execute MySQL PASSWORD() function in Ruby.
4
+
5
+ [![Build Status](https://travis-ci.org/winebarrel/mysql_make_scrambled_password.svg?branch=master)](https://travis-ci.org/winebarrel/mysql_make_scrambled_password)
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'mysql_make_scrambled_password'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install mysql_make_scrambled_password
22
+
23
+ ## Usage
24
+
25
+ ```ruby
26
+ require "mysql_make_scrambled_password"
27
+ include MysqlMakeScrambledPassword
28
+
29
+ make_scrambled_password("FOOBARZOO")
30
+ #=> "*70B45D8E18771E93E011F30DB91E80D6306EA4C3"
31
+ ```
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require 'rake/extensiontask'
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ Rake::ExtensionTask.new('mysql_make_scrambled_password_core') do |ext|
8
+ ext.ext_dir = 'ext'
9
+ end
10
+
11
+ task :default => [:spec]
12
+ task :spec => [:compile]
13
+ task :compile => [:clean]
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "mysql_make_scrambled_password"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/ext/extconf.rb ADDED
@@ -0,0 +1,22 @@
1
+ require 'mkmf'
2
+
3
+ mysql_config_version = (`mysql_config --version` rescue '').strip
4
+
5
+ if mysql_config_version
6
+ mysql_config = 'mysql_config'
7
+ else
8
+ mysql_config = with_config('mysql-config')
9
+ mysql_config = 'mysql_config' if mysql_config == 'mysql_config'
10
+ end
11
+
12
+ if mysql_config
13
+ includes = `#{mysql_config} --include`.chomp
14
+ libs = `#{mysql_config} --libs`.chomp
15
+ $INCFLAGS += ' ' + includes
16
+ $libs = libs + ' ' + $libs
17
+ else
18
+ have_header('mysql')
19
+ have_library('mysqlclient')
20
+ end
21
+
22
+ create_makefile('ext/mysql_make_scrambled_password_core')
@@ -0,0 +1,28 @@
1
+ #include "mysql_make_scrambled_password_core.h"
2
+
3
+ static VALUE rb_make_scrambled_password(VALUE self, VALUE v_password) {
4
+ char *password;
5
+ char *buf;
6
+ size_t len;
7
+
8
+ Check_Type(v_password, T_STRING);
9
+
10
+ len = RSTRING_LEN(v_password);
11
+
12
+ if (len < 1) {
13
+ return v_password;
14
+ }
15
+
16
+ password = RSTRING_PTR(v_password);
17
+ buf = alloca(CRYPT_MAX_PASSWORD_SIZE_PLUS_BUF + 1);
18
+
19
+ make_scrambled_password(buf, password);
20
+
21
+ return rb_str_new2(buf);
22
+ }
23
+
24
+ void Init_mysql_make_scrambled_password_core() {
25
+ VALUE rb_mMysqlMakeScrambledPassword = rb_define_module("MysqlMakeScrambledPassword");
26
+ VALUE rb_mMysqlMakeScrambledPasswordCore = rb_define_module_under(rb_mMysqlMakeScrambledPassword, "Core");
27
+ rb_define_module_function(rb_mMysqlMakeScrambledPasswordCore, "make_scrambled_password", rb_make_scrambled_password, 1);
28
+ }
@@ -0,0 +1,11 @@
1
+ #ifndef __MYSQL_MAKE_SCRAMBLED_PASSWORD_CORE_H__
2
+ #define __MYSQL_MAKE_SCRAMBLED_PASSWORD_CORE_H__
3
+
4
+ #include <string.h>
5
+ #include <alloca.h>
6
+ #include <mysql.h>
7
+ #include <ruby.h>
8
+
9
+ #define CRYPT_MAX_PASSWORD_SIZE_PLUS_BUF 79 * 3
10
+
11
+ #endif //__MYSQL_MAKE_SCRAMBLED_PASSWORD_CORE_H__
@@ -0,0 +1,3 @@
1
+ module MysqlMakeScrambledPassword
2
+ VERSION = '0.1.0'
3
+ end
@@ -0,0 +1,9 @@
1
+ require 'mysql_make_scrambled_password/version'
2
+ require 'mysql_make_scrambled_password_core'
3
+
4
+ module MysqlMakeScrambledPassword
5
+ def make_scrambled_password(password)
6
+ MysqlMakeScrambledPassword::Core.make_scrambled_password(password)
7
+ end
8
+ module_function :make_scrambled_password
9
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'mysql_make_scrambled_password/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'mysql_make_scrambled_password'
8
+ spec.version = MysqlMakeScrambledPassword::VERSION
9
+ spec.authors = ['Genki Sugawara']
10
+ spec.email = ['sugawara@cookpad.com']
11
+
12
+ spec.summary = %q{Execute MySQL PASSWORD() function in Ruby.}
13
+ spec.description = %q{Execute MySQL PASSWORD() function in Ruby.}
14
+ spec.homepage = 'https://github.com/winebarrel/mysql_make_scrambled_password'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = 'exe'
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ['lib', 'ext']
21
+ spec.extensions = 'ext/extconf.rb'
22
+
23
+ spec.add_development_dependency 'bundler'
24
+ spec.add_development_dependency 'rake'
25
+ spec.add_development_dependency 'rspec'
26
+ spec.add_development_dependency 'rake-compiler'
27
+ end
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mysql_make_scrambled_password
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Genki Sugawara
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-06-23 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: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
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
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake-compiler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Execute MySQL PASSWORD() function in Ruby.
70
+ email:
71
+ - sugawara@cookpad.com
72
+ executables: []
73
+ extensions:
74
+ - ext/extconf.rb
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - ".rspec"
79
+ - ".travis.yml"
80
+ - Gemfile
81
+ - LICENSE.txt
82
+ - README.md
83
+ - Rakefile
84
+ - bin/console
85
+ - bin/setup
86
+ - ext/extconf.rb
87
+ - ext/mysql_make_scrambled_password_core.c
88
+ - ext/mysql_make_scrambled_password_core.h
89
+ - lib/mysql_make_scrambled_password.rb
90
+ - lib/mysql_make_scrambled_password/version.rb
91
+ - mysql_make_scrambled_password.gemspec
92
+ homepage: https://github.com/winebarrel/mysql_make_scrambled_password
93
+ licenses:
94
+ - MIT
95
+ metadata: {}
96
+ post_install_message:
97
+ rdoc_options: []
98
+ require_paths:
99
+ - lib
100
+ - ext
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ requirements: []
112
+ rubyforge_project:
113
+ rubygems_version: 2.4.5.1
114
+ signing_key:
115
+ specification_version: 4
116
+ summary: Execute MySQL PASSWORD() function in Ruby.
117
+ test_files: []