usmu 1.0.1-java → 1.1.0-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: edd7433ee4c0dbc62aa99b6fea962c901e6bbf5f
4
- data.tar.gz: fc146facac5a999db5b93052c2a673473b71fc8c
3
+ metadata.gz: 8c097c5f4091542561c900d83d7dec968a010fa7
4
+ data.tar.gz: 6c92092df34a7adc1d5e9131195c44da183f3aeb
5
5
  SHA512:
6
- metadata.gz: b32249f6dc8882c6b80222e27133bff664a2bb9abef545c958f5bf2634cb657289fc629ed167a645ec7b31a0233a3d441441f61c31f687231811d784fd48531f
7
- data.tar.gz: c94c2d0e01c1abb342c798ebc7a02f835153e9fc2843a2a28bde29b9ae8c6227b367d37df96b569eff7d5331f3fb84ef568a9e5ed33692cee08ee5a5154ebaa0
6
+ metadata.gz: 8fab12c15a1b2bcef64cbc53d501640df4fadb7a892702b830f482c0fa51c86781fe3d171a638b7a05a13ec7db1e33c952ea9065fbd55ebb72f467ee054629bb
7
+ data.tar.gz: 0297b97ea1638910ff4729206d7835bc48d66de9d7d32a2655215e216b80900f3a4886d77b01fd94bcdabb34f4e4ab9994a903af3ceece8e40b5be79d2d29950
data/.travis.yml CHANGED
@@ -1,18 +1,13 @@
1
1
  language: ruby
2
+ before_install: gem update bundler
3
+ install: bundle install --jobs 3 --retry 3 --without mutant
2
4
  script: rake ci
3
5
  rvm:
4
- - 1.9.3
5
6
  - 2.0
6
7
  - 2.1
7
8
  - 2.2
8
9
  - ruby-head
9
- #- mruby-head
10
- #- rbx-2.1
11
- #- rbx-2.2
12
- #- rbx-2.3
13
- - rbx-2.4
14
- - jruby
15
- - jruby-head
10
+ - rbx
16
11
  matrix:
17
12
  include:
18
13
  - rvm: jruby
@@ -20,14 +15,10 @@ matrix:
20
15
  - rvm: jruby-head
21
16
  env: JRUBY_OPTS='--2.0'
22
17
  allow_failures:
23
- - rvm: 1.9.3
24
18
  - rvm: jruby
25
19
  - rvm: jruby-head
26
20
  - rvm: mruby-head
27
- - rvm: rbx-2.1
28
- - rvm: rbx-2.2
29
- - rvm: rbx-2.3
30
- - rvm: rbx-2.4
21
+ - rvm: rbx
31
22
  addons:
32
23
  code_climate:
33
24
  repo_token: 5ac0735331c1749a461eae94f89cd2011cc001979f9941d7241f97caeff7bde1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Usmu Change Log
2
2
 
