opal-uri 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: cb5e623d2337d4d82299bbe96fdaffdb99e2746e
4
+ data.tar.gz: 70ac635c8c10cd50be870106beb6e1983ac091c1
5
+ SHA512:
6
+ metadata.gz: 8e298564cb59a693b9abd1e584ceade4cfb0ff206bccd22a39ead898f77dbd0d7dd04e182b582271ded57c2b47bcde9101ede7f5338e0ab4264d553689f43784
7
+ data.tar.gz: 5b4cc2a002753dadf68e0ffa9ccd0288d355d7d4691a187f71c2c99a64d09b03eeb7b5b8d01ab1337d817baacf831ba1166c64ef7fe401e0883a22dfaae73fe8
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.5
4
+ - 2.3.1
5
+ - jruby-9.0.5.0
6
+ - jruby-9.1.1.0
7
+ before_install:
8
+ - wget https://s3.amazonaws.com/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2
9
+ - tar -xjf phantomjs-2.0.0-ubuntu-12.04.tar.bz2
10
+ - sudo rm -rf /usr/local/phantomjs/bin/phantomjs
11
+ - sudo mv phantomjs /usr/local/phantomjs/bin/phantomjs
12
+ - gem install bundler
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at [jgaskins@gmail.com](mailto:jgaskins@gmail.com). All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bowser.gemspec
4
+ gemspec
data/LICENSE.md ADDED
@@ -0,0 +1,25 @@
1
+ License
2
+ =======
3
+
4
+ Copyright (c) 2015 Jamie Gaskins
5
+
6
+ MIT License
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining
9
+ a copy of this software and associated documentation files (the
10
+ "Software"), to deal in the Software without restriction, including
11
+ without limitation the rights to use, copy, modify, merge, publish,
12
+ distribute, sublicense, and/or sell copies of the Software, and to
13
+ permit persons to whom the Software is furnished to do so, subject to
14
+ the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be
17
+ included in all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # Opal URI
2
+
3
+ It's like Ruby `URI`, but smaller. It provides minimal URI support that is absent from Opal.
4
+
5
+ [![Build Status](https://travis-ci.org/ajjahn/opal-uri.svg?branch=master)](https://travis-ci.org/ajjahn/opal-uri)
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'opal-uri'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install bowser
22
+
23
+ ## Usage
24
+
25
+ Inside your Opal app:
26
+
27
+ ```ruby
28
+ require 'uri'
29
+
30
+ uri = URI.parse("http://opalrb.com")
31
+ uri.scheme #=> "http"
32
+ uri.host #=> "opalrb.com"
33
+ ```
34
+
35
+ ## Contributing
36
+
37
+ This project is governed by a [Code of Conduct](CODE_OF_CONDUCT.md)
38
+
39
+ 1. Fork it
40
+ 1. Branch it
41
+ 1. Hack it
42
+ 1. Save it
43
+ 1. Commit it
44
+ 1. Push it
45
+ 1. Pull-request it
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ require "bundler/gem_tasks"
2
+ require 'opal/rspec/rake_task'
3
+
4
+ require 'opal-uri'
5
+
6
+ # Opal-RSpec stubs 'uri', unstub it
7
+ config = Opal::Config
8
+ if Gem::Version.new(Opal::VERSION) < Gem::Version.new('0.10.0')
9
+ config = Opal::Processor
10
+ end
11
+ config.stubbed_files.delete('uri')
12
+
13
+ Opal::RSpec::RakeTask.new(:opal_spec)
14
+ task :default => :opal_spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "opal-uri"
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,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
data/lib/opal-uri.rb ADDED
@@ -0,0 +1 @@
1
+ require "opal/uri"
data/lib/opal/uri.rb ADDED
@@ -0,0 +1,10 @@
1
+ require "opal/uri/version"
2
+ require "opal"
3
+
4
+ module Opal
5
+ class URI
6
+ end
7
+ end
8
+
9
+ Opal.append_path(File.expand_path(File.join("..", "..", "..", "opal"), __FILE__).untaint)
10
+
@@ -0,0 +1,5 @@
1
+ module Opal
2
+ class URI
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
data/opal-uri.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'opal/uri/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "opal-uri"
8
+ spec.version = Opal::URI::VERSION
9
+ spec.authors = ["Jamie Gaskins", "Adam Jahn"]
10
+ spec.email = ["jgaskins@gmail.com"]
11
+
12
+ spec.summary = %q{Minimal URI support for Opal}
13
+ spec.homepage = "https://github.com/ajjahn/opal-uri"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "opal", ">= 0.7.0", "< 0.12.0"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.10"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "opal-rspec"
26
+ end
data/opal/uri.rb ADDED
@@ -0,0 +1,24 @@
1
+ require "uri/common"
2
+ require "uri/generic"
3
+
4
+ module URI
5
+ def self.parse(url)
6
+ # scheme://conn_data/path?query#hash
7
+ match = url.match(%r[(\w+)://([^/]+)([^\?]+)(\?[^\#]+)?(\#.*)?])
8
+
9
+ _, scheme, connection_data, path, query, fragment = match.to_a
10
+
11
+ connection_data = connection_data.split(/@/)
12
+ userinfo = connection_data.size > 1 ? connection_data.first : nil
13
+ host, port = connection_data.last.split(/:/)
14
+
15
+ port = port.to_i
16
+ query = query[1..-1] if query
17
+
18
+ registry = opaque = nil
19
+
20
+ Generic.new(scheme, userinfo, host, port,
21
+ registry, path, opaque, query,
22
+ fragment)
23
+ end
24
+ end
@@ -0,0 +1,18 @@
1
+ module Kernel
2
+
3
+ #
4
+ # Returns +uri+ converted to a URI object.
5
+ #
6
+ def URI(uri)
7
+ if uri.is_a?(URI::Generic)
8
+ uri
9
+ elsif uri = String.try_convert(uri)
10
+ URI.parse(uri)
11
+ else
12
+ raise ArgumentError,
13
+ "bad argument (expected URI object or URI string)"
14
+ end
15
+ end
16
+ module_function :URI
17
+ end
18
+
@@ -0,0 +1,47 @@
1
+ module URI
2
+ class Generic
3
+ attr_reader :scheme, :userinfo, :user, :password, :host, :port, :path,
4
+ :query, :fragment, :opaque, :registry
5
+
6
+ #
7
+ # An Array of the available components for URI::Generic
8
+ #
9
+ COMPONENT = [
10
+ :scheme,
11
+ :userinfo, :host, :port, :registry,
12
+ :path, :opaque,
13
+ :query,
14
+ :fragment
15
+ ].freeze
16
+
17
+ def initialize(scheme,
18
+ userinfo, host, port, registry,
19
+ path, opaque,
20
+ query,
21
+ fragment,
22
+ parser = nil,
23
+ arg_check = false)
24
+ @scheme = scheme
25
+ @userinfo = userinfo
26
+ @host = host
27
+ @port = port
28
+ @path = path
29
+ @query = query
30
+ @fragment = fragment
31
+ @user, @password = userinfo.split(/:/) if userinfo
32
+ end
33
+
34
+ def ==(other)
35
+ self.class == other.class &&
36
+ component_ary == other.component_ary
37
+ end
38
+
39
+ protected
40
+
41
+ def component_ary
42
+ self.class::COMPONENT.collect do |x|
43
+ self.send(x)
44
+ end
45
+ end
46
+ end
47
+ end
metadata ADDED
@@ -0,0 +1,124 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: opal-uri
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jamie Gaskins
8
+ - Adam Jahn
9
+ autorequire:
10
+ bindir: exe
11
+ cert_chain: []
12
+ date: 2016-12-02 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: opal
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: 0.7.0
21
+ - - "<"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.12.0
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ version: 0.7.0
31
+ - - "<"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.12.0
34
+ - !ruby/object:Gem::Dependency
35
+ name: bundler
36
+ requirement: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.10'
41
+ type: :development
42
+ prerelease: false
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.10'
48
+ - !ruby/object:Gem::Dependency
49
+ name: rake
50
+ requirement: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: opal-rspec
64
+ requirement: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ type: :development
70
+ prerelease: false
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ description:
77
+ email:
78
+ - jgaskins@gmail.com
79
+ executables: []
80
+ extensions: []
81
+ extra_rdoc_files: []
82
+ files:
83
+ - ".gitignore"
84
+ - ".rspec"
85
+ - ".travis.yml"
86
+ - CODE_OF_CONDUCT.md
87
+ - Gemfile
88
+ - LICENSE.md
89
+ - README.md
90
+ - Rakefile
91
+ - bin/console
92
+ - bin/setup
93
+ - lib/opal-uri.rb
94
+ - lib/opal/uri.rb
95
+ - lib/opal/uri/version.rb
96
+ - opal-uri.gemspec
97
+ - opal/uri.rb
98
+ - opal/uri/common.rb
99
+ - opal/uri/generic.rb
100
+ homepage: https://github.com/ajjahn/opal-uri
101
+ licenses:
102
+ - MIT
103
+ metadata: {}
104
+ post_install_message:
105
+ rdoc_options: []
106
+ require_paths:
107
+ - lib
108
+ required_ruby_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ required_rubygems_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ requirements: []
119
+ rubyforge_project:
120
+ rubygems_version: 2.2.2
121
+ signing_key:
122
+ specification_version: 4
123
+ summary: Minimal URI support for Opal
124
+ test_files: []