cloudcrypt 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,14 +1,39 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cloudcrypt (0.0.1)
4
+ cloudcrypt (0.0.4)
5
+ fog
6
+ rubyzip
7
+ trollop
5
8
 
6
9
  GEM
7
10
  remote: http://rubygems.org/
8
11
  specs:
12
+ builder (2.1.2)
13
+ excon (0.3.6)
14
+ fog (0.3.34)
15
+ builder
16
+ excon (>= 0.3.6)
17
+ formatador (>= 0.0.16)
18
+ json
19
+ mime-types
20
+ net-ssh (>= 2.0.23)
21
+ nokogiri (>= 1.4.4)
22
+ ruby-hmac
23
+ formatador (0.0.16)
24
+ json (1.4.6)
25
+ mime-types (1.16)
26
+ net-ssh (2.0.23)
27
+ nokogiri (1.4.4)
28
+ ruby-hmac (0.4.0)
29
+ rubyzip (0.9.4)
30
+ trollop (1.16.2)
9
31
 
10
32
  PLATFORMS
11
33
  ruby
12
34
 
13
35
  DEPENDENCIES
14
36
  cloudcrypt!
37
+ fog
38
+ rubyzip
39
+ trollop
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- require 'bundler'
1
+ require 'bundler/setup'
2
2
  require 'date'
3
3
 
4
4
  Bundler::GemHelper.install_tasks
data/bin/cloudcrypt.rb CHANGED
@@ -1,74 +1,73 @@
1
1
  #!/usr/bin/env ruby
2
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
3
- require 'cloudcrypt'
4
-
2
+ # you can't use require 'cloudcrypt'
3
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'cloudcrypt'))
5
4
 
6
5
  RAVE_BUCKET='ec2admin-software-installation-rave-5.6.3'
7
- def is_mac?
8
- # universal-darwin9.0 shows up for RUBY_PLATFORM on os X leopard with the bundled ruby.
9
- # Installing ruby in different manners may give a different result, so beware.
10
- # Examine the ruby platform yourself. If you see other values please comment
11
- # in the snippet on dzone and I will add them.
12
- RUBY_PLATFORM.downcase.include?("darwin")
13
- end
14
-
15
- def is_windows?
16
- RUBY_PLATFORM.downcase.include?("mingw32")
17
- end
18
-
19
- if is_mac?
20
- # MAC
21
- PUBLIC_KEY='/Users/restebanez/id_nodemanager.pub'
22
- PRIVATE_KEY='/Users/restebanez/id_nodemanager'
23
- TMP='/tmp'
24
- elsif is_windows?
25
-
26
- # Windows
27
- PUBLIC_KEY='C:\Users\Administrator\.chef\id_nodemanager'
28
- PRIVATE_KEY='C:\Users\Administrator\.chef\id_nodemanager'
29
- TMP=ENV['TMP']
30
- require 'win32/registry.rb'
31
- require 'Win32API'
32
- if ENV['RAVE_RW_AWS_ACCESS_KEY_ID'].nil? || ENV['RAVE_RW_AWS_SECRET_ACCESS_KEY'].nil?
33
- puts "Let's set up some envioroment variables"
34
- puts "RAVE_RW_AWS_ACCESS_KEY_ID: "
35
- Win32::Registry::HKEY_CURRENT_USER.open('Environment', Win32::Registry::KEY_WRITE) do |reg|
36
- reg['RAVE_RW_AWS_ACCESS_KEY_ID'] = gets
37
- end
38
- puts "RAVE_RW_AWS_SECRET_ACCESS_KEY: "
39
- Win32::Registry::HKEY_CURRENT_USER.open('Environment', Win32::Registry::KEY_WRITE) do |reg|
40
- reg['RAVE_RW_AWS_SECRET_ACCESS_KEY'] = gets
41
- end
42
- # make environmental variables available immediately
43
- # http://stackoverflow.com/questions/190168/persisting-an-environment-variable-through-ruby
44
- SendMessageTimeout = Win32API.new('user32', 'SendMessageTimeout', 'LLLPLLP', 'L')
45
- HWND_BROADCAST = 0xffff
46
- WM_SETTINGCHANGE = 0x001A
47
- SMTO_ABORTIFHUNG = 2
48
- result = 0
49
- SendMessageTimeout.call(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 'Environment', SMTO_ABORTIFHUNG, 5000, result)
50
- abort('Open a new powershell session and run it again')
51
- end
52
- else
53
- abort('OS not detectect!')
54
- end
55
-
56
- abort('Please set the variable RAVE_RW_AWS_ACCESS_KEY_ID and RAVE_RW_AWS_SECRET_ACCESS_KEY') if ENV['RAVE_RW_AWS_ACCESS_KEY_ID'].nil? || ENV['RAVE_RW_AWS_SECRET_ACCESS_KEY'].nil?
57
-
58
- AWS_ACCESS_KEY_ID=ENV['RAVE_RW_AWS_ACCESS_KEY_ID'].gsub(/\r?\n?/, "")
59
- AWS_SECRET_ACCESS_KEY=ENV['RAVE_RW_AWS_SECRET_ACCESS_KEY'].gsub(/\r?\n?/, "")
60
-
61
6
  ENCRYPTED_FILE_EXTENSION='.encrypted'
