-
-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
184 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-r ./spec/spec_helper_nanoc.rb | ||
--format Fuubar | ||
--color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-r ./spec/spec_helper_nanoc_live.rb | ||
--format Fuubar | ||
--color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'nanoc' | ||
require 'nanoc/cli' | ||
|
||
module Nanoc | ||
module Live | ||
end | ||
end | ||
|
||
require_relative 'live/version' | ||
require_relative 'live/live_recompiler' | ||
|
||
Nanoc::CLI.after_setup do | ||
cmd = Nanoc::CLI.load_command_at(__dir__ + '/live/command.rb', 'live') | ||
Nanoc::CLI.root_command.add_command(cmd) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
lib/nanoc/extra/live_recompiler.rb → lib/nanoc/live/live_recompiler.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
module Nanoc | ||
module Live | ||
VERSION = '0.0.1' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative 'lib/nanoc/version' | ||
require_relative 'lib/nanoc/live/version' | ||
|
||
Gem::Specification.new do |s| | ||
s.name = 'nanoc-live' | ||
s.version = Nanoc::Live::VERSION | ||
s.homepage = 'http://nanoc.ws/' | ||
s.summary = 'Live command for Nanoc' | ||
|
||
s.author = 'Denis Defreyne' | ||
s.email = 'denis@stoneship.org' | ||
s.license = 'MIT' | ||
|
||
all_files = `git ls-files -z`.split("\x0") | ||
s.files = all_files.select { |fn| fn =~ %r{nanoc[_/-]live} } | ||
s.require_paths = ['lib'] | ||
|
||
s.required_ruby_version = '>= 2.3.0' | ||
|
||
s.add_runtime_dependency('listen', '~> 3.0') | ||
s.add_runtime_dependency('slow_enumerator_tools', '~> 1.0') | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.rspec-nanoc-live | ||
nanoc-live.gemspec | ||
nanoc-live.manifest | ||
|
||
lib/nanoc/live.rb | ||
lib/nanoc/live/version.rb | ||
lib/nanoc/live/command.rb | ||
lib/nanoc/live/live_recompiler.rb | ||
|
||
spec/nanoc/live/live_recompiler_spec.rb | ||
spec/spec_helper_nanoc_live.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,36 @@ | ||
# frozen_string_literal: true | ||
|
||
describe 'manifest', chdir: false do | ||
let(:gem_names) do | ||
Dir['*.gemspec'].map { |fn| fn.sub(/\.gemspec$/, '') } | ||
end | ||
|
||
let(:manifest_lines) do | ||
File.readlines('nanoc.manifest').map(&:chomp).reject(&:empty?) | ||
gem_names.each_with_object({}) do |gem_name, memo| | ||
raw_lines = File.readlines(gem_name + '.manifest') | ||
memo[gem_name] = raw_lines.map(&:chomp).reject(&:empty?) | ||
end | ||
end | ||
|
||
let(:gemspec_lines) do | ||
gemspec = eval(File.read('nanoc.gemspec'), binding, 'nanoc.gemspec') | ||
gemspec.files | ||
gem_names.each_with_object({}) do |gem_name, memo| | ||
gemspec_filename = gem_name + '.gemspec' | ||
gemspec = eval(File.read(gemspec_filename), binding, gemspec_filename) | ||
memo[gem_name] = gemspec.files | ||
end | ||
end | ||
|
||
it 'contains all files in gemspec' do | ||
missing_from_manifest = gemspec_lines - manifest_lines | ||
expect(missing_from_manifest).to be_empty, "Found files that appear in the gemspec, but not in the manifest: #{missing_from_manifest.join(', ')}" | ||
gem_names.each do |gem_name| | ||
missing_from_manifest = gemspec_lines.fetch(gem_name) - manifest_lines.fetch(gem_name) | ||
expect(missing_from_manifest).to be_empty, "Found files that appear in the gemspec, but not in the manifest: #{missing_from_manifest.join(', ')}" | ||
end | ||
end | ||
|
||
it 'contains no files not in gemspec' do | ||
extra_in_manifest = manifest_lines - gemspec_lines | ||
expect(extra_in_manifest).to be_empty, "Found files that appear in the manifest, but not in the gemspec: #{extra_in_manifest.join(', ')}" | ||
gem_names.each do |gem_name| | ||
extra_in_manifest = manifest_lines.fetch(gem_name) - gemspec_lines.fetch(gem_name) | ||
expect(extra_in_manifest).to be_empty, "Found files that appear in the manifest, but not in the gemspec: #{extra_in_manifest.join(', ')}" | ||
end | ||
end | ||
end |
2 changes: 1 addition & 1 deletion
2
spec/nanoc/extra/live_recompiler_spec.rb → spec/nanoc/live/live_recompiler_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'simplecov' | ||
SimpleCov.start | ||
|
||
require 'codecov' | ||
SimpleCov.formatter = SimpleCov::Formatter::Codecov | ||
|
||
require 'nanoc/live' | ||
|
||
require 'rspec/its' | ||
require 'fuubar' | ||
|
||
RSpec.configure do |c| | ||
c.fuubar_progress_bar_options = { | ||
format: '%c/%C |<%b>%i| %p%%', | ||
} | ||
|
||
c.around(:each) do |example| | ||
Dir.mktmpdir('nanoc-test') do |dir| | ||
Dir.chdir(dir) { example.run } | ||
end | ||
end | ||
|
||
c.around(:each, chdir: false) do |example| | ||
Dir.chdir(__dir__ + '/..') | ||
example.run | ||
end | ||
|
||
c.before(:each) do | ||
Nanoc::Int::NotificationCenter.reset | ||
end | ||
|
||
c.around(:each, stdio: true) do |example| | ||
orig_stdout = $stdout | ||
orig_stderr = $stderr | ||
|
||
unless ENV['QUIET'] == 'false' | ||
$stdout = StringIO.new | ||
$stderr = StringIO.new | ||
end | ||
|
||
example.run | ||
|
||
$stdout = orig_stdout | ||
$stderr = orig_stderr | ||
end | ||
|
||
c.before(:each, site: true) do | ||
FileUtils.mkdir_p('content') | ||
FileUtils.mkdir_p('layouts') | ||
FileUtils.mkdir_p('lib') | ||
FileUtils.mkdir_p('output') | ||
|
||
File.write('nanoc.yaml', '{}') | ||
|
||
File.write('Rules', 'passthrough "/**/*"') | ||
end | ||
end |