roger 0.13.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,7 @@
1
1
  require "./lib/roger/cli.rb"
2
2
  require "test/unit"
3
- require "stringio"
3
+
4
+ require File.dirname(__FILE__) + "/../../helpers/cli"
4
5
 
5
6
  require File.dirname(__FILE__) + "/../../project/lib/tests/fail/fail"
6
7
  require File.dirname(__FILE__) + "/../../project/lib/tests/succeed/succeed"
@@ -10,47 +11,23 @@ require File.dirname(__FILE__) + "/../../project/lib/tests/noop/noop"
10
11
 
11
12
  module Roger
12
13
  class CliTestTest < ::Test::Unit::TestCase
14
+ include TestCli
13
15
 
14
- def setup
15
- @base_path = File.dirname(__FILE__) + "/../../project"
16
- end
17
-
18
-
19
- # Capture stdout/stderr output
20
- def capture
21
- @_orig_stdout, @_orig_stderr = $stdout, $stderr
22
-
23
- $stdout = StringIO.new
24
- $stderr = StringIO.new
25
-
26
- yield
27
-
28
- return [$stdout.string, $stderr.string]
29
- ensure
30
- $stdout, $stderr = @_orig_stdout, @_orig_stderr
16
+ def teardown
17
+ Cli::Base.project = nil
31
18
  end
32
19
 
33
20
  def run_test_command(args, &block)
34
- project = Project.new(@base_path, :mockupfile_path => false)
35
-
36
- mockupfile = Roger::Mockupfile.new(project)
37
-
38
- if block_given?
39
- mockupfile.test(&block)
40
- else
41
- mockupfile.test do |t|
42
- t.use :succeed
43
- t.use :noop
21
+ run_command_with_mockupfile(args) do |mockupfile|
22
+ if block_given?
23
+ mockupfile.test(&block)
24
+ else
25
+ mockupfile.test do |t|
26
+ t.use :succeed
27
+ t.use :noop
28
+ end
44
29
  end
45
30
  end
46
-
47
- project.mockupfile = mockupfile
48
-
49
- Cli::Base.project = project
50
-
51
- capture do
52
- Cli::Base.start(args, :debug => true)
53
- end
54
31
  end
55
32
 
56
33
  def test_has_subcommand_all
@@ -69,15 +46,15 @@ module Roger
69
46
  t.use :succeed
70
47
  t.use :noop
71
48
  end
72
- assert out.index("RogerNoopTest::Test") > out.index("RogerSucceedTest::Test")
73
- end
49
+ assert out.index("RogerNoopTest::Test") > out.index("RogerSucceedTest::Test")
50
+ end
74
51
 
75
52
  def test_subcommand_all_runs_all_tests_in_order_2
76
53
  out, err = run_test_command %w{test all} do |t|
77
54
  t.use :noop
78
- t.use :succeed
55
+ t.use :succeed
79
56
  end
80
- assert out.index("RogerSucceedTest::Test") > out.index("RogerNoopTest::Test")
57
+ assert out.index("RogerSucceedTest::Test") > out.index("RogerNoopTest::Test")
81
58
  end
82
59
 
83
60
  # roger test
@@ -87,6 +64,22 @@ module Roger
87
64
  assert_includes out, "RogerSucceedTest::Test"
88
65
  end
89
66
 
67
+ # roger test -v
68
+ def test_has_option_v
69
+ # A somewhat a-typical test,
70
+ # just to make it work
71
+ cli = ::Roger::Cli::Base.new [], %w{--verbose}
72
+ cli.class.project.mockupfile.test do |t|
73
+ t.use :noop
74
+ end
75
+
76
+ out, _err = capture do
77
+ cli.invoke "test"
78
+ end
79
+
80
+ assert_includes out, "NOOP DEBUG", out
81
+ end
82
+
90
83
  # roger help test
91
84
  def test_help_shows_available_subcommands
92
85
  out, err = run_test_command %w{help test}
@@ -97,7 +90,7 @@ module Roger
97
90
 
98
91
  # roger test noop
99
92
  def test_subcommand_x_runs_only_test_x
100
- out, err = run_test_command %w{test noop}
93
+ out, err = run_test_command %w{test noop}
101
94
  assert_includes out, "RogerNoopTest::Test"
