fvm 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,57 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
2
+ "http://www.w3.org/TR/html4/strict.dtd">
3
+
4
+ <html lang="en">
5
+ <head>
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
7
+ <title>Simplified</title>
8
+ <meta name="generator" content="TextMate http://macromates.com/">
9
+ <meta name="author" content="Jeremy Ruppel">
10
+ <!-- Date: 2011-02-16 -->
11
+ </head>
12
+ <body>
13
+ <p>Some Text can go here</p>
14
+ <p>All h3's seem to be table headers</p>
15
+
16
+ <h3><a name="DownloadFlexHero-MilestoneBuilds"></a> Table Name </h3>
17
+ <p>There can be text after the header.</p>
18
+
19
+ <div class='table-wrap'>
20
+ <table class='confluenceTable'><tbody>
21
+ <tr>
22
+ <th class='confluenceTh'> Header</th>
23
+ <th class='confluenceTh'>Version </th>
24
+ <th class='confluenceTh'> One More </th>
25
+ </tr>
26
+ <tr>
27
+ <td class='confluenceTd'> Header Value </td>
28
+ <td class='confluenceTd'> 1.2.3.4567 </td>
29
+ <td class='confluenceTd'> <a href="http://download?build=1.2.3.4567&amp;pkgtype=1" class="external-link" rel="nofollow"> This one's a link </a> </td>
30
+ </tr>
31
+ <tr>
32
+ <td class='confluenceTd'> Second Header Value </td>
33
+ <td class='confluenceTd'> 1.2.3.1234 </td>
34
+ <td class='confluenceTd'> <a href="http://download?build=1.2.3.1234&amp;pkgtype=1" class="external-link" rel="nofollow"> This one's another link </a> </td>
35
+ </tr>
36
+ </tbody></table>
37
+ </div>
38
+
39
+ <h3><a name="DownloadFlexHero-MilestoneBuilds"></a> Second Table Name </h3>
40
+ <div class='table-wrap'>
41
+ <table class='confluenceTable'><tbody>
42
+ <tr>
43
+ <th class='confluenceTh'>Different Header</th>
44
+ <th class='confluenceTh'>Version</th>
45
+ <th class='confluenceTh'>One More</th>
46
+ </tr>
47
+ <tr>
48
+ <td class='confluenceTd'> Different Header Value </td>
49
+ <td class='confluenceTd'> 2.3.4.5678 </td>
50
+ <td class='confluenceTd'> <a href="http://download?build=2.3.4.5678&amp;pkgtype=1" class="external-link" rel="nofollow"> This one's a link, too! </a> </td>
51
+ </tr>
52
+ </tbody></table>
53
+ </div>
54
+
55
+ <p>Also text can go here</p>
56
+ </body>
57
+ </html>
@@ -0,0 +1,35 @@
1
+ require "test/unit"
2
+
3
+ require "fvm/cli/build"
4
+
5
+ class TestFvmBuild < Test::Unit::TestCase
6
+ # download url is correct for a numeric sdk
7
+ def test_download_url_is_correct_for_a_numeric_sdk
8
+ build = Fvm::CLI::Build.new( :version => '1.2.3.4567', :sdk => 4 )
9
+ assert_equal( "http://fpdownload.adobe.com/pub/flex/sdk/builds/flex4/flex_sdk_1.2.3.4567_mpl.zip", build.zip_url )
10
+ end
11
+ # download url is correct for a word sdk
12
+ def test_download_url_is_correct_for_a_word_sdk
13
+ build = Fvm::CLI::Build.new( :version => '1.2.3.4567', :sdk => 'Hero' )
14
+ assert_equal( "http://fpdownload.adobe.com/pub/flex/sdk/builds/flexhero/flex_sdk_1.2.3.4567_mpl.zip", build.zip_url )
15
+ end
16
+ # responds to active?
17
+ def test_responds_to_active?
18
+ assert_respond_to( Fvm::CLI::Build.new, :active? )
19
+ end
20
+ # responds to to_menu
21
+ def test_responds_to_to_menu
22
+ assert_respond_to( Fvm::CLI::Build.new, :to_menu )
23
+ end
24
+ # responds to spaceship
25
+ def test_responds_to_spaceship
26
+ assert_respond_to( Fvm::CLI::Build.new, :'<=>' )
27
+ end
28
+ # sorts correctly
29
+ def test_sorts_correctly
30
+ one = Fvm::CLI::Build.new( :version => '10.2.30' )
31
+ two = Fvm::CLI::Build.new( :version => '1.20.13' )
32
+ three = Fvm::CLI::Build.new( :version => '5.6.7' )
33
+ assert_equal( [ two, three, one ], [ one, two, three ].sort )
34
+ end
35
+ end
@@ -0,0 +1,37 @@
1
+ require "test/unit"
2
+
3
+ require "fvm/cli/installation"
4
+
5
+ class TestFvmCliInstallation < Test::Unit::TestCase
6
+ # setup
7
+ def setup
8
+ @installation = Fvm::CLI::Installation.new( 'parent/dirs/flex_sdk_1.2.3.4567' )
9
+ end
10
+ # dir returns expanded directory passed to constructor
11
+ def test_dir_returns_expanded_directory_passed_to_constructor
12
+ assert_equal( File.expand_path( 'parent/dirs/flex_sdk_1.2.3.4567' ), @installation.dir.to_s )
13
+ end
14
+ # version returns the version at the end of the dirname
15
+ def test_version_returns_the_version_at_the_end_of_the_dirname
16
+ assert_equal( '1.2.3.4567', @installation.version )
17
+ end
18
+ # responds to active?
19
+ def test_responds_to_active?
20
+ assert_respond_to( Fvm::CLI::Installation.new( '.' ), :active? )
21
+ end
22
+ # responds to to_menu
23
+ def test_responds_to_to_menu
24
+ assert_respond_to( Fvm::CLI::Installation.new( '.' ), :to_menu )
25
+ end
26
+ # responds to spaceship
27
+ def test_responds_to_spaceship
28
+ assert_respond_to( Fvm::CLI::Build.new, :'<=>' )
29
+ end
30
+ # sorts correctly
31
+ def test_sorts_correctly
32
+ one = Fvm::CLI::Installation.new( 'dir/flex_sdk_3.0.0.346' )
33
+ two = Fvm::CLI::Installation.new( 'dir/flex_sdk_1.10.3.9999' )
34
+ three = Fvm::CLI::Installation.new( 'dir/flex_sdk_1.2.3.4567' )
35
+ assert_equal( [ three, two, one ], [ one, two, three ].sort )
36
+ end
37
+ end
@@ -0,0 +1,33 @@
1
+ require "test/unit"
2
+
3
+ require "fvm/cli/linker"
4
+
5
+ class TestFvmCliLinker < Test::Unit::TestCase
6
+ # setup
7
+ def setup
8
+ @dir = Pathname.new( File.dirname( __FILE__ ) ).join( '../fixtures/linker' )
9
+ @linker = Fvm::CLI::Linker.new( @dir.to_s, [ 'executable' ] )
10
+ end
11
+ # teardown
12
+ def teardown
13
+ Dir[ File.join( @linker.dir, '*' ) ].reject { |f| File.directory? f }.each { |f| File.delete f }
14
+ end
15
+ # finds correct list of files in the given directory
16
+ def test_finds_correct_list_of_files_in_the_given_directory
17
+ assert_equal( [ @dir.join( 'bin', 'executable' ).to_s ], @linker.files( @dir.join( 'bin' ) ) )
18
+ end
19
+ # creates symlinks for files found in the given directory
20
+ def test_creates_symlinks_for_files_found_in_the_given_directory
21
+ assert_equal( false, @dir.join( 'executable' ).exist? )
22
+ @linker.link( @dir.join( 'bin' ) )
23
+ assert_equal( true, @dir.join( 'executable' ).exist? )
24
+ end
25
+ # can unlink all symlinks it has created
26
+ def test_can_unlink_all_symlinks_it_has_created
27
+ assert_equal( false, @dir.join( 'executable' ).exist? )
28
+ @linker.link( @dir.join( 'bin' ) )
29
+ assert_equal( true, @dir.join( 'executable' ).exist? )
30
+ @linker.unlink!
31
+ assert_equal( false, @dir.join( 'executable' ).exist? )
32
+ end
33
+ end
@@ -0,0 +1,48 @@
1
+ require "test/unit"
2
+
3
+ require "fvm/manipulator"
4
+
5
+ class TestFvmManipulator < Test::Unit::TestCase
6
+ # setup
7
+ def setup
8
+ @manipulator = Fvm::Manipulator.new
9
+ @html = Nokogiri::HTML( IO.read( 'test/fixtures/parser/Simplified.html' ) )
10
+ end
11
+ # title node is formatted properly
12
+ def test_title_node_is_formatted_properly
13
+ assert_equal( 'Table Name', @manipulator.title( @html.at( Fvm::Parser::HEADER_XPATH ) ) )
14
+ end
15
+ # header node is formatted properly
16
+ def test_header_node_is_formatted_properly
17
+ assert_equal( [ 'Header', 'Version', 'One More' ], @manipulator.headers( @html.at( Fvm::Parser::TABLE_XPATH ) ) )
18
+ end
19
+ # rows node is formatted properly
20
+ def test_rows_node_is_formatted_properly
21
+ assert_equal( 2, @manipulator.rows( @html.at( Fvm::Parser::TABLE_XPATH ) ).size )
22
+ end
23
+ # first row is formatted properly
24
+ def test_first_row_is_formatted_properly
25
+ row = @manipulator.rows( @html.at( Fvm::Parser::TABLE_XPATH ) ).first
26
+ assert_equal( [ 'Header Value', '1.2.3.4567', 'http://download?build=1.2.3.4567&amp;pkgtype=1' ], row )
27
+ end
28
+ # table is formatted properly
29
+ def test_table_is_formatted_properly
30
+ table = [ ]
31
+
32
+ table << { }.tap do |row|
33
+ row[ 'Header' ] = 'Header Value'
34
+ row[ 'Version' ] = '1.2.3.4567'
35
+ row[ 'One More' ] = 'http://download?build=1.2.3.4567&amp;pkgtype=1'
36
+ row.sort
37
+ end
38
+
39
+ table << { }.tap do |row|
40
+ row[ 'Header' ] = 'Second Header Value'
41
+ row[ 'Version' ] = '1.2.3.1234'
42
+ row[ 'One More' ] = 'http://download?build=1.2.3.1234&amp;pkgtype=1'
43
+ row.sort
44
+ end
45
+
46
+ assert_equal( table, @manipulator.table( @html.at( Fvm::Parser::TABLE_XPATH ) ) )
47
+ end
48
+ end
@@ -0,0 +1,35 @@
1
+ require "test/unit"
2
+
3
+ require "fvm/parser"
4
+
5
+ class TestFvmParser < Test::Unit::TestCase
6
+ # setup
7
+ def setup
8
+ @result = Fvm::Parser.new.parse( Nokogiri::HTML( IO.read( 'test/fixtures/parser/Simplified.html' ) ) )
9
+ end
10
+ # has correct number of keys
11
+ def test_has_correct_number_of_keys
12
+ assert_equal( 2, @result.keys.size )
13
+ end
14
+ # has correct keys
15
+ def test_has_correct_keys
16
+ assert_equal( [ 'Table Name', 'Second Table Name' ].sort, @result.keys.sort )
17
+ end
18
+ # values are arrays of hashes
19
+ def test_values_are_arrays_of_hashes
20
+ @result.values.each do |table|
21
+ assert_instance_of( Array, table )
22
+ table.each do |entry|
23
+ assert_instance_of( Hash, entry )
24
+ end
25
+ end
26
+ end
27
+ # first table has correct length
28
+ def test_first_table_has_correct_length
29
+ assert_equal( 1, @result.values.first.size )
30
+ end
31
+ # second table has correct length
32
+ def test_second_table_has_correct_length
33
+ assert_equal( 2, @result.values.last.size )
34
+ end
35
+ end
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby -wKU
2
+
3
+ require 'test/unit'
4
+
5
+ require 'fvm'
6
+
7
+ Dir[ File.join( File.dirname( __FILE__ ), 'fvm/**/test_*.rb' ) ].each { |t| require t }
metadata ADDED
@@ -0,0 +1,206 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fvm
3
+ version: !ruby/object:Gem::Version
4
+ hash: 19
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 4
10
+ version: 0.1.4
11
+ platform: ruby
12
+ authors:
13
+ - Jeremy Ruppel
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-02-24 00:00:00 -08:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: thor
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - "="
28
+ - !ruby/object:Gem::Version
29
+ hash: 33
30
+ segments:
31
+ - 0
32
+ - 14
33
+ - 3
34
+ version: 0.14.3
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: highline
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 1
48
+ - 6
49
+ version: "1.6"
50
+ type: :runtime
51
+ version_requirements: *id002
52
+ - !ruby/object:Gem::Dependency
53
+ name: nokogiri
54
+ prerelease: false
55
+ requirement: &id003 !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ~>
59
+ - !ruby/object:Gem::Version
60
+ hash: 15
61
+ segments:
62
+ - 1
63
+ - 4
64
+ - 4
65
+ version: 1.4.4
66
+ type: :runtime
67
+ version_requirements: *id003
68
+ - !ruby/object:Gem::Dependency
69
+ name: activeresource
70
+ prerelease: false
71
+ requirement: &id004 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ hash: 15
77
+ segments:
78
+ - 3
79
+ - 0
80
+ - 4
81
+ version: 3.0.4
82
+ type: :runtime
83
+ version_requirements: *id004
84
+ - !ruby/object:Gem::Dependency
85
+ name: geoffrey
86
+ prerelease: false
87
+ requirement: &id005 !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ~>
91
+ - !ruby/object:Gem::Version
92
+ hash: 21
93
+ segments:
94
+ - 1
95
+ - 1
96
+ - 3
97
+ version: 1.1.3
98
+ type: :runtime
99
+ version_requirements: *id005
100
+ - !ruby/object:Gem::Dependency
101
+ name: versionomy
102
+ prerelease: false
103
+ requirement: &id006 !ruby/object:Gem::Requirement
104
+ none: false
105
+ requirements:
106
+ - - ~>
107
+ - !ruby/object:Gem::Version
108
+ hash: 15
109
+ segments:
110
+ - 0
111
+ - 4
112
+ - 0
113
+ version: 0.4.0
114
+ type: :runtime
115
+ version_requirements: *id006
116
+ description: Flex SDK version manager
117
+ email:
118
+ - jeremy.ruppel@gmail.com
119
+ executables:
120
+ - fvm
121
+ extensions: []
122
+
123
+ extra_rdoc_files: []
124
+
125
+ files:
126
+ - .gitignore
127
+ - Gemfile
128
+ - README.md
129
+ - Rakefile
130
+ - bin/fvm
131
+ - fvm.gemspec
132
+ - lib/fvm.rb
133
+ - lib/fvm/cli/build.rb
134
+ - lib/fvm/cli/driver.rb
135
+ - lib/fvm/cli/installation.rb
136
+ - lib/fvm/cli/installer.rb
137
+ - lib/fvm/cli/linker.rb
138
+ - lib/fvm/cli/shell.rb
139
+ - lib/fvm/cli/thor.rb
140
+ - lib/fvm/manipulator.rb
141
+ - lib/fvm/parser.rb
142
+ - lib/fvm/version.rb
143
+ - scripts/fvm
144
+ - test/fixtures/confirmer/Confirmation.html
145
+ - test/fixtures/linker/bin/executable
146
+ - test/fixtures/linker/bin/not_executable
147
+ - test/fixtures/linker/bin/shell_script.sh
148
+ - test/fixtures/parser/Flex_SDK_3.html
149
+ - test/fixtures/parser/Flex_SDK_4.html
150
+ - test/fixtures/parser/Flex_SDK_Hero.html
151
+ - test/fixtures/parser/Simplified.html
152
+ - test/fvm/test_build.rb
153
+ - test/fvm/test_installation.rb
154
+ - test/fvm/test_linker.rb
155
+ - test/fvm/test_manipulator.rb
156
+ - test/fvm/test_parser.rb
157
+ - test/test_helper.rb
158
+ has_rdoc: true
159
+ homepage: https://github.com/SFCRD/fvm
160
+ licenses: []
161
+
162
+ post_install_message:
163
+ rdoc_options: []
164
+
165
+ require_paths:
166
+ - lib
167
+ required_ruby_version: !ruby/object:Gem::Requirement
168
+ none: false
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ hash: 3
173
+ segments:
174
+ - 0
175
+ version: "0"
176
+ required_rubygems_version: !ruby/object:Gem::Requirement
177
+ none: false
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ hash: 3
182
+ segments:
183
+ - 0
184
+ version: "0"
185
+ requirements: []
186
+
187
+ rubyforge_project:
188
+ rubygems_version: 1.5.2
189
+ signing_key:
190
+ specification_version: 3
191
+ summary: Flex SDK version manager
192
+ test_files:
193
+ - test/fixtures/confirmer/Confirmation.html
194
+ - test/fixtures/linker/bin/executable
195
+ - test/fixtures/linker/bin/not_executable
196
+ - test/fixtures/linker/bin/shell_script.sh
197
+ - test/fixtures/parser/Flex_SDK_3.html
198
+ - test/fixtures/parser/Flex_SDK_4.html
199
+ - test/fixtures/parser/Flex_SDK_Hero.html
200
+ - test/fixtures/parser/Simplified.html
201
+ - test/fvm/test_build.rb
202
+ - test/fvm/test_installation.rb
203
+ - test/fvm/test_linker.rb
204
+ - test/fvm/test_manipulator.rb
205
+ - test/fvm/test_parser.rb
206
+ - test/test_helper.rb