usmu 1.2.0-java → 1.2.1-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/usmu/plugin/core.rb +2 -2
- data/lib/usmu/version.rb +1 -1
- data/spec/usmu/plugin/core_spec.rb +111 -0
- data/spec/usmu/site_generator_spec.rb +2 -4
- data/usmu.gemspec +0 -1
- metadata +1 -17
- data/spec/plugin/core_spec.rb +0 -116
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61968cab50040f7a2a5b0f9fcc6ba481f4b5567b
|
4
|
+
data.tar.gz: b8b72e07ca7986addb70bf255ec6a18c15e6471c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4a13c6a9d1c7039cec6023724e75008a78ddfdc3bb6a9fe43849d2006454be5a40d9f89aa0dd25bdd2f76d9bc7542a6c782ea8d303ed034e122eb52cebaa01a
|
7
|
+
data.tar.gz: f1d90b1aec2431e0d7c788ce09385179624c7a09121bdcbef5ed66fad5ce78276e2a0cde4b764cb610c2d7c366d6ec66ca169d69a570e60a7d41392babe9e256
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Usmu Change Log
|
2
2
|
|
3
|
+
## 1.2.1
|
4
|
+
|
5
|
+
Matthew Scharley <matt.scharley@gmail.com>
|
6
|
+
|
7
|
+
* Remove useless gem (f1a9659a03c239da7348ce75e6fcf2f055c4079e)
|
8
|
+
* Fix options to Rack to set hostname and port correctly (1364e9ee14bf2d79fd379363a0e2e820f9382e30)
|
9
|
+
* Fix tests (edb9e246aee28b57d2a51a3bb310c76cf3474054)
|
10
|
+
|
3
11
|
## 1.2.0
|
4
12
|
|
5
13
|
Matthew Scharley <matt.scharley@gmail.com>
|
data/lib/usmu/plugin/core.rb
CHANGED
@@ -78,8 +78,8 @@ module Usmu
|
|
78
78
|
@log.info('Starting webserver...')
|
79
79
|
|
80
80
|
Rack::Handler::WEBrick.run Ui::RackServer.new(configuration),
|
81
|
-
|
82
|
-
|
81
|
+
Host: configuration['serve', 'host', default: 'localhost'],
|
82
|
+
Port: configuration['serve', 'port', default: 8080]
|
83
83
|
end
|
84
84
|
|
85
85
|
private
|
data/lib/usmu/version.rb
CHANGED
@@ -1,5 +1,116 @@
|
|
1
1
|
require 'usmu/plugin/core'
|
2
|
+
require 'usmu/configuration'
|
3
|
+
require 'usmu/mock_commander'
|
4
|
+
require 'ostruct'
|
5
|
+
require 'rack'
|
6
|
+
require 'usmu/ui/rack_server'
|
2
7
|
|
3
8
|
RSpec.describe Usmu::Plugin::Core do
|
9
|
+
let (:plugin) { described_class.new }
|
10
|
+
let (:configuration) { Usmu::Configuration.from_hash({}) }
|
11
|
+
let (:ui) { OpenStruct.new configuration: configuration }
|
12
|
+
let (:commander) { Usmu::MockCommander.new }
|
13
|
+
let (:options) { Commander::Command::Options.new }
|
4
14
|
|
15
|
+
context '#commands' do
|
16
|
+
it 'stores a the UI given to it' do
|
17
|
+
plugin.commands(ui, commander)
|
18
|
+
|
19
|
+
expect(plugin.send :ui).to eq(ui)
|
20
|
+
expect(@log_output.readline).to eq(" DEBUG Usmu::Plugin::Core : Adding core console commands...\n")
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'defines a "generate" command' do
|
24
|
+
plugin.commands(ui, commander)
|
25
|
+
|
26
|
+
command = commander.get_command :generate
|
27
|
+
expect(command[:syntax]).to eq('usmu generate')
|
28
|
+
expect(command[:description]).to eq('Generates your website using the configuration specified.')
|
29
|
+
expect(command[:action]).to be_a(Proc)
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'defines a "init" command' do
|
33
|
+
plugin.commands(ui, commander)
|
34
|
+
|
35
|
+
command = commander.get_command :init
|
36
|
+
expect(command[:syntax]).to eq('usmu init [path]')
|
37
|
+
expect(command[:description]).to eq('Initialise a new website in the given path, or the current directory if none given.')
|
38
|
+
expect(command[:action]).to be_a(Proc)
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'defines a "serve" command' do
|
42
|
+
plugin.commands(ui, commander)
|
43
|
+
|
44
|
+
command = commander.get_command :serve
|
45
|
+
expect(command[:syntax]).to eq('usmu serve')
|
46
|
+
expect(command[:description]).to eq('Serve files processed files directly. This won\'t update files on disk, but you will be able to view your website as rendered.')
|
47
|
+
expect(command[:action]).to be_a(Proc)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
context '#command_generate' do
|
52
|
+
it 'raises an error when arguments are specified' do
|
53
|
+
expect { plugin.command_generate(['foo'], options) }.to raise_error('This command does not take arguments')
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'raises an error when invalid options are specified' do
|
57
|
+
expect { plugin.command_generate([], []) }.to raise_error('Invalid options')
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'should generate a site' do
|
61
|
+
expect(configuration.generator).to receive(:generate)
|
62
|
+
|
63
|
+
plugin.send :ui=, ui
|
64
|
+
plugin.command_generate [], options
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context '#command_init' do
|
69
|
+
it 'should do something'
|
70
|
+
end
|
71
|
+
|
72
|
+
context '#command_serve' do
|
73
|
+
let (:empty_configuration) { Usmu::Configuration.from_hash({}) }
|
74
|
+
let (:configuration) {
|
75
|
+
Usmu::Configuration.from_hash(
|
76
|
+
{
|
77
|
+
'serve' => {
|
78
|
+
'host' => '0.0.0.0',
|
79
|
+
'port' => 8008,
|
80
|
+
}
|
81
|
+
}
|
82
|
+
)
|
83
|
+
}
|
84
|
+
let (:rs) { OpenStruct.new }
|
85
|
+
|
86
|
+
before do
|
87
|
+
allow(Usmu::Ui::RackServer).to receive(:new).with(empty_configuration).and_return(rs)
|
88
|
+
allow(Usmu::Ui::RackServer).to receive(:new).with(configuration).and_return(rs)
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'raises an error when arguments are specified' do
|
92
|
+
expect { plugin.command_serve(['foo'], options) }.to raise_error('This command does not take arguments')
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'raises an error when invalid options are specified' do
|
96
|
+
expect { plugin.command_serve([], []) }.to raise_error('Invalid options')
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'should start a WEBrick Rack handler with a new RackServer UI' do
|
100
|
+
plugin.send :ui=, OpenStruct.new(configuration: empty_configuration)
|
101
|
+
expect(Rack::Handler::WEBrick).to receive(:run).with(rs, Host: 'localhost', Port: 8080)
|
102
|
+
plugin.command_serve [], options
|
103
|
+
expect(@log_output.readline).to eq(" INFO Usmu::Plugin::Core : Starting webserver...\n")
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'should take hostname and ports from the configuration file' do
|
107
|
+
plugin.send :ui=, OpenStruct.new(configuration: configuration)
|
108
|
+
expect(Rack::Handler::WEBrick).to receive(:run).with(rs, Host: '0.0.0.0', Port: 8008)
|
109
|
+
plugin.command_serve [], options
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
context '#init_copy_file' do
|
114
|
+
it 'should do something'
|
115
|
+
end
|
5
116
|
end
|
@@ -95,9 +95,8 @@ RSpec.describe Usmu::SiteGenerator do
|
|
95
95
|
end
|
96
96
|
|
97
97
|
it 'should write a file and update mtime to match source files' do
|
98
|
-
page = OpenStruct.new name: 'test.slim', input_path: 'src/test.slim', output_filename: 'test.html', render: '<!DOCTYPE html><h1>It works!</h1>'
|
98
|
+
page = OpenStruct.new name: 'test.slim', input_path: 'src/test.slim', output_filename: 'test.html', render: '<!DOCTYPE html><h1>It works!</h1>', mtime: 100
|
99
99
|
expect(File).to receive(:write).with('site/test.html', '<!DOCTYPE html><h1>It works!</h1>')
|
100
|
-
expect(File).to receive(:stat).with('src/test.slim').and_return(OpenStruct.new mtime: 100)
|
101
100
|
expect(FileUtils).to receive(:touch).with('site/test.html', mtime: 100).and_return(true)
|
102
101
|
expect(FileUtils).to_not receive(:mkdir_p)
|
103
102
|
|
@@ -108,9 +107,8 @@ RSpec.describe Usmu::SiteGenerator do
|
|
108
107
|
end
|
109
108
|
|
110
109
|
it 'should create directories as necessary' do
|
111
|
-
page = OpenStruct.new name: 'test.slim', input_path: 'src/subdir/test.slim', output_filename: 'subdir/test.html', render: '<!DOCTYPE html><h1>It works!</h1>'
|
110
|
+
page = OpenStruct.new name: 'test.slim', input_path: 'src/subdir/test.slim', output_filename: 'subdir/test.html', render: '<!DOCTYPE html><h1>It works!</h1>', mtime: 100
|
112
111
|
expect(File).to receive(:write).with('site/subdir/test.html', '<!DOCTYPE html><h1>It works!</h1>')
|
113
|
-
expect(File).to receive(:stat).with('src/subdir/test.slim').and_return(OpenStruct.new mtime: 100)
|
114
112
|
expect(FileUtils).to receive(:touch).with('site/subdir/test.html', mtime: 100).and_return(true)
|
115
113
|
expect(FileUtils).to receive(:mkdir_p).with('site/subdir')
|
116
114
|
|
data/usmu.gemspec
CHANGED
@@ -38,7 +38,6 @@ Gem::Specification.new do |spec|
|
|
38
38
|
spec.add_development_dependency 'guard-rspec', '~> 4.3'
|
39
39
|
spec.add_development_dependency 'turnip', '~> 2.0'
|
40
40
|
spec.add_development_dependency 'sass', '~> 3.4'
|
41
|
-
spec.add_development_dependency 'timeout', '~> 0.0'
|
42
41
|
|
43
42
|
case ENV['BUILD_PLATFORM']
|
44
43
|
when 'ruby'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: usmu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Matthew Scharley
|
@@ -206,20 +206,6 @@ dependencies:
|
|
206
206
|
- - "~>"
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: '3.4'
|
209
|
-
- !ruby/object:Gem::Dependency
|
210
|
-
name: timeout
|
211
|
-
requirement: !ruby/object:Gem::Requirement
|
212
|
-
requirements:
|
213
|
-
- - "~>"
|
214
|
-
- !ruby/object:Gem::Version
|
215
|
-
version: '0.0'
|
216
|
-
type: :development
|
217
|
-
prerelease: false
|
218
|
-
version_requirements: !ruby/object:Gem::Requirement
|
219
|
-
requirements:
|
220
|
-
- - "~>"
|
221
|
-
- !ruby/object:Gem::Version
|
222
|
-
version: '0.0'
|
223
209
|
- !ruby/object:Gem::Dependency
|
224
210
|
name: kramdown
|
225
211
|
requirement: !ruby/object:Gem::Requirement
|
@@ -290,7 +276,6 @@ files:
|
|
290
276
|
- spec/mock/usmu/mock_metadata_configuration.rb
|
291
277
|
- spec/mock/usmu/mock_plugin.rb
|
292
278
|
- spec/mock/usmu/mock_remote_files.rb
|
293
|
-
- spec/plugin/core_spec.rb
|
294
279
|
- spec/spec_helper.rb
|
295
280
|
- spec/support/shared_layout.rb
|
296
281
|
- spec/usmu/configuration_spec.rb
|
@@ -370,7 +355,6 @@ test_files:
|
|
370
355
|
- spec/mock/usmu/mock_metadata_configuration.rb
|
371
356
|
- spec/mock/usmu/mock_plugin.rb
|
372
357
|
- spec/mock/usmu/mock_remote_files.rb
|
373
|
-
- spec/plugin/core_spec.rb
|
374
358
|
- spec/spec_helper.rb
|
375
359
|
- spec/support/shared_layout.rb
|
376
360
|
- spec/usmu/configuration_spec.rb
|
data/spec/plugin/core_spec.rb
DELETED
@@ -1,116 +0,0 @@
|
|
1
|
-
require 'usmu/plugin/core'
|
2
|
-
require 'usmu/configuration'
|
3
|
-
require 'usmu/mock_commander'
|
4
|
-
require 'ostruct'
|
5
|
-
require 'rack'
|
6
|
-
require 'usmu/ui/rack_server'
|
7
|
-
|
8
|
-
RSpec.describe Usmu::Plugin::Core do
|
9
|
-
let (:plugin) { described_class.new }
|
10
|
-
let (:configuration) { Usmu::Configuration.from_hash({}) }
|
11
|
-
let (:ui) { OpenStruct.new configuration: configuration }
|
12
|
-
let (:commander) { Usmu::MockCommander.new }
|
13
|
-
let (:options) { Commander::Command::Options.new }
|
14
|
-
|
15
|
-
context '#commands' do
|
16
|
-
it 'stores a the UI given to it' do
|
17
|
-
plugin.commands(ui, commander)
|
18
|
-
|
19
|
-
expect(plugin.send :ui).to eq(ui)
|
20
|
-
expect(@log_output.readline).to eq(" DEBUG Usmu::Plugin::Core : Adding core console commands...\n")
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'defines a "generate" command' do
|
24
|
-
plugin.commands(ui, commander)
|
25
|
-
|
26
|
-
command = commander.get_command :generate
|
27
|
-
expect(command[:syntax]).to eq('usmu generate')
|
28
|
-
expect(command[:description]).to eq('Generates your website using the configuration specified.')
|
29
|
-
expect(command[:action]).to be_a(Proc)
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'defines a "init" command' do
|
33
|
-
plugin.commands(ui, commander)
|
34
|
-
|
35
|
-
command = commander.get_command :init
|
36
|
-
expect(command[:syntax]).to eq('usmu init [path]')
|
37
|
-
expect(command[:description]).to eq('Initialise a new website in the given path, or the current directory if none given.')
|
38
|
-
expect(command[:action]).to be_a(Proc)
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'defines a "serve" command' do
|
42
|
-
plugin.commands(ui, commander)
|
43
|
-
|
44
|
-
command = commander.get_command :serve
|
45
|
-
expect(command[:syntax]).to eq('usmu serve')
|
46
|
-
expect(command[:description]).to eq('Serve files processed files directly. This won\'t update files on disk, but you will be able to view your website as rendered.')
|
47
|
-
expect(command[:action]).to be_a(Proc)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
context '#command_generate' do
|
52
|
-
it 'raises an error when arguments are specified' do
|
53
|
-
expect { plugin.command_generate(['foo'], options) }.to raise_error('This command does not take arguments')
|
54
|
-
end
|
55
|
-
|
56
|
-
it 'raises an error when invalid options are specified' do
|
57
|
-
expect { plugin.command_generate([], []) }.to raise_error('Invalid options')
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'should generate a site' do
|
61
|
-
expect(configuration.generator).to receive(:generate)
|
62
|
-
|
63
|
-
plugin.send :ui=, ui
|
64
|
-
plugin.command_generate [], options
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
context '#command_init' do
|
69
|
-
it 'should do something'
|
70
|
-
end
|
71
|
-
|
72
|
-
context '#command_serve' do
|
73
|
-
let (:empty_configuration) { Usmu::Configuration.from_hash({}) }
|
74
|
-
let (:configuration) {
|
75
|
-
Usmu::Configuration.from_hash(
|
76
|
-
{
|
77
|
-
'serve' => {
|
78
|
-
'host' => '0.0.0.0',
|
79
|
-
'port' => 8008,
|
80
|
-
}
|
81
|
-
}
|
82
|
-
)
|
83
|
-
}
|
84
|
-
let (:rs) { OpenStruct.new }
|
85
|
-
|
86
|
-
before do
|
87
|
-
allow(Usmu::Ui::RackServer).to receive(:new).with(empty_configuration).and_return(rs)
|
88
|
-
allow(Usmu::Ui::RackServer).to receive(:new).with(configuration).and_return(rs)
|
89
|
-
end
|
90
|
-
|
91
|
-
it 'raises an error when arguments are specified' do
|
92
|
-
expect { plugin.command_serve(['foo'], options) }.to raise_error('This command does not take arguments')
|
93
|
-
end
|
94
|
-
|
95
|
-
it 'raises an error when invalid options are specified' do
|
96
|
-
expect { plugin.command_serve([], []) }.to raise_error('Invalid options')
|
97
|
-
end
|
98
|
-
|
99
|
-
it 'should start a WEBrick Rack handler with a new RackServer UI' do
|
100
|
-
plugin.send :ui=, OpenStruct.new(configuration: empty_configuration)
|
101
|
-
expect(Rack::Handler::WEBrick).to receive(:run).with(rs, host: 'localhost', port: 8080)
|
102
|
-
plugin.command_serve [], options
|
103
|
-
expect(@log_output.readline).to eq(" INFO Usmu::Plugin::Core : Starting webserver...\n")
|
104
|
-
end
|
105
|
-
|
106
|
-
it 'should take hostname and ports from the configuration file' do
|
107
|
-
plugin.send :ui=, OpenStruct.new(configuration: configuration)
|
108
|
-
expect(Rack::Handler::WEBrick).to receive(:run).with(rs, host: '0.0.0.0', port: 8008)
|
109
|
-
plugin.command_serve [], options
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
context '#init_copy_file' do
|
114
|
-
it 'should do something'
|
115
|
-
end
|
116
|
-
end
|