102
95
  assert_not_includes out, "RogerSucceedTest::Test"
103
96
  end
@@ -117,7 +110,7 @@ module Roger
117
110
  t.use :noop
118
111
  t.use :fail
119
112
  end
120
- end
113
+ end
121
114
  end
122
115
 
123
116
  def test_subcommand_all_has_exit_code_1_on_failure
@@ -135,7 +128,7 @@ module Roger
135
128
  t.use :noop
136
129
  t.use :succeed
137
130
  end
138
- end
131
+ end
139
132
  end
140
133
 
141
134
  end
@@ -24,7 +24,7 @@ module CustomGens
24
24
  # Somewhat ugly way of checking
25
25
  raise StandardError if @project
26
26
  end
27
- end
27
+ end
28
28
 
29
29
  end
30
30
  end
@@ -33,6 +33,10 @@ module Roger
33
33
  class GeneratorTest < ::Test::Unit::TestCase
34
34
  def setup
35
35
  @cli = Cli::Base.new
36
+
37
+ # Dirty hack to clean up tasks
38
+ Cli::Generate.tasks.delete("mocked")
39
+ Cli::Generate.tasks.delete("mockery")
36
40
  end
37
41
 
38
42
  def test_working_project
@@ -51,6 +55,15 @@ module Roger
51
55
  assert_equal Cli::Generate.tasks["mocked"].usage, "mocked PATH ANOTHER_ARG"
52
56
  end
53
57
 
58
+ def test_register_generator_with_custom_name
59
+ Roger::Generators.register :mockery, CustomGens::Generators::MockedGenerator
60
+ assert_includes Cli::Generate.tasks, "mockery"
61
+ end
62
+
63
+ def test_cli_help_shows_all_available_generators
64
+
65
+ end
66
+
54
67
  def test_default_generator
55
68
  assert_includes Cli::Generate.tasks, "new"
56
69
  end
@@ -65,7 +78,7 @@ module Roger
65
78
 
66
79
  def test_invoke_mocked_generator
67
80
  Roger::Generators.register CustomGens::Generators::MockedGenerator
68
-
81
+
69
82
  generators = Cli::Generate.new
70
83
  assert_raise NotImplementedError do
71
84
  generators.invoke :mocked
@@ -0,0 +1,25 @@
1
+ # encoding: UTF-8
2
+ require "test/unit"
3
+ require "mocha/test_unit"
4
+ require "./lib/roger/test.rb"
5
+
6
+ module Roger
7
+ class TestTest < ::Test::Unit::TestCase
8
+ def setup
9
+ @files = ["html/javascripts/site.js",
10
+ "html/vendor/underscore/underscore.js"]
11
+ @globs = stub(map: @files)
12
+ end
13
+
14
+ def test_get_files
15
+ test = Roger::Test.new({})
16
+ assert_equal(test.get_files(@globs), @files)
17
+ end
18
+
19
+ def test_get_files_excludes
20
+ test = Roger::Test.new({})
21
+ assert_equal(test.get_files(@globs, ["html\/vendor\/.+.js"]),
22
+ ["html/javascripts/site.js"])
23
+ end
24
+ end
25
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Flurin Egger
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-12-22 00:00:00.000000000 Z
13
+ date: 2015-05-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: thor
@@ -30,14 +30,14 @@ dependencies:
30
30
  name: rack
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - ! '>='
33
+ - - '>='
34
34
  - !ruby/object:Gem::Version
35
35
  version: 1.0.0
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - ! '>='
40
+ - - '>='
41
41
  - !ruby/object:Gem::Version
42
42
  version: 1.0.0
43
43
  - !ruby/object:Gem::Dependency
@@ -72,28 +72,28 @@ dependencies:
72
72
  name: hpricot
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - ! '>='
75
+ - - '>='
76
76
  - !ruby/object:Gem::Version
77
77
  version: 0.6.4
78
78
  type: :runtime
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - ! '>='
82
+ - - '>='
83
83
  - !ruby/object:Gem::Version
84
84
  version: 0.6.4
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: redcarpet
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
- - - ! '>='
89
+ - - '>='
90
90
  - !ruby/object:Gem::Version
91
91
  version: 3.1.1
92
92
  type: :runtime
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
- - - ! '>='
96
+ - - '>='
97
97
  - !ruby/object:Gem::Version
