cloudenv-hq 0.1.0 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 99a0799636006c19e436b6c79411a25849dcd3941a0f37fe48964b0b2b1769cc
4
- data.tar.gz: d54cb0ec25d27a51e8a7d11ce4cc2a4bebee59c35617f3be0b817d635933d521
3
+ metadata.gz: 8b85cfaf1c36435fe45442d752db4af3cd369fd6a2fd81cdace143bec6a65e8a
4
+ data.tar.gz: c070646158a61e2a19f4c017f13afd8e8a411bd8900098355e10a9813f0e58a5
5
5
  SHA512:
6
- metadata.gz: 3da6e923981ae78800c88dbedd6ec0bf6e285f1bb5972ca73310901c5483fbe7475f8532bcf35f0aa1e02209db6bb1a56b03bc687ee1df07001f62139e781647
7
- data.tar.gz: 8d1ab76d5137b79c8d05630d446a4debe18577494fb5c60dea668ac7a145b9278210b826b6733763b944fa7e9fb88cc3c5a85cafe0877d7df265ced088bb2d24
6
+ metadata.gz: f46ab3c6660d66ace5c5c53b7f7fb55a8a9a1135e8a54f41e9731e798518ca4e67893f39a9434f71721fbb21b9a5db1d9102cde3849211a2473e1485d589a46a
7
+ data.tar.gz: 5d4465001902e64df88e130f04a9a49cdc899e01cddc1b931155dad608c662c762e69f693127f28abca2b2b22777379ed8381a4688c94160a09ac8842364a685
data/cloudenv-hq.gemspec CHANGED
@@ -1,18 +1,18 @@
1
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"
2
+ s.name = 'cloudenv-hq'
3
+ s.version = '0.2.5'
4
+ s.license = 'MIT'
5
+ s.date = '2020-10-10'
6
+ s.summary = 'Keep your ENV vars synced between your team members'
7
+ s.email = 'support@cloudenv.com'
8
+ s.homepage = 'https://github.com/cloudenvhq/cloudenv-ruby'
9
+ s.description = 'Keep your ENV vars synced between your team members.'
10
+ s.authors = ['Lucas Carlson']
11
+ s.files = ['install.rb', 'lib', 'lib/cloudenv-hq.rb', 'LICENSE', 'Rakefile', 'README.markdown', 'cloudenv-hq.gemspec',
12
+ '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
18
  end
data/lib/cloudenv-hq.rb CHANGED
@@ -1,44 +1,54 @@
1
- require "pathname"
2
- require "dotenv"
1
+ require 'pathname'
2
+ require 'dotenv'
3
+ require 'tempfile'
4
+ require 'yaml'
3
5
 
4
6
  class CloudenvHQ
5
- VERSION = "0.1.0".freeze
7
+ VERSION = '0.2.5'.freeze
6
8
 
7
- API_HOST = "https://app.cloudenv.com".freeze
8
- READ_PATH = "/api/v1/envs".freeze
9
+ API_HOST = 'https://app.cloudenv.com'.freeze
10
+ READ_PATH = '/api/v1/envs'.freeze
9
11
 
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"
12
+ def initialize(options = {})
13
+ @environment = ENV['RAILS_ENV'] || ENV['RACK_ENV']
14
+ @bearer = ENV['CLOUDENV_BEARER_TOKEN'] || `cat #{options[:bearer] || '~/.cloudenvrc'}`.strip
15
+ @secret_key_filename = '.cloudenv-secret-key'
14
16
  @secret_key = Pathname.new(@secret_key_filename)
15
17
 
16
- until File.exists?(@secret_key) || @secret_key.expand_path == Pathname.new("/.cloudenv-secret-key")
18
+ until File.exist?(@secret_key) || @secret_key.expand_path == Pathname.new('/.cloudenv-secret-key')
17
19
  @secret_key = @secret_key.parent.parent + @secret_key_filename
18
20
  end
19
21
 
20
- if File.exists?(@secret_key)
21
- @app, @secret_key = IO.read(@secret_key).split
22
+ if File.exist?(@secret_key)
23
+ data = YAML.safe_load(IO.read(@secret_key))
22
24
 
25
+ @app = data['slug']
26
+ @secret_key = data['secret-key']
27
+ else
28
+ @app = ENV['CLOUDENV_APP_SLUG']
29
+ @secret_key = ENV['CLOUDENV_APP_SECRET_KEY']
30
+ end
31
+
32
+ if @app && @secret_key
23
33
  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")
34
+ data = `curl -s -H "Authorization: Bearer #{@bearer}" "https://app.cloudenv.com/api/v1/envs?name=#{@app}&environment=#{@environment}&version=#{VERSION}&lang=ruby" | openssl enc -a -aes-256-cbc -md sha512 -d -pass pass:"#{@secret_key}" 2> /dev/null`
35
+ file = Tempfile.new('cloudenv')
26
36
  file.write(data)
27
37
  file.close
28
38
  Dotenv.load(file.path)
29
39
  file.unlink
30
40
  end
31
41
 
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")
42
+ data = `curl -s -H "Authorization: Bearer #{@bearer}" "https://app.cloudenv.com/api/v1/envs?name=#{@app}&environment=default&version=#{VERSION}&lang=ruby" | openssl enc -a -aes-256-cbc -md sha512 -d -pass pass:"#{@secret_key}" 2> /dev/null`
43
+ file = Tempfile.new('cloudenv')
34
44
  file.write(data)
35
45
  file.close
36
46
  Dotenv.load(file.path)
37
47
  file.unlink
38
48
  else
39
- warn "WARNING: cloudenv could not find a .cloudenv-secret-key in the directory path"
49
+ warn 'WARNING: cloudenv could not find a .cloudenv-secret-key in the directory path or values for both ENV["CLOUDENV_APP_SLUG"] and ENV["CLOUDENV_APP_SECRET_KEY"]'
40
50
  end
41
51
  end
42
52
  end
43
53
 
44
- CloudenvHQ.new(bearer: ENV["CLOUDENV_BEARER_PATH"])
54
+ CloudenvHQ.new(bearer: ENV['CLOUDENV_BEARER_PATH'])
@@ -1,82 +1,5 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
  class BaseTest < Test::Unit::TestCase
3
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
4
  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
5
  end
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudenv-hq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucas Carlson
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2020-10-10 00:00:00.000000000 Z
@@ -84,7 +84,7 @@ homepage: https://github.com/cloudenvhq/cloudenv-ruby
84
84
  licenses:
85
85
  - MIT
86
86
  metadata: {}
87
- post_install_message:
87
+ post_install_message:
88
88
  rdoc_options: []
89
89
  require_paths:
90
90
  - lib
@@ -99,8 +99,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  - !ruby/object:Gem::Version
100
100
  version: '0'
101
101
  requirements: []
102
- rubygems_version: 3.0.3
103
- signing_key:
102
+ rubygems_version: 3.2.3
103
+ signing_key:
104
104
  specification_version: 4
105
105
  summary: Keep your ENV vars synced between your team members
106
106
  test_files: []