yakg 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. data/Gemfile +3 -1
  2. data/Gemfile.lock +19 -21
  3. data/VERSION +1 -1
  4. data/lib/yakg/backend/macos-keychain.rb +226 -0
  5. data/lib/yakg/backend/netrc-fallback.rb +41 -0
  6. data/lib/yakg/backend.rb +6 -215
  7. data/lib/yakg.rb +8 -0
  8. data/vendor/gems/Gemfile +4 -0
  9. data/vendor/gems/Gemfile.lock +13 -0
  10. data/vendor/gems/installit.sh +33 -0
  11. data/vendor/gems/ruby/1.8/gems/corefoundation-0.2.0/CHANGELOG +12 -0
  12. data/vendor/gems/ruby/1.8/gems/corefoundation-0.2.0/LICENSE +8 -0
  13. data/vendor/gems/ruby/1.8/gems/corefoundation-0.2.0/README.md +40 -0
  14. data/vendor/gems/ruby/1.8/gems/corefoundation-0.2.0/lib/corefoundation/array.rb +123 -0
  15. data/vendor/gems/ruby/1.8/gems/corefoundation-0.2.0/lib/corefoundation/base.rb +197 -0
  16. data/vendor/gems/ruby/1.8/gems/corefoundation-0.2.0/lib/corefoundation/boolean.rb +25 -0
  17. data/vendor/gems/ruby/1.8/gems/corefoundation-0.2.0/lib/corefoundation/data.rb +42 -0
  18. data/vendor/gems/ruby/1.8/gems/corefoundation-0.2.0/lib/corefoundation/date.rb +32 -0
  19. data/vendor/gems/ruby/1.8/gems/corefoundation-0.2.0/lib/corefoundation/dictionary.rb +114 -0
  20. data/vendor/gems/ruby/1.8/gems/corefoundation-0.2.0/lib/corefoundation/extensions.rb +158 -0
  21. data/vendor/gems/ruby/1.8/gems/corefoundation-0.2.0/lib/corefoundation/null.rb +11 -0
  22. data/vendor/gems/ruby/1.8/gems/corefoundation-0.2.0/lib/corefoundation/number.rb +98 -0
  23. data/vendor/gems/ruby/1.8/gems/corefoundation-0.2.0/lib/corefoundation/string.rb +91 -0
  24. data/vendor/gems/ruby/1.8/gems/corefoundation-0.2.0/lib/corefoundation/version.rb +4 -0
  25. data/vendor/gems/ruby/1.8/gems/corefoundation-0.2.0/lib/corefoundation.rb +13 -0
  26. data/vendor/gems/ruby/1.8/gems/corefoundation-0.2.0/spec/array_spec.rb +92 -0
  27. data/vendor/gems/ruby/1.8/gems/corefoundation-0.2.0/spec/boolean_spec.rb +24 -0
  28. data/vendor/gems/ruby/1.8/gems/corefoundation-0.2.0/spec/data_spec.rb +30 -0
  29. data/vendor/gems/ruby/1.8/gems/corefoundation-0.2.0/spec/date_spec.rb +25 -0
  30. data/vendor/gems/ruby/1.8/gems/corefoundation-0.2.0/spec/dictionary_spec.rb +81 -0
  31. data/vendor/gems/ruby/1.8/gems/corefoundation-0.2.0/spec/extensions_spec.rb +127 -0
  32. data/vendor/gems/ruby/1.8/gems/corefoundation-0.2.0/spec/null_spec.rb +7 -0
  33. data/vendor/gems/ruby/1.8/gems/corefoundation-0.2.0/spec/number_spec.rb +52 -0
  34. data/vendor/gems/ruby/1.8/gems/corefoundation-0.2.0/spec/spec_helper.rb +10 -0
  35. data/vendor/gems/ruby/1.8/gems/corefoundation-0.2.0/spec/string_spec.rb +48 -0
  36. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/.require_paths +3 -0
  37. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/COPYING +674 -0
  38. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/COPYING.LESSER +165 -0
  39. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/History.txt +1 -0
  40. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/LICENSE +14 -0
  41. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/README.md +109 -0
  42. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/Rakefile +219 -0
  43. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/ffi.gemspec +22 -0
  44. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/gen/Rakefile +30 -0
  45. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/gen/log +1 -0
  46. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/autopointer.rb +184 -0
  47. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/buffer.rb +4 -0
  48. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/callback.rb +4 -0
  49. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/enum.rb +162 -0
  50. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/errno.rb +33 -0
  51. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/ffi.iml +11 -0
  52. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/ffi.rb +33 -0
  53. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/io.rb +52 -0
  54. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/library.rb +489 -0
  55. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/managedstruct.rb +55 -0
  56. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/memorypointer.rb +1 -0
  57. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/platform/arm-linux/types.conf +104 -0
  58. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/platform/i386-cygwin/types.conf +3 -0
  59. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/platform/i386-darwin/types.conf +100 -0
  60. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/platform/i386-freebsd/types.conf +152 -0
  61. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/platform/i386-linux/types.conf +103 -0
  62. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/platform/i386-netbsd/types.conf +126 -0
  63. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/platform/i386-openbsd/types.conf +126 -0
  64. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/platform/i386-solaris/types.conf +122 -0
  65. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/platform/i386-windows/types.conf +105 -0
  66. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/platform/i486-gnu/types.conf +107 -0
  67. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/platform/ia64-linux/types.conf +104 -0
  68. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/platform/mips-linux/types.conf +102 -0
  69. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/platform/mipsel-linux/types.conf +102 -0
  70. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/platform/powerpc-aix/types.conf +180 -0
  71. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/platform/powerpc-darwin/types.conf +100 -0
  72. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/platform/powerpc-linux/types.conf +100 -0
  73. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/platform/s390-linux/types.conf +102 -0
  74. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/platform/s390x-linux/types.conf +102 -0
  75. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/platform/sparc-linux/types.conf +102 -0
  76. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/platform/sparc-solaris/types.conf +128 -0
  77. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/platform/sparcv9-solaris/types.conf +128 -0
  78. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/platform/x86_64-darwin/types.conf +100 -0
  79. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/platform/x86_64-freebsd/types.conf +128 -0
  80. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/platform/x86_64-linux/types.conf +102 -0
  81. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/platform/x86_64-netbsd/types.conf +126 -0
  82. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/platform/x86_64-openbsd/types.conf +126 -0
  83. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/platform/x86_64-solaris/types.conf +122 -0
  84. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/platform/x86_64-windows/types.conf +27 -0
  85. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/platform.rb +139 -0
  86. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/pointer.rb +122 -0
  87. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/struct.rb +356 -0
  88. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/struct_layout_builder.rb +211 -0
  89. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/tools/const_generator.rb +229 -0
  90. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/tools/generator.rb +60 -0
  91. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/tools/generator_task.rb +36 -0
  92. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/tools/struct_generator.rb +194 -0
  93. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/tools/types_generator.rb +135 -0
  94. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/types.rb +177 -0
  95. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/union.rb +32 -0
  96. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/variadic.rb +65 -0
  97. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi/version.rb +4 -0
  98. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi.rb +28 -0
  99. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/lib/ffi_c.bundle +0 -0
  100. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/libtest/Benchmark.c +52 -0
  101. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/libtest/BoolTest.c +31 -0
  102. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/libtest/BufferTest.c +31 -0
  103. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/libtest/ClosureTest.c +190 -0
  104. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/libtest/EnumTest.c +34 -0
  105. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/libtest/FunctionTest.c +58 -0
  106. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/libtest/GNUmakefile +149 -0
  107. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/libtest/GlobalVariable.c +62 -0
  108. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/libtest/LastErrorTest.c +21 -0
  109. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/libtest/NumberTest.c +132 -0
  110. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/libtest/PointerTest.c +63 -0
  111. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/libtest/ReferenceTest.c +23 -0
  112. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/libtest/StringTest.c +34 -0
  113. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/libtest/StructTest.c +240 -0
  114. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/libtest/UnionTest.c +43 -0
  115. data/vendor/gems/ruby/1.8/gems/ffi-1.8.1/libtest/VariadicTest.c +62 -0
  116. data/vendor/gems/ruby/1.8/specifications/corefoundation-0.2.0.gemspec +44 -0
  117. data/vendor/gems/ruby/1.8/specifications/ffi-1.8.1.gemspec +43 -0
  118. metadata +115 -3
