terrimporter 0.3.0 → 0.4.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.
@@ -2,94 +2,18 @@ require "helper"
2
2
 
3
3
  class TestImporter < Test::Unit::TestCase
4
4
  def setup
5
- create_test_configuration_file
6
5
  @importer = TerrImporter::Importer.new
7
- #todo mock load config with different path
8
6
  end
9
7
 
10
8
  def teardown
11
- delete_test_configuration_file
12
- end
13
9
 
14
- =begin
15
- context 'configuration missing' do
16
- setup {}
17
- teardown {}
18
-
19
- should 'raise an error on missing configuration' do
20
- assert_raise TerrImporter::ConfigurationError do
21
- TerrImporter::Importer.new
22
- puts "raised"
23
- end
24
- end
25
- end
26
- =end
27
-
28
- context 'configuration loading' do
29
- should 'get the current working directory as config file path' do
30
- config_in_cwd = File.join(Dir.pwd, TerrImporter::CONFIG_DEFAULT_NAME)
31
- assert_equal config_in_cwd, @importer.send(:config_file_path)
32
- end
33
-
34
- should 'get a configured directory path with the configuration file included' do
35
- assert_equal @test_configuration_file, @importer.send(:config_file_path, @tmp_dir_path)
36
- end
37
-
38
- should 'throw an exception on non existing config' do
39
- assert_raise TerrImporter::ConfigurationError do
40
- @importer.send(:init_config, File.join('does/not/exist'))
41
- end
42
- end
43
10
  end
44
11
 
45
- context 'configuration validation' do
46
- setup do
47
- @valid_config = YAML.load_file(@test_configuration_file)['terrific']
48
- end
49
-
50
- should 'see the copied original configuration as valid' do
51
- assert_nothing_raised do
52
- @importer.send(:validate_config, @valid_config)
53
- end
54
- end
55
-
56
- should 'get a configuration error if trying to do something unsupported' do
57
- invalid_bits = {
58
- 'downloader' => 'something',
59
- 'url' => 'invalidurl', #todo invalid url check not sane!!!!
60
- 'version' => '',
61
- 'app_path' => '',
62
- 'export_path' => '',
63
- 'image_base_path' => '',
64
- 'stylesheets' => {'styles' => ['should_t_have_css_ext.css']},
65
- 'javascripts' => {'dynamic_libraries' => ['should_t_have_js_ext.js'],
66
- 'libraries_dest' => ''
67
- }
68
- }
69
-
70
- invalid_bits.each do |k, v|
71
- assert_raise TerrImporter::ConfigurationError do
72
- puts "Testing invalid configuration: #{k} => #{v}"
73
- @importer.send(:validate_config, @valid_config.merge({k => v}))
74
- end
75
- end
76
- end
12
+ should 'be a dummy test for more tests to follow....' do
13
+ assert true
77
14
  end
78
15
 
79
16
 
80
- def create_test_configuration_file
81
- example_configuration_path = File.join(File.dirname(__FILE__), '..', '..', 'config', TerrImporter::CONFIG_DEFAULT_NAME)
82
- @tmp_dir_path = File.join(File.dirname(__FILE__), '..', 'tmp')
83
- @test_configuration_path = File.join(@tmp_dir_path, TerrImporter::CONFIG_DEFAULT_NAME)
84
- FileUtils.mkdir(@tmp_dir_path) unless File.exist? @tmp_dir_path
85
- FileUtils.cp example_configuration_path, @test_configuration_path
86
- @test_configuration_file = @test_configuration_path
87
- end
88
-
89
- def delete_test_configuration_file
90
- FileUtils.rm_rf @test_configuration_file if File.exists? @test_configuration_file
91
- end
92
-
93
17
  end
94
18
 
95
19
 
@@ -3,7 +3,6 @@ require "helper"
3
3
  class TestOptions < Test::Unit::TestCase
4
4
 
5
5
  def setup_options(*arguments)
6
- #@input_file = "dummy.yml"
7
6
  @input_file = "testfile"
8
7
  @options = TerrImporter::Application::Options.new([@input_file] + arguments)
9
8
  end