3
+ ## 1.1.0
4
+
5
+ Matthew Scharley <matt.scharley@gmail.com>
6
+
7
+ * [\[\#21\]][GH-21] Cleanup Usmu::Configuration (1bc417de24e34c8694be4a2e8bf83d18898eec56)
8
+ * [\[\#21\]][GH-21] Properly stub out tests for SiteGenerator (503233c7eab33f7d98714d185a1aefb70f02c73b)
9
+ * [\[\#21\]][GH-21] Cover SiteGenerator (e91d4e2b42738f7107ed0ed3e03aa7ed6abfe17d)
10
+ * Bump dependency modules (df1559e8ef3931e1c64530937d3361cbc330aafe)
11
+ * [\[#5\]][GH-5] WIP initial pass at allowing alter hooks (6a474db9032974bdac53870a3e690c983af434ff)
12
+ * [\[\#21\]][GH-21] Add an initial suite of tests for CorePlugin (d02e14aceaa24ac5708fb51bab5254f016bafa71)
13
+ * Update usage information with basic info in the README (86f525f861d4e80aea4a54e9a7f8fbbfbf472125)
14
+ * [\[#31\]][GH-31] Move source folder of init-site (b2e56277591468b57c45976506df603d6d7ed7d1)
15
+ * [\[#32\]][GH-32] Fix issues with the init-site (f4c577f4b25855e3ccc928c004edc3d924ba66b5)
16
+ * Cache the list of renderables and allow that list to be altered (990cf0bdf4353638af8b5f2f6f89a5f6338182ea)
17
+ * Fix tests (c4089e426abc24d399f352483fab5aa61657b3ab)
18
+
19
+ [GH-5]: https://github.com/usmu/usmu/issues/5
20
+ [GH-21]: https://github.com/usmu/usmu/issues/21
21
+ [GH-31]: https://github.com/usmu/usmu/issues/31
22
+ [GH-32]: https://github.com/usmu/usmu/issues/32
23
+
3
24
  ## 1.0.0
4
25
 
5
26
  Matthew Scharley <matt.scharley@gmail.com>
data/Gemfile CHANGED
@@ -13,8 +13,5 @@ end
13
13
  gemspec name: 'usmu'
14
14
 
15
15
  gem 'codeclimate-test-reporter', group: :test, require: nil
16
-
17
- if RUBY_VERSION.to_f >= 2 && RUBY_VERSION.to_f < 2.2 && RUBY_ENGINE == 'ruby'
18
- gem 'mutant', '~> 0.7', :group => :development
19
- gem 'mutant-rspec', '~> 0.7', :group => :development
20
- end
16
+ gem 'mutant', '~> 0.8', group: 'mutant'
17
+ gem 'mutant-rspec', '~> 0.8', group: 'mutant'
data/README.md CHANGED
@@ -23,7 +23,20 @@ to generate locally if you don't wish to use the web-based editor.
23
23
 
24
24
  ## Usage
25
25
 
26
- TODO: Write usage instructions here
26
+ You can generate a new basic website using `usmu init`.
27
+
28
+ $ usmu init site-name
29
+
30
+ This will create a new site in the `site-name` folder. You can now use `usmu generate` to build the test site.
31
+
32
+ $ cd site-name
33
+ $ usmu generate
34
+
35
+ You can also use `usmu serve` to get a live server that you can use to test changes you make. This will not modify any
36
+ files in your output folder but will instead dynamically generate and serve content directly from your files. Note,
37
+ this is in no way secure and it is highly recommended to only deploy static versions of your website.
38
+
39
+ $ usmu serve
27
40
 
28
41
  ## Compatibility
29
42
 
data/Rakefile CHANGED
@@ -27,19 +27,15 @@ task :test => [:clean, :spec, :mutant]
27
27
  desc 'Run mutation tests'
28
28
  task :mutant, [:target] => [:clean] do |t,args|
29
29
  old = ENV.delete('CODECLIMATE_REPO_TOKEN')
30
- if `which mutant 2>&1 > /dev/null; echo \$?`.to_i != 0
31
- puts 'Mutant isn\'t supported on your platform. Please run these tests on MRI <= 2.1.5.'
32
- else
33
- sh 'bundle', 'exec', 'mutant',
34
- '--include', 'lib',
35
- '--require', 'usmu',
36
- '--require', 'usmu/deployment',
37
- '--use', 'rspec',
38
- # Interfaces and documentation classes
39
- '--ignore-subject', 'Usmu::Deployment::RemoteFileInterface*',
40
- '--ignore-subject', 'Usmu::Plugin::CoreHooks*',
41
- args[:target] || 'Usmu*'
42
- end
30
+ sh 'bundle', 'exec', 'mutant',
31
+ '--include', 'lib',
32
+ '--require', 'usmu',
33
+ '--require', 'usmu/deployment',
34
+ '--use', 'rspec',
35
+ # Interfaces and documentation classes
36
+ '--ignore-subject', 'Usmu::Deployment::RemoteFileInterface*',
37
+ '--ignore-subject', 'Usmu::Plugin::CoreHooks*',
38
+ args[:target] || 'Usmu*'
43
39
  ENV['CODECLIMATE_REPO_TOKEN'] = old unless old.nil?
44
40
  end
45
41
 
data/bin/usmu CHANGED
File without changes
data/lib/usmu.rb CHANGED
@@ -25,9 +25,6 @@ module Usmu
25
25
  ),
26
26
  )
27
27
 
28
- # Globbing flags. Correct across 1.9.3 and 2.0+, enabling as many features as available
29
- FILE_GLOB_FLAGS = defined?(File::FNM_EXTGLOB) ? File::FNM_EXTGLOB | File::FNM_PATHNAME : File::FNM_PATHNAME
30
-
31
28
  # Enable logging of all events to the console
32
29
  #
33
30
  # @return [void]
@@ -141,7 +141,7 @@ module Usmu
141
141
  def excluded?(filename)
142
142
  exclude.each do |f|
143
143
  f += '**/*' if f.end_with? '/'
144
- return true if File.fnmatch(f, filename, FILE_GLOB_FLAGS)
144
+ return true if File.fnmatch(f, filename, File::FNM_EXTGLOB | File::FNM_PATHNAME)
145
145
  end
146
146
  false
147
147
  end
data/lib/usmu/plugin.rb CHANGED
@@ -27,8 +27,9 @@ module Usmu
27
27
  @plugins ||= []
28
28
  end
29
29
 
30
- # Call all plugins and collate any data returned. nil can be returned explicitly to say this plugin has nothing to
31
- # return.
30
+ # Call all plugins and collate any data returned.
31
+ #
32
+ # nil can be returned explicitly to say this plugin has nothing to return.
32
33
  #
33
34
  # @param [Symbol] method The name of the method to call. This should be namespaced somehow. For example, a plugin
34
35
  # called `usmu-s3` could use the method namespace `s3` and have a hook called `:s3_upload`
@@ -46,6 +47,27 @@ module Usmu
46
47
  end.select {|i| i}
47
48
  end
48
49
 
50
+ # Call all plugins and allow for altering a value.
51
+ #
52
+ # The return value of each hook is passed into the next alter function, hence all implementations must always
53
+ # return a value. If the hook doesn't wish to modify data this call then it should return the original value.
54
+ #
55
+ # @param [Symbol] method The name of the method to call. This should be namespaced somehow. For example, a plugin
56
+ # called `usmu-s3` could use the method namespace `s3` and have a hook called `:s3_upload`
57
+ # @param [Object] value The value to modify.
58
+ # @param [Array] context Optional extra parameters to provide.
59
+ # @return [Object] The modified value.
60
+ def alter(method, value, *context)
61
+ @log.debug("Invoking plugin alter API #{method}")
62
+ plugins.each do |p|
63
+ if p.respond_to? "#{method}_alter"
64
+ @log.debug("Sending message to #{p.class.name}")
65
+ value = p.public_send "#{method}_alter", value, *context
66
+ end
67
+ end
68
+ value
69
+ end
70
+
49
71
  private
50
72
 
51
73
  # Helper function to load and instantiate plugin classes
@@ -53,10 +75,7 @@ module Usmu
53
75
  # @param [String] klass The name of the class to load
54
76
  # @return [Object] A plugin object
55
77
  def plugin_get(klass)
56
- object.const_get(klass).new
57
- rescue NameError
58
- # Ruby 1.9.3, dowp
59
- klass.split('::').reduce(Object) {|memo, o| memo.const_get o }.new
78
+ Object.const_get(klass).new
60
79
  end
61
80
 
62
81
  # Helper function to load a plugin from a gem specification
@@ -1,4 +1,6 @@
1
1
  require 'fileutils'
2
+ require 'rack'
3
+ require 'usmu/ui/rack_server'
2
4
 
3
5
  module Usmu
4
6
  class Plugin
@@ -30,7 +32,7 @@ module Usmu
30
32
  end
31
33
 
32
34
  c.command(:serve) do |command|
33
- command.syntax = 'usmu server'
35
+ command.syntax = 'usmu serve'
34
36
  command.description = 'Serve files processed files directly. This won\'t update files on disk, but you will be able to view your website as rendered.'
35
37
  command.action &method(:command_serve)
36
38
  end
@@ -41,6 +43,9 @@ module Usmu
41
43
  # @param [Array<String>] args arguments passed by the user.
42
44
  # @param [Hash] options options parsed by Commander
43
45
  def command_generate(args, options)
46
+ raise 'This command does not take arguments' unless args.empty?
47
+ raise 'Invalid options' unless options.inspect.start_with? '<Commander::Command::Options '
48
+
44
49
  @ui.configuration.generator.generate
45
50
  end
46
51
 
@@ -52,6 +57,7 @@ module Usmu
52
57
  @log.info("Usmu v#{Usmu::VERSION}")
53
58
  @log.info('')
54
59
 
60
+ raise 'Invalid options' unless options.inspect.start_with? '<Commander::Command::Options '
55
61
  if args.length > 1
56
62
  @log.fatal('Only one path allowed to be initialised at a time.')
57
63
  raise
@@ -65,18 +71,21 @@ module Usmu
65
71
  end
66
72
 
67
73
  def command_serve(args, options)
74
+ raise 'This command does not take arguments' unless args.empty?
75
+ raise 'Invalid options' unless options.inspect.start_with? '<Commander::Command::Options '
76
+
68
77
  configuration = @ui.configuration
69
78
  @log.info('Starting webserver...')
70
- require 'rack'
71
- require 'usmu/ui/rack_server'
72
79
 
73
80
  Rack::Handler::WEBrick.run Ui::RackServer.new(configuration),
74
- host: configuration['serve', 'host', default: '0.0.0.0'],
81
+ host: configuration['serve', 'host', default: 'localhost'],
75
82
  port: configuration['serve', 'port', default: 8080]
76
83
  end
77
84
 
78
85
  private
79
86
 
87
+ attr_accessor :ui
88
+
80
89
  # Helper to copy a file.
81
90
  #
82
91
  # @param [String] from
@@ -9,6 +9,14 @@ module Usmu
9
9
  # @param [Usmu::Ui::Console] ui The UI instance for this session.
10
10
  # @param [Commander::Runner] c The Commander instance to add commands to.
11
11
  def commands(ui, c); end
12
+
13
+ # Hook to allow altering the list of files that are in the site.
14
+ #
15
+ # @param [Array<Usmu::Template::StaticFile>] renderables An array of renderables.
16
+ # @param [Usmu::SiteGenerator] generator The site generator being used.
17
+ #
18
+ # @return [Array<Usmu::Template::StaticFile>] The altered list of renderables.
19
+ def renderables_alter(renderables, generator); end
12
20
  end
13
21
  end
14
22
  end
@@ -29,28 +29,18 @@ module Usmu
29
29
  # The only guarantee made for individual files is that they will conform to the interface defined by
30
30
  # Usmu::Template::StaticFile and thus be renderable, however most files will be one of the subclasses of that class.
31
31
  def renderables
32
- @configuration.source_files.map do |filename|
33
- metadata = @configuration.source_metadata.metadata(filename)
34
- if Template::Layout.is_valid_file?('source', filename) && (!metadata['static'])
35
- Template::Page.new(@configuration, filename, metadata)
36
- else
37
- Template::StaticFile.new(@configuration, filename, metadata)
32
+ @renderables ||= begin
33
+ rs = @configuration.source_files.map do |filename|
34
+ metadata = @configuration.source_metadata.metadata(filename)
35
+ if Template::Layout.is_valid_file?('source', filename) && (!metadata['static'])
36
+ Template::Page.new(@configuration, filename, metadata)
37
+ else
38
+ Template::StaticFile.new(@configuration, filename, metadata)
39
+ end
38
40
  end
39
- end
40
- end
41
-
42
- # @!attribute [r] pages
43
- # @return [Array<Usmu::Template::Page>]
44
- # a list of pages from the source folder. This is any file in the source folder which is not static.
45
- def pages
46
- renderables.select {|r| r.class <= Template::Layout }
47
- end
48
41
 
49
- # @!attribute [r] files
50
- # @return [Array<Usmu::Template::StaticFile>]
51
- # a list of static files from the source folder.
52
- def files
53
- renderables - pages
42
+ Usmu.plugins.alter(:renderables, rs, self)
43
+ end
54
44
  end
55
45
 
56
46
  # Generate the website according to the configuration given.
@@ -95,7 +85,9 @@ module Usmu
95
85
  end
96
86
 
97
87
  File.write file, page.render
98
- FileUtils.touch file, mtime: File.stat(page.input_path).mtime
88
+
89
+ mtime = page.input_path.nil? ? Time.now.to_i : File.stat(page.input_path).mtime
90
+ FileUtils.touch file, mtime: mtime
99
91
  nil
100
92
  end
101
93
  end
@@ -0,0 +1,30 @@
1
+ require 'usmu/template/static_file'
2
+
3
+ module Usmu
4
+ module Template
5
+ class GeneratedFile < StaticFile
6
+ def initialize(configuration, name, metadata = {}, type = nil, content = nil)
7
+ super(configuration, name, metadata, type, content)
8
+ end
9
+
10
+ def render
11
+ unless @content
12
+ raise 'Render not implemented'
13
+ end
14
+ @content
15
+ end
16
+
17
+ def input_path
18
+ nil
19
+ end
20
+
21
+ def metadata
22
+ @metadata
23
+ end
24
+
25
+ def inspect
26
+ "\#<#{self.class}:#{'0x%08x' % __id__} #{@name} => #{output_filename}>"
27
+ end
28
+ end
29
+ end
30
+ end
data/lib/usmu/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Usmu
3
3
  # The current version string for the gem
4
- VERSION = '1.0.1'
4
+ VERSION = '1.1.0'
5
5
  end
@@ -2,7 +2,7 @@ doctype html
2
2
  html
3
3
  head
4
4
  meta http-equiv="Content-Type" content="text/html; charset=utf-8"
5
- title #{site.title}
5
+ title #{site['title']}
6
6
 
7
7
  body
8
8
  | #{{content}}
File without changes
File without changes
@@ -0,0 +1,31 @@
1
+
2
+ module Usmu
3
+ class MockCommander
4
+ def initialize
5
+ @commands = {}
6
+ end
7
+
8
+ def get_command(name)
9
+ @commands[name]
10
+ end
11
+
12
+ def command(name, &block)
13
+ @current_command = name
14
+ @commands[name] = {}
15
+
16
+ block.yield(self)
17
+ end
18
+
19
+ def syntax=(value)
20
+ @commands[@current_command][:syntax] = value
21
+ end
22
+
23
+ def description=(value)
24
+ @commands[@current_command][:description] = value
25
+ end
26
+
27
+ def action(&block)
28
+ @commands[@current_command][:action] = block
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,116 @@
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
@@ -264,15 +264,11 @@ RSpec.describe Usmu::Configuration do
264
264
  expect(configuration.send :excluded?, 'index.md').to eq(false)
265
265
  end
266
266
 
267
- # FNM_EXTGLOB is supported from MRI 2.0 onwards. We also support the 1.9.3 ABI for JRuby and Rubinius sake. Only
268
- # run this test if it's possible for it to pass.
269
- if defined?(File::FNM_EXTGLOB)
270
- it 'should honor {a,b}' do
271
- configuration = Usmu::Configuration.from_hash({'exclude' => ['{a,b}.md']})
272
- expect(configuration.send :excluded?, 'a.md').to eq(true)
273
- expect(configuration.send :excluded?, 'b.md').to eq(true)
274
- expect(configuration.send :excluded?, 'index.md').to eq(false)
275
- end
267
+ it 'should honor {a,b}' do
268
+ configuration = Usmu::Configuration.from_hash({'exclude' => ['{a,b}.md']})
269
+ expect(configuration.send :excluded?, 'a.md').to eq(true)
270
+ expect(configuration.send :excluded?, 'b.md').to eq(true)
271
+ expect(configuration.send :excluded?, 'index.md').to eq(false)
276
272
  end
277
273
 
278
274
  it 'should honor \\ as an escape' do
@@ -59,33 +59,7 @@ RSpec.describe Usmu::SiteGenerator do
59
59
  end
60
60
 
61
61
  it 'should not list directories' do
62
- expect(generator.files.select {|f| f.name == 'posts'}.length).to eq(0)
63
- end
64
- end
65
-
66
- context '#pages' do
67
- it 'should list pages' do
68
- expect(generator).to receive(:renderables).and_return(
69
- [
70
- instance_double('Usmu::Template::StaticFile', class: Usmu::Template::StaticFile, name: 'robots.txt'),
71
- instance_double('Usmu::Template::Layout', class: Usmu::Template::Layout, name: 'layout.slim'),
72
- instance_double('Usmu::Template::Page', class: Usmu::Template::Page, name: 'page.md'),
73
- ]
74
- )
75
- expect(generator.pages.map {|p| p.name}.sort).to eq(%w{layout.slim page.md})
76
- end
77
- end
78
-
79
- context '#files' do
80
- it 'should list static files' do
81
- expect(generator).to receive(:renderables).at_least(1).times.and_return(
82
- [
83
- instance_double('Usmu::Template::StaticFile', class: Usmu::Template::StaticFile, name: 'robots.txt'),
84
- instance_double('Usmu::Template::Layout', class: Usmu::Template::Layout, name: 'layout.slim'),
85
- instance_double('Usmu::Template::Page', class: Usmu::Template::Page, name: 'page.md'),
86
- ]
87
- )
88
- expect(generator.files.map {|f| f.name}.sort).to eq(%w{robots.txt})
62
+ expect(generator.renderables.select {|f| f.name == 'posts'}.length).to eq(0)
89
63
  end
90
64
  end
91
65
 
data/usmu.gemspec CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.test_files = spec.files.grep(%r{^(test-site|spec)/})
22
22
  spec.require_paths = ['lib']
23
23
 
24
- spec.required_ruby_version = Gem::Requirement.new('>= 1.9.3')
24
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.0')
25
25
 
26
26
  spec.add_dependency 'slim', '~> 3.0'
27
27
  spec.add_dependency 'tilt', '~> 2.0'
@@ -42,7 +42,7 @@ Gem::Specification.new do |spec|
42
42
 
43
43
  case ENV['BUILD_PLATFORM']
44
44
  when 'ruby'
45
- spec.add_dependency 'redcarpet', '~> 3.2', '>= 3.2.1'
45
+ spec.add_dependency 'redcarpet', '~> 3.3'
46
46
  spec.add_development_dependency 'libnotify', '~> 0.9'
47
47
  when 'java'
48
48
  spec.platform = 'java'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usmu
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: java
6
6
  authors:
7
7
  - Matthew Scharley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-02 00:00:00.000000000 Z
11
+ date: 2015-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: slim
@@ -268,6 +268,7 @@ files:
268
268
  - lib/usmu/plugin/core.rb
269
269
  - lib/usmu/plugin/core_hooks.rb
270
270
  - lib/usmu/site_generator.rb
271
+ - lib/usmu/template/generated_file.rb
271
272
  - lib/usmu/template/helpers.rb
272
273
  - lib/usmu/template/include.rb
273
274
  - lib/usmu/template/layout.rb
@@ -280,14 +281,16 @@ files:
280
281
  - share/init-site/.gitignore
281
282
  - share/init-site/Gemfile
282
283
  - share/init-site/layouts/html.slim
283
- - share/init-site/source/index.md
284
- - share/init-site/source/index.meta.yml
284
+ - share/init-site/src/index.md
285
+ - share/init-site/src/index.meta.yml
285
286
  - share/init-site/usmu.yml
286
287
  - spec/acceptance/full_site_build.feature
287
288
  - spec/acceptance/steps/full_site_build_steps.rb
289
+ - spec/mock/usmu/mock_commander.rb
288
290
  - spec/mock/usmu/mock_metadata_configuration.rb
289
291
  - spec/mock/usmu/mock_plugin.rb
290
292
  - spec/mock/usmu/mock_remote_files.rb
293
+ - spec/plugin/core_spec.rb
291
294
  - spec/spec_helper.rb
292
295
  - spec/support/shared_layout.rb
293
296
  - spec/usmu/configuration_spec.rb
@@ -348,7 +351,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
348
351
  requirements:
349
352
  - - ">="
350
353
  - !ruby/object:Gem::Version
351
- version: 1.9.3
354
+ version: '2.0'
352
355
  required_rubygems_version: !ruby/object:Gem::Requirement
353
356
  requirements:
354
357
  - - ">="
@@ -356,16 +359,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
356
359
  version: '0'
357
360
  requirements: []
358
361
  rubyforge_project:
359
- rubygems_version: 2.4.5
362
+ rubygems_version: 2.4.8
360
363
  signing_key:
361
364
  specification_version: 4
362
365
  summary: A static site generator with a web-based frontend for editing.
363
366
  test_files:
364
367
  - spec/acceptance/full_site_build.feature
365
368
  - spec/acceptance/steps/full_site_build_steps.rb
369
+ - spec/mock/usmu/mock_commander.rb
366
370
  - spec/mock/usmu/mock_metadata_configuration.rb
367
371
  - spec/mock/usmu/mock_plugin.rb
368
372
  - spec/mock/usmu/mock_remote_files.rb
373
+ - spec/plugin/core_spec.rb
369
374
  - spec/spec_helper.rb
370
375
  - spec/support/shared_layout.rb
371
376
  - spec/usmu/configuration_spec.rb