@@ -0,0 +1,127 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'spec_helper'
3
+
4
+ describe 'extensions' do
5
+ context 'with an integer' do
6
+ it 'should return a cfnumber' do
7
+ 1.to_cf.should be_a(CF::Number)
8
+ end
9
+ end
10
+
11
+ context 'with a float' do
12
+ it 'should return a cfnumber' do
13
+ (1.0).to_cf.should be_a(CF::Number)
14
+ end
15
+ end
16
+
17
+ describe String do
18
+ uber = [195, 188, 98, 101, 114]
19
+
20
+ describe 'to_cf' do
21
+
22
+ unless defined? RUBY_ENGINE and RUBY_ENGINE == 'jruby'
23
+ context 'with data incorrectly marked as non binary' do
24
+ it 'returns nil' do
25
+ [0xff, 0xff, 0xff].pack("C*").binary!(false).to_cf.should be_nil
26
+ end
27
+ end
28
+ end
29
+
30
+ context 'with a non binary string' do
31
+ it 'should return a cf string' do
32
+ '123'.to_cf.should be_a(CF::String)
33
+ end
34
+ end
35
+
36
+ context 'with a string marked as binary' do
37
+ it 'should return a cf data' do
38
+ '123'.binary!.to_cf.should be_a(CF::Data)
39
+ end
40
+ end
41
+
42
+ context 'with a binary string' do
43
+ it 'should return a cf data' do
44
+ [0xff, 0xff, 0xff].pack("C*").to_cf.should be_a(CF::Data)
45
+ end
46
+ end
47
+
48
+ context 'with a utf-8 string' do
49
+ it 'should return a cfstring' do
50
+ uber.pack("C*").should_not be_a(CF::String)
51
+ end
52
+ end
53
+ end
54
+
55
+ describe 'binary?' do
56
+
57
+ it 'should return false on a plain ascii string' do
58
+ '123'.should_not be_binary
59
+ end
60
+
61
+ if CF::String::HAS_ENCODING
62
+ it 'should return false on valid utf data' do
63
+ "\xc3\xc9".should_not be_binary
64
+ end
65
+ else
66
+ it 'should return false on valid utf data' do
67
+ uber.pack("C*").should_not be_binary
68
+ end
69
+ end
70
+
71
+ it 'should return false on string forced to non binary' do
72
+ "\xc3\xc9".binary!(false).should_not be_binary
73
+ end
74
+
75
+ it 'should return true if binary! has been called' do
76
+ '123'.binary!.should be_binary
77
+ end
78
+
79
+ if CF::String::HAS_ENCODING
80
+ it 'should return true for ascii 8bit strings' do
81
+ '123'.encode(Encoding::ASCII_8BIT).should be_binary
82
+ end
83
+ else
84
+ it 'should return true for data that cannot be converted to utf8' do
85
+ "\xff\xff\xff".should be_binary
86
+ end
87
+ end
88
+ end
89
+
90
+ end
91
+
92
+ context 'with true' do
93
+ it 'should return CF::Boolean::TRUE' do
94
+ true.to_cf.should == CF::Boolean::TRUE
95
+ end
96
+ end
97
+
98
+ context 'with false' do
99
+ it 'should return CF::Boolean::FALSE' do
100
+ false.to_cf.should == CF::Boolean::FALSE
101
+ end
102
+ end
103
+
104
+ context 'with a time' do
105
+ it 'should return a CFDate' do
106
+ Time.now.to_cf.should be_a(CF::Date)
107
+ end
108
+ end
109
+
110
+ context 'with an array' do
111
+ it 'should return a cfarray containing cf objects' do
112
+ cf_array = [true, 1, 'hello'].to_cf
113
+ cf_array.should be_a(CF::Array)
114
+ cf_array[0].should == CF::Boolean::TRUE
115
+ cf_array[1].should be_a(CF::Number)
116
+ cf_array[2].should == CF::String.from_string('hello')
117
+ end
118
+ end
119
+
120
+ context 'with a dictionary' do
121
+ it 'should return a cfdictionary containing cf objects' do
122
+ cf_hash = {'key_1' => true, 'key_2' => false}.to_cf
123
+ cf_hash['key_1'].should == CF::Boolean::TRUE
124
+ cf_hash['key_2'].should == CF::Boolean::FALSE
125
+ end
126
+ end
127
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe CF::Null do
4
+ it 'should be null' do
5
+ CF::NULL.should be_null
6
+ end
7
+ end
@@ -0,0 +1,52 @@
1
+ require 'spec_helper'
2
+
3
+ describe CF::Number do
4
+
5
+ describe 'to_ruby' do
6
+ context 'with a number created from a float' do
7
+ subject {CF::Number.from_f('3.1415')}
8
+ it 'should return a float' do
9
+ subject.to_ruby.should be_within(0.0000001).of(3.14150)
10
+ end
11
+ end
12
+ context 'with a number created from a int' do
13
+ subject {CF::Number.from_i('31415')}
14
+ it 'should return a int' do
15
+ subject.to_ruby.should == 31415
16
+ subject.to_ruby.should be_a(Integer)
17
+ end
18
+ end
19
+ end
20
+
21
+ it 'should be comparable' do
22
+ (CF::Number.from_f('3.1415') <= CF::Number.from_i(4)).should be_true
23
+ end
24
+
25
+ describe('from_f') do
26
+ it 'should create a cf number from a float' do
27
+ CF::Number.from_f('3.1415').should be_a(CF::Number)
28
+ end
29
+ end
30
+
31
+ describe('from_i') do
32
+ it 'should create a cf number from a 32 bit sized int' do
33
+ CF::Number.from_i(2**30).should be_a(CF::Number)
34
+ end
35
+
36
+ it 'should create a cf number from a 64 bit sized int' do
37
+ CF::Number.from_i(2**60).should be_a(CF::Number)
38
+ end
39
+ end
40
+
41
+ describe('to_i') do
42
+ it 'should return a ruby integer representing the cfnumber' do
43
+ CF::Number.from_i(2**60).to_i.should == 2**60
44
+ end
45
+ end
46
+
47
+ describe('to_f') do
48
+ it 'should return a ruby float representing the cfnumber' do
49
+ CF::Number.from_f(3.1415).to_f.should be_within(0.0000001).of(3.14150)
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+
4
+ $: << File.dirname(__FILE__) + '/../lib'
5
+
6
+ require 'corefoundation'
7
+
8
+ RSpec.configure do |config|
9
+
10
+ end
@@ -0,0 +1,48 @@
1
+ require 'spec_helper'
2
+
3
+ describe CF::String do
4
+
5
+ describe 'from_string' do
6
+ it 'should return a CF::String' do
7
+ CF::String.from_string('A CF string').should be_a(CF::String)
8
+ end
9
+
10
+ # The intent is to force feed CF::String with an invalid utf-8 string
11
+ # but jruby doesn't seem to allow this to be constructed
12
+ unless defined? RUBY_ENGINE and RUBY_ENGINE == 'jruby'
13
+ context 'with invalid data' do
14
+ it 'returns nil' do
15
+ if CF::String::HAS_ENCODING
16
+ CF::String.from_string("\xff\xff\xff".force_encoding('UTF-8')).should be_nil
17
+ else
18
+ CF::String.from_string("\xff\xff\xff").should be_nil
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+
25
+ describe '#to_s' do
26
+ it 'should return a utf ruby string' do
27
+ ruby_string = CF::String.from_string('A CF string').to_s
28
+ ruby_string.should == 'A CF string'
29
+ if CF::String::HAS_ENCODING
30
+ ruby_string.encoding.should == Encoding::UTF_8
31
+ else
32
+ end
33
+ end
34
+ end
35
+
36
+ describe 'to_ruby' do
37
+ it 'should behave like to_s' do
38
+ CF::String.from_string('A CF string').to_ruby.should == 'A CF string'
39
+ if CF::String::HAS_ENCODING
40
+ CF::String.from_string('A CF string').to_ruby.encoding.should == Encoding::UTF_8
41
+ end
42
+ end
43
+ end
44
+
45
+ it 'should be comparable' do
46
+ CF::String.from_string('aaa').should <= CF::String.from_string('zzz')
47
+ end
48
+ end
@@ -0,0 +1,3 @@
1
+ lib
2
+ ext/ffi_c
3
+ bin