@@ -11,33 +10,12 @@ class TestOptions < Test::Unit::TestCase
11
10
  def self.for_options(*options)
12
11
  context options.join(' ') do
13
12
  setup do
14
- wrap_out { setup_options *options }
13
+ setup_options *options
15
14
  end
16
15
  yield
17
16
  end
18
17
  end
19
18
 
20
- #todo not working
21
- def wrap_out
22
- original_stdout = $stdout
23
- original_stderr = $stderr
24
-
25
- fake_stdout = StringIO.new
26
- fake_stderr = StringIO.new
27
-
28
- $stdout = fake_stdout
29
- $stderr = fake_stderr
30
-
31
- begin
32
- yield if block_given?
33
- ensure
34
- $stdout = original_stdout
35
- $stderr = original_stderr
36
- end
37
- @stdout = fake_stdout.string
38
- @stderr = fake_stderr.string
39
- end
40
-
41
19
  context "default options" do
42
20
  setup { setup_options }
43
21
 
@@ -110,6 +88,7 @@ class TestOptions < Test::Unit::TestCase
110
88
  assert @options[:import_images]
111
89
  end
112
90
  end
91
+
113
92
  for_options '--help' do
114
93
  should 'show help' do
115
94
  assert @options[:show_help]
@@ -121,6 +100,7 @@ class TestOptions < Test::Unit::TestCase
121
100
  assert @options[:show_help]
122
101
  end
123
102
  end
103
+
124
104
  for_options '-v' do
125
105
  should 'show version' do
126
106
  #assert @stdout.include? "0.1.0"
@@ -135,4 +115,11 @@ class TestOptions < Test::Unit::TestCase
135
115
  end
136
116
  end
137
117
 
118
+ #todo test not working, code however is; find out the reason and correct possible bug
119
+ for_options '--config','param_config_file.yml', ' -a' do
120
+ should 'use supplied yml file for configuration' do
121
+ assert @options[:config_file].include?("param_config_file.yml")
122
+ end
123
+ end
124
+
138
125
  end
@@ -5,7 +5,7 @@ require "FileUtils"
5
5
  class TerrImporterTest < Test::Unit::TestCase
6
6
 
7
7
  def teardown
8
- FileUtils.rm_rf File.join(Dir.pwd, TerrImporter::CONFIG_DEFAULT_NAME)
8
+ FileUtils.rm_rf File.join(Dir.pwd, TerrImporter::Application::Configuration::CONFIG_DEFAULT_NAME)
9
9
  end
10
10
 
11
11
  should 'merge environment and argument options' do
@@ -20,8 +20,4 @@ class TerrImporterTest < Test::Unit::TestCase
20
20
  assert_contains merged_options, expected_options
21
21
  end
22
22
 
23
- should 'create a config file in the current directory' do
24
- TerrImporter::Application.create_config
25
- assert File.exists?(File.join(Dir.pwd, TerrImporter::CONFIG_DEFAULT_NAME))
26
- end
27
23
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terrimporter
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 3
8
+ - 4
9
9
  - 0
10
- version: 0.3.0
10
+ version: 0.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Daniel Kummer
@@ -18,7 +18,7 @@ cert_chain: []
18
18
  date: 2011-08-22 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- name: shoulda
21
+ name: kwalify
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
24
  none: false
@@ -29,12 +29,26 @@ dependencies:
29
29
  segments:
30
30
  - 0
31
31
  version: "0"
32
- type: :development
32
+ type: :runtime
33
33
  version_requirements: *id001
34
34
  - !ruby/object:Gem::Dependency
35
- name: bundler
35
+ name: shoulda
36
36
  prerelease: false
37
37
  requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ hash: 3
43
+ segments:
44
+ - 0
45
+ version: "0"
46
+ type: :development
47
+ version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
49
+ name: bundler
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
38
52
  none: false
39
53
  requirements:
40
54
  - - ~>
@@ -46,11 +60,11 @@ dependencies:
46
60
  - 0
47
61
  version: 1.0.0
48
62
  type: :development
49
- version_requirements: *id002
63
+ version_requirements: *id003
50
64
  - !ruby/object:Gem::Dependency
51
65
  name: jeweler
52
66
  prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