98
98
  version: 3.1.1
99
99
  - !ruby/object:Gem::Dependency
@@ -124,6 +124,20 @@ dependencies:
124
124
  - - ~>
125
125
  - !ruby/object:Gem::Version
126
126
  version: 1.1.0
127
+ - !ruby/object:Gem::Dependency
128
+ name: puma
129
+ requirement: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ~>
132
+ - !ruby/object:Gem::Version
133
+ version: 2.10.0
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ~>
139
+ - !ruby/object:Gem::Version
140
+ version: 2.10.0
127
141
  description:
128
142
  email:
129
143
  - info@digitpaint.nl
@@ -143,6 +157,11 @@ files:
143
157
  - Rakefile
144
158
  - bin/roger
145
159
  - doc/cli.md
160
+ - doc/images/logo_black-yellow.png
161
+ - doc/images/logo_black-yellow.svg
162
+ - doc/images/logo_plain-square.png
163
+ - doc/images/logo_plain.png
164
+ - doc/images/logo_plain.svg
146
165
  - doc/mockupfile.md
147
166
  - doc/templating.md
148
167
  - examples/default_template/.gitignore
@@ -187,6 +206,7 @@ files:
187
206
  - lib/roger/test.rb
188
207
  - roger.gemspec
189
208
  - test/Mockupfile-syntax.rb
209
+ - test/helpers/cli.rb
190
210
  - test/project/.rvmrc
191
211
  - test/project/Gemfile
192
212
  - test/project/Gemfile.lock
@@ -222,6 +242,8 @@ files:
222
242
  - test/project/partials/test/yield.html.erb
223
243
  - test/project/partials2/partials2-test.html.erb
224
244
  - test/unit/cli/cli_base_test.rb
245
+ - test/unit/cli/cli_generate_test.rb
246
+ - test/unit/cli/cli_serve_test.rb
225
247
  - test/unit/cli/cli_test_test.rb
226
248
  - test/unit/generators_test.rb
227
249
  - test/unit/release/cleaner_test.rb
@@ -230,6 +252,7 @@ files:
230
252
  - test/unit/release_test.rb
231
253
  - test/unit/resolver_test.rb
232
254
  - test/unit/template_test.rb
255
+ - test/unit/test_test.rb
233
256
  homepage: http://github.com/digitpaint/roger
234
257
  licenses:
235
258
  - MIT
@@ -241,22 +264,23 @@ require_paths:
241
264
  - lib
242
265
  required_ruby_version: !ruby/object:Gem::Requirement
243
266
  requirements:
244
- - - ! '>='
267
+ - - '>='
245
268
  - !ruby/object:Gem::Version
246
269
  version: '0'
247
270
  required_rubygems_version: !ruby/object:Gem::Requirement
248
271
  requirements:
249
- - - ! '>='
272
+ - - '>='
250
273
  - !ruby/object:Gem::Version
251
274
  version: '0'
252
275
  requirements: []
253
276
  rubyforge_project:
254
- rubygems_version: 2.1.5
277
+ rubygems_version: 2.2.2
255
278
  signing_key:
256
279
  specification_version: 4
257
280
  summary: Roger is a set of tools to create self-containing HTML mockups.
258
281
  test_files:
259
282
  - test/Mockupfile-syntax.rb
283
+ - test/helpers/cli.rb
260
284
  - test/project/.rvmrc
261
285
  - test/project/Gemfile
262
286
  - test/project/Gemfile.lock
@@ -292,6 +316,8 @@ test_files:
292
316
  - test/project/partials/test/yield.html.erb
293
317
  - test/project/partials2/partials2-test.html.erb
294
318
  - test/unit/cli/cli_base_test.rb
319
+ - test/unit/cli/cli_generate_test.rb
320
+ - test/unit/cli/cli_serve_test.rb
295
321
  - test/unit/cli/cli_test_test.rb
296
322
  - test/unit/generators_test.rb
297
323
  - test/unit/release/cleaner_test.rb
@@ -300,3 +326,4 @@ test_files:
300
326
  - test/unit/release_test.rb
301
327
  - test/unit/resolver_test.rb
302
328
  - test/unit/template_test.rb
329
+ - test/unit/test_test.rb