cloudenv-hq 0.1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 99a0799636006c19e436b6c79411a25849dcd3941a0f37fe48964b0b2b1769cc
4
+ data.tar.gz: d54cb0ec25d27a51e8a7d11ce4cc2a4bebee59c35617f3be0b817d635933d521
5
+ SHA512:
6
+ metadata.gz: 3da6e923981ae78800c88dbedd6ec0bf6e285f1bb5972ca73310901c5483fbe7475f8532bcf35f0aa1e02209db6bb1a56b03bc687ee1df07001f62139e781647
7
+ data.tar.gz: 8d1ab76d5137b79c8d05630d446a4debe18577494fb5c60dea668ac7a145b9278210b826b6733763b944fa7e9fb88cc3c5a85cafe0877d7df265ced088bb2d24
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 CloudEnv
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 all
13
+ 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 THE
21
+ SOFTWARE.
@@ -0,0 +1,35 @@
1
+ ## Welcome to CloudEnv
2
+
3
+ Keep your ENV vars synced between your team members.
4
+
5
+ Learn more at cloudenv.com
6
+
7
+ ## Download
8
+
9
+ * gem install cloud-env
10
+ * https://github.com/cloudenvhq/cloudenv-ruby
11
+ * git clone git@github.com:cloudenvhq/cloudenv-ruby.git
12
+
13
+ ## License
14
+
15
+ MIT License
16
+
17
+ Copyright (c) 2020 CloudEnv
18
+
19
+ Permission is hereby granted, free of charge, to any person obtaining a copy
20
+ of this software and associated documentation files (the "Software"), to deal
21
+ in the Software without restriction, including without limitation the rights
22
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23
+ copies of the Software, and to permit persons to whom the Software is
24
+ furnished to do so, subject to the following conditions:
25
+
26
+ The above copyright notice and this permission notice shall be included in all
27
+ copies or substantial portions of the Software.
28
+
29
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35
+ SOFTWARE.
@@ -0,0 +1,84 @@
1
+ require "rubygems"
2
+ require "bundler/setup"
3
+ require "rake"
4
+ require "rake/testtask"
5
+ require "rdoc/task"
6
+ require "rubygems/package_task"
7
+ require "./lib/cloudenv-hq"
8
+
9
+ PKG_VERSION = CloudenvHQ::VERSION
10
+ PKG_NAME = "cloud-env".freeze
11
+ PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}".freeze
12
+ RELEASE_NAME = "#{PKG_NAME}-#{PKG_VERSION}".freeze
13
+
14
+ PKG_FILES = FileList[
15
+ "lib/*", "bin/*", "test/**/*", "[A-Z]*", "Rakefile", "html/**/*"
16
+ ]
17
+
18
+ desc "Default Task"
19
+ task default: [:test]
20
+
21
+ # Run the unit tests
22
+ desc "Run all unit tests"
23
+ Rake::TestTask.new("test") do |t|
24
+ t.libs << %w[lib test]
25
+ t.pattern = "test/*/*_test.rb"
26
+ t.verbose = true
27
+ end
28
+
29
+ # Make a console, useful when working on tests
30
+ desc "Generate a test console"
31
+ task :console do
32
+ verbose(false) { sh "irb -I lib/ -r 'cloudenv-hq'" }
33
+ end
34
+
35
+ # Genereate the RDoc documentation
36
+ desc "Create documentation"
37
+ Rake::RDocTask.new("doc") do |rdoc|
38
+ rdoc.title = "CloudEnv - Keep your ENV vars synced between your team members"
39
+ rdoc.rdoc_dir = "html"
40
+ rdoc.rdoc_files.include("README.markdown")
41
+ rdoc.rdoc_files.include("lib/*.rb")
42
+ end
43
+
44
+ # Genereate the package
45
+ spec = Gem::Specification.new do |s|
46
+ #### Basic information.
47
+
48
+ s.name = "cloudenv-hq"
49
+ s.version = PKG_VERSION
50
+ s.summary = <<-EOF
51
+ Keep your ENV vars synced between your team members
52
+ EOF
53
+ s.description = <<-EOF
54
+ Keep your ENV vars synced between your team members
55
+ EOF
56
+
57
+ #### Which files are to be included in this gem? Everything! (Except CVS directories.)
58
+
59
+ s.files = PKG_FILES
60
+
61
+ #### Load-time details: library and application (you will need one or both).
62
+
63
+ s.require_path = "lib"
64
+
65
+ #### Author and project details.
66
+
67
+ s.author = "CloudEnv"
68
+ s.email = "support@cloudenv.com"
69
+ s.homepage = "https://github.com/cloudenvhq/cloudenv-ruby"
70
+ end
71
+
72
+ Gem::PackageTask.new(spec) do |pkg|
73
+ pkg.need_zip = true
74
+ pkg.need_tar = true
75
+ end
76
+
77
+ desc "Report code statistics (KLOCs, etc) from the application"
78
+ task :stats do
79
+ require "code_statistics"
80
+ CodeStatistics.new(
81
+ %w[Library lib],
82
+ %w[Units test]
83
+ ).to_s
84
+ end
@@ -0,0 +1,18 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "cloudenv-hq"
3
+ s.version = "0.1.0"
4
+ s.license = "MIT"
5
+ s.version = "#{s.version}-alpha-#{ENV['TRAVIS_BUILD_NUMBER']}" if ENV["TRAVIS"]
6
+ s.date = "2020-10-10"
7
+ s.summary = "Keep your ENV vars synced between your team members"
8
+ s.email = "support@cloudenv.com"
9
+ s.homepage = "https://github.com/cloudenvhq/cloudenv-ruby"
10
+ s.description = "Keep your ENV vars synced between your team members."
11
+ s.authors = ["Lucas Carlson"]
12
+ s.files = ["install.rb", "lib", "lib/cloudenv-hq.rb", "LICENSE", "Rakefile", "README.markdown", "cloudenv-hq.gemspec", "test", "test/base", "test/base/base_test.rb", "test/data", "test/test_helper.rb"]
13
+ s.rubyforge_project = "cloudenv-hq"
14
+ s.add_dependency "dotenv"
15
+ s.add_development_dependency "rake"
16
+ s.add_development_dependency "rdoc"
17
+ s.add_development_dependency "test-unit"
18
+ end
@@ -0,0 +1,40 @@
1
+ require "rbconfig"
2
+ require "find"
3
+ require "ftools"
4
+
5
+ include Config
6
+
7
+ # this was adapted from rdoc's install.rb by ways of Log4r
8
+
9
+ $sitedir = CONFIG["sitelibdir"]
10
+ unless $sitedir
11
+ version = CONFIG["MAJOR"] + "." + CONFIG["MINOR"]
12
+ $libdir = File.join(CONFIG["libdir"], "ruby", version)
13
+ $sitedir = $LOAD_PATH.find { |x| x =~ /site_ruby/ }
14
+ if !$sitedir
15
+ $sitedir = File.join($libdir, "site_ruby")
16
+ elsif $sitedir !~ Regexp.quote(version)
17
+ $sitedir = File.join($sitedir, version)
18
+ end
19
+ end
20
+
21
+ makedirs = %w[shipping]
22
+ makedirs.each { |f| File.makedirs(File.join($sitedir, *f.split(/\//))) }
23
+
24
+ Dir.chdir("lib")
25
+ begin
26
+ require "rubygems"
27
+ require "rake"
28
+ rescue LoadError
29
+ puts
30
+ puts "Please install Gem and Rake from http://rubyforge.org/projects/rubygems and http://rubyforge.org/projects/rake"
31
+ puts
32
+ exit(-1)
33
+ end
34
+
35
+ files = FileList["**/*"]
36
+
37
+ # File::safe_unlink *deprecated.collect{|f| File.join($sitedir, f.split(/\//))}
38
+ files.each do |f|
39
+ File.install(f, File.join($sitedir, *f.split(/\//)), 0o644, true)
40
+ end
@@ -0,0 +1,44 @@
1
+ require "pathname"
2
+ require "dotenv"
3
+
4
+ class CloudenvHQ
5
+ VERSION = "0.1.0".freeze
6
+
7
+ API_HOST = "https://app.cloudenv.com".freeze
8
+ READ_PATH = "/api/v1/envs".freeze
9
+
10
+ def initialize(options={})
11
+ @environment = ENV["RAILS_ENV"] || ENV["RACK_ENV"]
12
+ @bearer = `cat #{options[:bearer] || "~/.cloudenvrc"}`.strip
13
+ @secret_key_filename = ".cloudenv-secret-key"
14
+ @secret_key = Pathname.new(@secret_key_filename)
15
+
16
+ until File.exists?(@secret_key) || @secret_key.expand_path == Pathname.new("/.cloudenv-secret-key")
17
+ @secret_key = @secret_key.parent.parent + @secret_key_filename
18
+ end
19
+
20
+ if File.exists?(@secret_key)
21
+ @app, @secret_key = IO.read(@secret_key).split
22
+
23
+ if @environment
24
+ data = `curl -s -H "Authorization: Bearer #{@bearer}" "https://app.cloudenv.com/api/v1/envs?name=#{@app}&environment=#{@environment}" | openssl enc -a -aes-256-cbc -md sha512 -d -pass pass:"#{@secret_key}" 2> /dev/null`
25
+ file = Tempfile.new("cloudenv")
26
+ file.write(data)
27
+ file.close
28
+ Dotenv.load(file.path)
29
+ file.unlink
30
+ end
31
+
32
+ data = `curl -s -H "Authorization: Bearer #{@bearer}" "https://app.cloudenv.com/api/v1/envs?name=#{@app}&environment=default" | openssl enc -a -aes-256-cbc -md sha512 -d -pass pass:"#{@secret_key}" 2> /dev/null`
33
+ file = Tempfile.new("cloudenv")
34
+ file.write(data)
35
+ file.close
36
+ Dotenv.load(file.path)
37
+ file.unlink
38
+ else
39
+ warn "WARNING: cloudenv could not find a .cloudenv-secret-key in the directory path"
40
+ end
41
+ end
42
+ end
43
+
44
+ CloudenvHQ.new(bearer: ENV["CLOUDENV_BEARER_PATH"])
@@ -0,0 +1,82 @@
1
+ require "test_helper"
2
+ class BaseTest < Test::Unit::TestCase
3
+ def setup
4
+ @rss09 = SimpleRSS.parse open(File.dirname(__FILE__) + "/../data/rss09.rdf")
5
+ @rss20 = SimpleRSS.parse open(File.dirname(__FILE__) + "/../data/rss20.xml")
6
+ @rss20_utf8 = SimpleRSS.parse open(File.dirname(__FILE__) + "/../data/rss20_utf8.xml")
7
+ @media_rss = SimpleRSS.parse open(File.dirname(__FILE__) + "/../data/media_rss.xml")
8
+ @atom = SimpleRSS.parse open(File.dirname(__FILE__) + "/../data/atom.xml")
9
+ end
10
+
11
+ def test_channel
12
+ assert_equal @rss09, @rss09.channel
13
+ assert_equal @rss20, @rss20.channel
14
+ assert_equal @atom, @atom.feed
15
+ end
16
+
17
+ def test_items
18
+ assert_kind_of Array, @rss09.items
19
+ assert_kind_of Array, @rss20.items
20
+ assert_kind_of Array, @atom.entries
21
+ end
22
+
23
+ def test_rss09
24
+ assert_equal 10, @rss09.items.size
25
+ assert_equal "Slashdot", @rss09.title
26
+ assert_equal "http://slashdot.org/", @rss09.channel.link
27
+ assert_equal "http://books.slashdot.org/article.pl?sid=05/08/29/1319236&amp;from=rss", @rss09.items.first.link
28
+ assert_equal "http://books.slashdot.org/article.pl?sid=05/08/29/1319236&amp;from=rss", @rss09.items.first[:link]
29
+ assert_equal Time.parse("Wed Aug 24 13:33:34 UTC 2005"), @rss20.items.first.pubDate
30
+ assert_equal Time.parse("Fri Sep 09 02:52:31 PDT 2005"), @rss09.channel.dc_date
31
+ end
32
+
33
+ def test_media_rss
34
+ assert_equal 20, @media_rss.items.size
35
+ assert_equal "Uploads from herval", @media_rss.title
36
+ assert_equal "http://www.flickr.com/photos/herval/", @media_rss.channel.link
37
+ assert_equal "http://www.flickr.com/photos/herval/4671960608/", @media_rss.items.first.link
38
+ assert_equal "http://www.flickr.com/photos/herval/4671960608/", @media_rss.items.first[:link]
39
+ assert_equal "http://farm5.static.flickr.com/4040/4671960608_10cb945d5c_o.jpg", @media_rss.items.first.media_content_url
40
+ assert_equal "image/jpeg", @media_rss.items.first.media_content_type
41
+ assert_equal "3168", @media_rss.items.first.media_content_height
42
+ assert_equal "4752", @media_rss.items.first.media_content_width
43
+ assert_equal "Woof?", @media_rss.items.first.media_title
44
+ assert_equal "http://farm5.static.flickr.com/4040/4671960608_954d2297bc_s.jpg", @media_rss.items.first.media_thumbnail_url
45
+ assert_equal "75", @media_rss.items.first.media_thumbnail_height
46
+ assert_equal "75", @media_rss.items.first.media_thumbnail_width
47
+ assert_equal "herval", @media_rss.items.first.media_credit
48
+ assert_equal "photographer", @media_rss.items.first.media_credit_role
49
+ assert_equal "pets frodo", @media_rss.items.first.media_category
50
+ assert_equal "urn:flickr:tags", @media_rss.items.first.media_category_scheme
51
+ end
52
+
53
+ def test_rss20
54
+ assert_equal 10, @rss20.items.size
55
+ assert_equal "Technoblog", @rss20.title
56
+ assert_equal "http://tech.rufy.com", @rss20.channel.link
57
+ assert_equal "http://feeds.feedburner.com/rufytech?m=68", @rss20.items.first.link
58
+ assert_equal "http://feeds.feedburner.com/rufytech?m=68", @rss20.items.first[:link]
59
+ assert_equal "This is an XML content feed. It is intended to be viewed in a newsreader or syndicated to another site.", @rss20.channel.feedburner_browserFriendly
60
+ end
61
+
62
+ def test_atom
63
+ assert_equal 1, @atom.entries.size
64
+ assert_equal "dive into mark", @atom.title
65
+ assert_equal "http://example.org/", @atom.feed.link
66
+ assert_equal "http://example.org/2005/04/02/atom", @atom.entries.first.link
67
+ assert_equal "http://example.org/2005/04/02/atom", @atom.entries.first[:link]
68
+ end
69
+
70
+ def test_bad_feed
71
+ assert_raise(SimpleRSSError) { SimpleRSS.parse(open(File.dirname(__FILE__) + "/../data/not-rss.xml")) }
72
+ end
73
+
74
+ def test_rss_utf8
75
+ assert_equal 2, @rss20_utf8.items.size
76
+ assert_equal "SC5 Blog", @rss20_utf8.title
77
+ assert_equal Encoding::UTF_8, @rss20_utf8.title.encoding
78
+ item = @rss20_utf8.items.first
79
+ assert_equal "Mitä asiakkaamme ajattelevat meistä?", item.title
80
+ assert_equal Encoding::UTF_8, item.title.encoding
81
+ end
82
+ end
@@ -0,0 +1,4 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + "/../lib")
2
+
3
+ require "test/unit"
4
+ require "cloudenv"
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cloudenv-hq
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Lucas Carlson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-10-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: dotenv
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
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: rdoc
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: test-unit
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: Keep your ENV vars synced between your team members.
70
+ email: support@cloudenv.com
71
+ executables: []
72
+ extensions: []
73
+ extra_rdoc_files: []
74
+ files:
75
+ - LICENSE
76
+ - README.markdown
77
+ - Rakefile
78
+ - cloudenv-hq.gemspec
79
+ - install.rb
80
+ - lib/cloudenv-hq.rb
81
+ - test/base/base_test.rb
82
+ - test/test_helper.rb
83
+ homepage: https://github.com/cloudenvhq/cloudenv-ruby
84
+ licenses:
85
+ - MIT
86
+ metadata: {}
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ requirements: []
102
+ rubygems_version: 3.0.3
103
+ signing_key:
104
+ specification_version: 4
105
+ summary: Keep your ENV vars synced between your team members
106
+ test_files: []