summaryrefslogtreecommitdiff
path: root/lib/chef/mixin
diff options
context:
space:
mode:
authorJay Mundrawala <jdmundrawala@gmail.com>2015-05-15 12:09:51 -0500
committerJay Mundrawala <jdmundrawala@gmail.com>2015-05-15 12:09:51 -0500
commitc5fad0e662da7c3ee39cb505723d0b1ee4e65764 (patch)
tree782aaa4945537d0a5ef872236e96f5f91d29b410 /lib/chef/mixin
parentec4e3f70a71de7de5bc6eb8d81a5ef112f3b6ac6 (diff)
parent4c73a841e018057302b7c0cb10f8f880c282d849 (diff)
downloadchef-c5fad0e662da7c3ee39cb505723d0b1ee4e65764.tar.gz
Merge pull request #3318 from chef/jdm/msi-uri-source
Modify windows package provider to allow url
Diffstat (limited to 'lib/chef/mixin')
-rw-r--r--lib/chef/mixin/uris.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/chef/mixin/uris.rb b/lib/chef/mixin/uris.rb
new file mode 100644
index 0000000000..6c1ae793e2
--- /dev/null
+++ b/lib/chef/mixin/uris.rb
@@ -0,0 +1,33 @@
+#
+# Author:: Jay Mundrawala (<jdm@chef.io>)
+# Copyright:: Copyright (c) 2015 Chef Software, Inc.
+# License:: Apache License, Version 2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+require 'uri'
+
+class Chef
+ module Mixin
+ module Uris
+ # uri_scheme? returns true if the string starts with
+ # scheme://
+ # For example, it will match http://foo.bar.com
+ def uri_scheme?(source)
+ # From open-uri
+ !!(%r{\A[A-Za-z][A-Za-z0-9+\-\.]*://} =~ source)
+ end
+ end
+ end
+end