62
7
  ENCRYPTED_VI_EXTENSION='.vi'
63
8
  ENCRYPTED_KEY_EXTENSION='.key'
64
9
 
65
-
66
-
67
- params=ARGV
68
- cloudcrypt = Cloudcrypt::Parser.new
69
-
70
- if cloudcrypt.parse#(params)
71
- exit 0
72
- else
73
- exit 1
10
+ unless ARGV.empty?
11
+ def is_mac?
12
+ # universal-darwin9.0 shows up for RUBY_PLATFORM on os X leopard with the bundled ruby.
13
+ # Installing ruby in different manners may give a different result, so beware.
14
+ # Examine the ruby platform yourself. If you see other values please comment
15
+ # in the snippet on dzone and I will add them.
16
+ RUBY_PLATFORM.downcase.include?("darwin")
17
+ end
18
+
19
+ def is_windows?
20
+ RUBY_PLATFORM.downcase.include?("mingw32")
21
+ end
22
+
23
+ if is_mac?
24
+ # MAC
25
+ PUBLIC_KEY='/Users/restebanez/id_nodemanager.pub'
26
+ PRIVATE_KEY='/Users/restebanez/id_nodemanager'
27
+ TMP='/tmp'
28
+ elsif is_windows?
29
+
30
+ # Windows
31
+ PUBLIC_KEY='C:\Users\Administrator\.chef\id_nodemanager'
32
+ PRIVATE_KEY='C:\Users\Administrator\.chef\id_nodemanager'
33
+ TMP=ENV['TMP']
34
+ require 'win32/registry.rb'
35
+ require 'Win32API'
36
+ if ENV['RAVE_RW_AWS_ACCESS_KEY_ID'].nil? || ENV['RAVE_RW_AWS_SECRET_ACCESS_KEY'].nil?
37
+ puts "Let's set up some envioroment variables"
38
+ puts "RAVE_RW_AWS_ACCESS_KEY_ID: "
39
+ Win32::Registry::HKEY_CURRENT_USER.open('Environment', Win32::Registry::KEY_WRITE) do |reg|
40
+ reg['RAVE_RW_AWS_ACCESS_KEY_ID'] = gets
41
+ end
42
+ puts "RAVE_RW_AWS_SECRET_ACCESS_KEY: "
43
+ Win32::Registry::HKEY_CURRENT_USER.open('Environment', Win32::Registry::KEY_WRITE) do |reg|
44
+ reg['RAVE_RW_AWS_SECRET_ACCESS_KEY'] = gets
45
+ end
46
+ # make environmental variables available immediately
47
+ # http://stackoverflow.com/questions/190168/persisting-an-environment-variable-through-ruby
48
+ SendMessageTimeout = Win32API.new('user32', 'SendMessageTimeout', 'LLLPLLP', 'L')
49
+ HWND_BROADCAST = 0xffff
50
+ WM_SETTINGCHANGE = 0x001A
51
+ SMTO_ABORTIFHUNG = 2
52
+ result = 0
53
+ SendMessageTimeout.call(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 'Environment', SMTO_ABORTIFHUNG, 5000, result)
54
+ abort('Open a new powershell session and run it again')
55
+ end
56
+ else
57
+ abort('OS not detectect!')
58
+ end
59
+
60
+ abort('Please set the variable RAVE_RW_AWS_ACCESS_KEY_ID and RAVE_RW_AWS_SECRET_ACCESS_KEY') if ENV['RAVE_RW_AWS_ACCESS_KEY_ID'].nil? || ENV['RAVE_RW_AWS_SECRET_ACCESS_KEY'].nil?
61
+
62
+ AWS_ACCESS_KEY_ID=ENV['RAVE_RW_AWS_ACCESS_KEY_ID'].gsub(/\r?\n?/, "")
63
+ AWS_SECRET_ACCESS_KEY=ENV['RAVE_RW_AWS_SECRET_ACCESS_KEY'].gsub(/\r?\n?/, "")
64
+
65
+
66
+
67
+
68
+
69
+ params=ARGV
70
+ cloudcrypt = Cloudcrypt::Parser.new
71
+
72
+ cloudcrypt.parse
74
73
  end