67
+ requirement: &id004 !ruby/object:Gem::Requirement
54
68
  none: false
55
69
  requirements:
56
70
  - - ~>
@@ -62,11 +76,11 @@ dependencies:
62
76
  - 4
63
77
  version: 1.6.4
64
78
  type: :development
65
- version_requirements: *id003
79
+ version_requirements: *id004
66
80
  - !ruby/object:Gem::Dependency
67
81
  name: rcov
68
82
  prerelease: false
69
- requirement: &id004 !ruby/object:Gem::Requirement
83
+ requirement: &id005 !ruby/object:Gem::Requirement
70
84
  none: false
71
85
  requirements:
72
86
  - - ">="
@@ -76,8 +90,8 @@ dependencies:
76
90
  - 0
77
91
  version: "0"
78
92
  type: :development
79
- version_requirements: *id004
80
- description: This gem allows terrific(http://terrifically.org/) project import of css, javascript and image files based on a command line tool and a configuration file.
93
+ version_requirements: *id005
94
+ description: This gem allows terrific(http://terrifically.org/ ) project import of css, javascript and image files based on a command line tool and a configuration file.
81
95
  email:
82
96
  - daniel.kummer@gmail.com
83
97
  executables:
@@ -96,27 +110,22 @@ files:
96
110
  - README.rdoc
97
111
  - Rakefile
98
112
  - bin/terrimporter
113
+ - config/schema.yml
99
114
  - config/terrimporter.config.yml
100
- - coverage/index.html
101
- - coverage/jquery-1.3.2.min.js
102
- - coverage/jquery.tablesorter.min.js
103
- - coverage/lib-app_logger_rb.html
104
- - coverage/lib-config_validator_rb.html
105
- - coverage/lib-configuration_rb.html
106
- - coverage/lib-importer_rb.html
107
- - coverage/lib-options_rb.html
108
- - coverage/lib-terrimporter_rb.html
109
- - coverage/print.css
110
- - coverage/rcov.js
111
- - coverage/screen.css
112
115
  - lib/app_logger.rb
116
+ - lib/config_validator.rb
117
+ - lib/configuration.rb
113
118
  - lib/importer.rb
114
119
  - lib/options.rb
115
120
  - lib/terrimporter.rb
116
121
  - lib/terrimporter/version.rb
122
+ - public/javascripts/base.js
123
+ - public/javascripts/pngfix.js
124
+ - public/javascripts/warning.js
117
125
  - terrimporter.gemspec
118
126
  - test/helper.rb
119
127
  - test/test_terrimporter.rb
128
+ - test/unit/test_configuration.rb
120
129
  - test/unit/test_importer.rb
121
130
  - test/unit/test_options.rb
122
131
  - test/unit/test_terrimporter.rb
@@ -156,6 +165,7 @@ summary: Import terrific javascripts, css files and images into a web project
156
165
  test_files:
157
166
  - test/helper.rb
158
167
  - test/test_terrimporter.rb
168
+ - test/unit/test_configuration.rb
159
169
  - test/unit/test_importer.rb
160
170
  - test/unit/test_options.rb
161
171
  - test/unit/test_terrimporter.rb
data/coverage/index.html DELETED
@@ -1,186 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
- <html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
3
- <head>
4
- <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
5
- <title>Terrimporter C0 Coverage Information - RCov</title>
6
- <link href="screen.css" media="all" rel="stylesheet" type="text/css" />
7
- <link href="print.css" media="print" rel="stylesheet" type="text/css" />
8
-
9
- <script type="text/javascript" src="jquery-1.3.2.min.js"></script>
10
- <script type="text/javascript" src="jquery.tablesorter.min.js"></script>
11
- <script type="text/javascript" src="rcov.js"></script>
12
- </head>
13
- <body>
14
- <h1>Terrimporter C0 Coverage Information - RCov</h1>
15
-
16
-
17
- <noscript><style type="text/css">.if_js { display:none; }</style></noscript>
18
-
19
- <div class="filters if_js">
20
- <fieldset>
21
- <label>File Filter:</label>
22
- <select id="file_filter" class="filter">
23
- <option value="all_files">Show All</option>
24
- <option value="lib">lib/</option>
25
- </select>
26
- </fieldset>
27
- <fieldset>
28
- <label>Code Coverage Threshold:</label>
29
- <select id="coverage_filter" class="filter">
30
- <option value="all_coverage">Show All</option>
31
- <option value="10">&lt; 10% Coverage</option><option value="20">&lt; 20% Coverage</option><option value="30">&lt; 30% Coverage</option><option value="40">&lt; 40% Coverage</option><option value="50">&lt; 50% Coverage</option><option value="60">&lt; 60% Coverage</option><option value="70">&lt; 70% Coverage</option><option value="80">&lt; 80% Coverage</option><option value="90">&lt; 90% Coverage</option><option value="100">&lt; 100% Coverage</option>
32
- <option value="110">= 100% Coverage</option>
33
- </select>
34
- </fieldset>
35
- </div>
36
-
37
- <div class="report_table_wrapper">
38
- <table class='report' id='report_table'>
39
- <thead>
40
- <tr>
41
- <th class="left_align">Name</th>
42
- <th class="right_align">Total Lines</th>
43
- <th class="right_align">Lines of Code</th>
44
- <th class="left_align">Total Coverage</th>
45
- <th class="left_align">Code Coverage</th>
46
- </tr>
47
- </thead>
48
- <tfoot>
49
- <tr>
50
- <td class="left_align">TOTAL</td>
51
- <td class='right_align'><tt>481</tt></td>
52
- <td class='right_align'><tt>346</tt></td>
53
- <td class="left_align"><div class="percent_graph_legend"><tt class=''>51.35%</tt></div>
54
- <div class="percent_graph">
55
- <div class="covered" style="width:51px"></div>
56
- <div class="uncovered" style="width:49px"></div>
57
- </div></td>
58
- <td class="left_align"><div class="percent_graph_legend"><tt class='coverage_total'>47.69%</tt></div>
59
- <div class="percent_graph">
60
- <div class="covered" style="width:48px"></div>
61
- <div class="uncovered" style="width:52px"></div>
62
- </div></td>
63
- </tr>
64
- </tfoot>
65
- <tbody>
66
-
67
- <tr class="all_files all_coverage 100 lib even">
68
- <td class="left_align"><a href="lib-app_logger_rb.html">lib/app_logger.rb</a></td>
69
- <td class='right_align'><tt>43</tt></td>
70
- <td class='right_align'><tt>29</tt></td>
71
- <td class="left_align"><div class="percent_graph_legend"><tt class=''>95.35%</tt></div>
72
- <div class="percent_graph">
73
- <div class="covered" style="width:95px"></div>
74
- <div class="uncovered" style="width:5px"></div>
75
- </div></td>
76
- <td class="left_align"><div class="percent_graph_legend"><tt class=''>93.10%</tt></div>
77
- <div class="percent_graph">
78
- <div class="covered" style="width:93px"></div>
79
- <div class="uncovered" style="width:7px"></div>
80
- </div></td>
81
- </tr>
82
-
83
- <tr class="all_files all_coverage 60 70 80 90 100 lib odd">
84
- <td class="left_align"><a href="lib-config_validator_rb.html">lib/config_validator.rb</a></td>
85
- <td class='right_align'><tt>21</tt></td>
86
- <td class='right_align'><tt>17</tt></td>
87
- <td class="left_align"><div class="percent_graph_legend"><tt class=''>61.90%</tt></div>
88
- <div class="percent_graph">
89
- <div class="covered" style="width:62px"></div>
90
- <div class="uncovered" style="width:38px"></div>
91
- </div></td>
92
- <td class="left_align"><div class="percent_graph_legend"><tt class=''>58.82%</tt></div>
93
- <div class="percent_graph">
94
- <div class="covered" style="width:59px"></div>
95
- <div class="uncovered" style="width:41px"></div>
96
- </div></td>
97
- </tr>
98
-
99
- <tr class="all_files all_coverage 60 70 80 90 100 lib even">
100
- <td class="left_align"><a href="lib-configuration_rb.html">lib/configuration.rb</a></td>
101
- <td class='right_align'><tt>95</tt></td>
102
- <td class='right_align'><tt>67</tt></td>
103
- <td class="left_align"><div class="percent_graph_legend"><tt class=''>60.00%</tt></div>
104
- <div class="percent_graph">
105
- <div class="covered" style="width:60px"></div>
106
- <div class="uncovered" style="width:40px"></div>
107
- </div></td>
108
- <td class="left_align"><div class="percent_graph_legend"><tt class=''>53.73%</tt></div>
109
- <div class="percent_graph">
110
- <div class="covered" style="width:54px"></div>
111
- <div class="uncovered" style="width:46px"></div>
112
- </div></td>
113
- </tr>
114
-
115
- <tr class="all_files all_coverage 30 40 50 60 70 80 90 100 lib odd">
116
- <td class="left_align"><a href="lib-importer_rb.html">lib/importer.rb</a></td>
117
- <td class='right_align'><tt>190</tt></td>
118
- <td class='right_align'><tt>135</tt></td>
119
- <td class="left_align"><div class="percent_graph_legend"><tt class=''>26.84%</tt></div>
120
- <div class="percent_graph">
121
- <div class="covered" style="width:27px"></div>
122
- <div class="uncovered" style="width:73px"></div>
123
- </div></td>
124
- <td class="left_align"><div class="percent_graph_legend"><tt class=''>21.48%</tt></div>
125
- <div class="percent_graph">
126
- <div class="covered" style="width:21px"></div>
127
- <div class="uncovered" style="width:79px"></div>
128
- </div></td>
129
- </tr>
130
-
131
- <tr class="all_files all_coverage 90 100 lib even">
132
- <td class="left_align"><a href="lib-options_rb.html">lib/options.rb</a></td>
133
- <td class='right_align'><tt>70</tt></td>
134
- <td class='right_align'><tt>53</tt></td>
135
- <td class="left_align"><div class="percent_graph_legend"><tt class=''>90.00%</tt></div>
136
- <div class="percent_graph">
137
- <div class="covered" style="width:90px"></div>
138
- <div class="uncovered" style="width:10px"></div>
139
- </div></td>
140
- <td class="left_align"><div class="percent_graph_legend"><tt class=''>86.79%</tt></div>
141
- <div class="percent_graph">
142
- <div class="covered" style="width:87px"></div>
143
- <div class="uncovered" style="width:13px"></div>
144
- </div></td>
145
- </tr>
146
-
147
- <tr class="all_files all_coverage 40 50 60 70 80 90 100 lib odd">
148
- <td class="left_align"><a href="lib-terrimporter_rb.html">lib/terrimporter.rb</a></td>
149
- <td class='right_align'><tt>62</tt></td>
150
- <td class='right_align'><tt>45</tt></td>
151
- <td class="left_align"><div class="percent_graph_legend"><tt class=''>35.48%</tt></div>
152
- <div class="percent_graph">
153
- <div class="covered" style="width:35px"></div>
154
- <div class="uncovered" style="width:65px"></div>
155
- </div></td>
156
- <td class="left_align"><div class="percent_graph_legend"><tt class=''>37.78%</tt></div>
157
- <div class="percent_graph">
158
- <div class="covered" style="width:38px"></div>
159
- <div class="uncovered" style="width:62px"></div>
160
- </div></td>
161
- </tr>
162
-
163
- </tbody>
164
- </table>
165
- </div>
166
-
167
- <p>Generated on Mon Aug 22 22:37:46 +0200 2011 with <a href="http://github.com/relevance/rcov">rcov 0.9.8</a></p>
168
-
169
- <script type="text/javascript">
170
- $(document).ready(function(){$("#report_table").tablesorter({widgets: ['zebra'], textExtraction: 'complex'});});
171
- $('.filter').change(function(){
172
- ff = $('#file_filter').val();
173
- cf = $('#coverage_filter').val();
174
- $('table#report_table tbody tr').each(function(i){
175
- if ((this.className.split(" ").indexOf(ff) > -1) && (this.className.split(" ").indexOf(cf) > -1)) {
176
- this.style.display = "";
177
- } else {
178
- this.style.display = "none";
179
- };
180
- restripe();
181
- })
182
- })
183
- </script>
184
-
185
- </body>
186
- </html>