data/cloudcrypt.gemspec CHANGED
@@ -18,6 +18,9 @@ Gem::Specification.new do |s|
18
18
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
+ s.executables = ["cloudcrypt.rb"]
22
+ s.default_executable = 'cloudcrypt.rb'
23
+
21
24
  s.add_dependency('fog')
22
25
  s.add_dependency('rubyzip')
23
26
  s.add_dependency('trollop')
@@ -1,3 +1,3 @@
1
1
  module Cloudcrypt
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudcrypt
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Rodrigo Estebanez
@@ -15,13 +15,12 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-29 00:00:00 -05:00
19
- default_executable:
18
+ date: 2010-12-31 00:00:00 -05:00
19
+ default_executable: cloudcrypt.rb
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- name: fog
23
22
  prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
23
+ version_requirements: &id001 !ruby/object:Gem::Requirement
25
24
  none: false
26
25
  requirements:
27
26
  - - ">="
@@ -30,12 +29,12 @@ dependencies:
30
29
  segments:
31
30
  - 0
32
31
  version: "0"
32
+ requirement: *id001
33
+ name: fog
33
34
  type: :runtime
34
- version_requirements: *id001
35
35
  - !ruby/object:Gem::Dependency
36
- name: rubyzip
37
36
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
37
+ version_requirements: &id002 !ruby/object:Gem::Requirement
39
38
  none: false
40
39
  requirements:
41
40
  - - ">="
@@ -44,12 +43,12 @@ dependencies:
44
43
  segments:
45
44
  - 0
46
45
  version: "0"
46
+ requirement: *id002
47
+ name: rubyzip
47
48
  type: :runtime
48
- version_requirements: *id002
49
49
  - !ruby/object:Gem::Dependency
50
- name: trollop
51
50
  prerelease: false
52
- requirement: &id003 !ruby/object:Gem::Requirement
51
+ version_requirements: &id003 !ruby/object:Gem::Requirement
53
52
  none: false
54
53
  requirements:
55
54
  - - ">="
@@ -58,8 +57,9 @@ dependencies:
58
57
  segments:
59
58
  - 0
60
59
  version: "0"
60
+ requirement: *id003
61
+ name: trollop
61
62
  type: :runtime
62
- version_requirements: *id003
63
63
  description: You can't encrypt a file bigger than the private key. You first have to generate a random key and a random vector initialization to encrypt the file using a symmetrical algorithom. Later you use the private key to encrypt the random key and the random vector
64
64
  email:
65
65
  - restebanez@mdsol.com