benoit 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/.gitmodules +3 -0
- data/.rspec +1 -0
- data/.rspec-turnip +1 -0
- data/.ruby-version +1 -0
- data/Assetfile +44 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +110 -0
- data/Rakefile +9 -0
- data/benoit.gemspec +50 -0
- data/bin/benoit +121 -0
- data/bin/bundle-development +1 -0
- data/bin/bundle-sandbox +1 -0
- data/lib/benoit.rb +36 -0
- data/lib/benoit/cadenza.rb +11 -0
- data/lib/benoit/cadenza/output_filters.rb +21 -0
- data/lib/benoit/cleaner.rb +10 -0
- data/lib/benoit/compiler_error.rb +49 -0
- data/lib/benoit/configuration.rb +24 -0
- data/lib/benoit/current_site.rb +12 -0
- data/lib/benoit/file_wrapper_extensions.rb +13 -0
- data/lib/benoit/filters.rb +15 -0
- data/lib/benoit/filters/base_filter.rb +44 -0
- data/lib/benoit/filters/blacklist_filter.rb +18 -0
- data/lib/benoit/filters/cadenza_filter.rb +75 -0
- data/lib/benoit/filters/content_page_filter.rb +45 -0
- data/lib/benoit/filters/markdown_filter.rb +19 -0
- data/lib/benoit/filters/metadata_cleaner.rb +30 -0
- data/lib/benoit/filters/move_to_root_filter.rb +22 -0
- data/lib/benoit/filters/pagination_filter.rb +23 -0
- data/lib/benoit/filters/pass_thru_filter.rb +22 -0
- data/lib/benoit/filters/sass_filter.rb +74 -0
- data/lib/benoit/filters/set_metadata_filter.rb +15 -0
- data/lib/benoit/logger.rb +69 -0
- data/lib/benoit/page.rb +88 -0
- data/lib/benoit/page_metadata.rb +8 -0
- data/lib/benoit/page_metadata/container.rb +74 -0
- data/lib/benoit/page_metadata/json_converter.rb +28 -0
- data/lib/benoit/page_metadata/parser.rb +38 -0
- data/lib/benoit/page_metadata/store.rb +75 -0
- data/lib/benoit/pipeline.rb +1 -0
- data/lib/benoit/pipeline/dsl_extensions.rb +8 -0
- data/lib/benoit/pipeline/pagination_matcher.rb +53 -0
- data/lib/benoit/pipeline_project.rb +81 -0
- data/lib/benoit/site_context.rb +123 -0
- data/lib/benoit/utils/finds_layouts_for_template.rb +77 -0
- data/lib/benoit/utils/normalizes_path_to_template.rb +43 -0
- data/lib/benoit/utils/paginated_list.rb +102 -0
- data/lib/benoit/version.rb +3 -0
- data/lib/build_notifiers/file_built_notifier.rb +20 -0
- data/lib/build_notifiers/progress_notifier.rb +57 -0
- data/lib/cli.rb +39 -0
- data/spec/.rbenv-gemsets +1 -0
- data/spec/Gemfile +9 -0
- data/spec/Gemfile.lock +57 -0
- data/spec/bin/autospec +16 -0
- data/spec/bin/cucumber +16 -0
- data/spec/bin/htmldiff +16 -0
- data/spec/bin/ldiff +16 -0
- data/spec/bin/rspec +16 -0
- data/spec/features/build_command.feature +46 -0
- data/spec/features/frontmatter_metadata.feature +99 -0
- data/spec/features/javascript_files.feature +35 -0
- data/spec/features/output_filters.feature +20 -0
- data/spec/features/page_layouts.feature +72 -0
- data/spec/features/pagination.feature +58 -0
- data/spec/features/sass_files.feature +30 -0
- data/spec/features/version.feature +5 -0
- data/spec/lib/filters/base_filter_spec.rb +141 -0
- data/spec/lib/filters/markdown_filter_spec.rb +65 -0
- data/spec/lib/filters/sass_filter_spec.rb +73 -0
- data/spec/lib/metadata_json_converter_spec.rb +65 -0
- data/spec/lib/metadata_store_spec.rb +148 -0
- data/spec/lib/page_spec.rb +19 -0
- data/spec/lib/site_context_spec.rb +106 -0
- data/spec/spec_helper.rb +16 -0
- data/spec/steps/output_file_steps.rb +45 -0
- data/spec/steps/run_steps.rb +71 -0
- data/spec/steps/staticly_steps.rb +194 -0
- data/spec/support/aruba/rspec.rb +66 -0
- data/spec/support/files/img.png +0 -0
- data/spec/support/files/input.css.scss +7 -0
- data/spec/support/files/input.scss +7 -0
- data/spec/support/spec_helpers/file_helpers.rb +8 -0
- data/spec/support/spec_helpers/memory_file_wrapper.rb +43 -0
- data/spec/support/spec_helpers/memory_manifest.rb +19 -0
- data/spec/turnip_helper.rb +19 -0
- data/vendor/frontmatter/frontmatter.gemspec +24 -0
- data/vendor/frontmatter/lib/frontmatter.rb +92 -0
- data/vendor/frontmatter/lib/frontmatter/version.rb +3 -0
- data/vendor/rake-pipeline/.gitignore +18 -0
- data/vendor/rake-pipeline/.rspec +1 -0
- data/vendor/rake-pipeline/.travis.yml +12 -0
- data/vendor/rake-pipeline/.yardopts +2 -0
- data/vendor/rake-pipeline/GETTING_STARTED.md +268 -0
- data/vendor/rake-pipeline/Gemfile +14 -0
- data/vendor/rake-pipeline/LICENSE +20 -0
- data/vendor/rake-pipeline/README.markdown +11 -0
- data/vendor/rake-pipeline/README.yard +178 -0
- data/vendor/rake-pipeline/Rakefile +21 -0
- data/vendor/rake-pipeline/bin/rakep +4 -0
- data/vendor/rake-pipeline/examples/copying_files.md +12 -0
- data/vendor/rake-pipeline/examples/minifying_files.md +37 -0
- data/vendor/rake-pipeline/examples/modifying_pipelines.md +67 -0
- data/vendor/rake-pipeline/examples/multiple_pipelines.md +77 -0
- data/vendor/rake-pipeline/lib/generators/rake/pipeline/install/install_generator.rb +70 -0
- data/vendor/rake-pipeline/lib/rake-pipeline.rb +509 -0
- data/vendor/rake-pipeline/lib/rake-pipeline/cli.rb +57 -0
- data/vendor/rake-pipeline/lib/rake-pipeline/dsl.rb +9 -0
- data/vendor/rake-pipeline/lib/rake-pipeline/dsl/pipeline_dsl.rb +246 -0
- data/vendor/rake-pipeline/lib/rake-pipeline/dsl/project_dsl.rb +108 -0
- data/vendor/rake-pipeline/lib/rake-pipeline/dynamic_file_task.rb +194 -0
- data/vendor/rake-pipeline/lib/rake-pipeline/error.rb +17 -0
- data/vendor/rake-pipeline/lib/rake-pipeline/file_wrapper.rb +195 -0
- data/vendor/rake-pipeline/lib/rake-pipeline/filter.rb +267 -0
- data/vendor/rake-pipeline/lib/rake-pipeline/filters.rb +4 -0
- data/vendor/rake-pipeline/lib/rake-pipeline/filters/concat_filter.rb +63 -0
- data/vendor/rake-pipeline/lib/rake-pipeline/filters/gsub_filter.rb +56 -0
- data/vendor/rake-pipeline/lib/rake-pipeline/filters/ordering_concat_filter.rb +38 -0
- data/vendor/rake-pipeline/lib/rake-pipeline/filters/pipeline_finalizing_filter.rb +21 -0
- data/vendor/rake-pipeline/lib/rake-pipeline/graph.rb +178 -0
- data/vendor/rake-pipeline/lib/rake-pipeline/manifest.rb +82 -0
- data/vendor/rake-pipeline/lib/rake-pipeline/manifest_entry.rb +34 -0
- data/vendor/rake-pipeline/lib/rake-pipeline/matcher.rb +141 -0
- data/vendor/rake-pipeline/lib/rake-pipeline/middleware.rb +73 -0
- data/vendor/rake-pipeline/lib/rake-pipeline/precompile.rake +8 -0
- data/vendor/rake-pipeline/lib/rake-pipeline/project.rb +338 -0
- data/vendor/rake-pipeline/lib/rake-pipeline/rails_plugin.rb +10 -0
- data/vendor/rake-pipeline/lib/rake-pipeline/railtie.rb +34 -0
- data/vendor/rake-pipeline/lib/rake-pipeline/reject_matcher.rb +29 -0
- data/vendor/rake-pipeline/lib/rake-pipeline/server.rb +15 -0
- data/vendor/rake-pipeline/lib/rake-pipeline/sorted_pipeline.rb +19 -0
- data/vendor/rake-pipeline/lib/rake-pipeline/version.rb +6 -0
- data/vendor/rake-pipeline/rails/init.rb +2 -0
- data/vendor/rake-pipeline/rake-pipeline.gemspec +24 -0
- data/vendor/rake-pipeline/spec/cli_spec.rb +73 -0
- data/vendor/rake-pipeline/spec/concat_filter_spec.rb +37 -0
- data/vendor/rake-pipeline/spec/dsl/pipeline_dsl_spec.rb +165 -0
- data/vendor/rake-pipeline/spec/dsl/project_dsl_spec.rb +41 -0
- data/vendor/rake-pipeline/spec/dynamic_file_task_spec.rb +119 -0
- data/vendor/rake-pipeline/spec/encoding_spec.rb +106 -0
- data/vendor/rake-pipeline/spec/file_wrapper_spec.rb +132 -0
- data/vendor/rake-pipeline/spec/filter_spec.rb +367 -0
- data/vendor/rake-pipeline/spec/graph_spec.rb +56 -0
- data/vendor/rake-pipeline/spec/gsub_filter_spec.rb +87 -0
- data/vendor/rake-pipeline/spec/manifest_entry_spec.rb +46 -0
- data/vendor/rake-pipeline/spec/manifest_spec.rb +67 -0
- data/vendor/rake-pipeline/spec/matcher_spec.rb +141 -0
- data/vendor/rake-pipeline/spec/middleware_spec.rb +199 -0
- data/vendor/rake-pipeline/spec/ordering_concat_filter_spec.rb +42 -0
- data/vendor/rake-pipeline/spec/pipeline_spec.rb +232 -0
- data/vendor/rake-pipeline/spec/project_spec.rb +295 -0
- data/vendor/rake-pipeline/spec/rake_acceptance_spec.rb +720 -0
- data/vendor/rake-pipeline/spec/rake_tasks_spec.rb +21 -0
- data/vendor/rake-pipeline/spec/reject_matcher_spec.rb +31 -0
- data/vendor/rake-pipeline/spec/sorted_pipeline_spec.rb +27 -0
- data/vendor/rake-pipeline/spec/spec_helper.rb +38 -0
- data/vendor/rake-pipeline/spec/support/spec_helpers/file_utils.rb +35 -0
- data/vendor/rake-pipeline/spec/support/spec_helpers/filters.rb +37 -0
- data/vendor/rake-pipeline/spec/support/spec_helpers/input_helpers.rb +23 -0
- data/vendor/rake-pipeline/spec/support/spec_helpers/memory_file_wrapper.rb +35 -0
- data/vendor/rake-pipeline/spec/support/spec_helpers/memory_manifest.rb +19 -0
- data/vendor/rake-pipeline/tools/perfs +101 -0
- metadata +497 -0
data/.gitignore
ADDED
data/.gitmodules
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
-I ./lib/benoit -I ./spec/support -I ./vendor/rake-pipeline/lib -fd
|
data/.rspec-turnip
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
-r turnip/rspec -I spec/support
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.9.3-p392
|
data/Assetfile
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'benoit/pipeline/dsl_extensions'
|
2
|
+
|
3
|
+
before_filter Benoit::Filters::MetadataCleaner
|
4
|
+
|
5
|
+
input Dir.pwd do
|
6
|
+
|
7
|
+
reject "_*"
|
8
|
+
reject ".git"
|
9
|
+
reject ".gitignore"
|
10
|
+
|
11
|
+
match "**/*{.markdown,.md,.mkdown,.mdown}" do
|
12
|
+
filter Benoit::Filters::MarkdownFilter
|
13
|
+
end
|
14
|
+
|
15
|
+
match "**/*.js" do
|
16
|
+
concat do |input|
|
17
|
+
directory = File.dirname(input)
|
18
|
+
"#{directory}/app.js"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
match "**/*.handlebars" do
|
23
|
+
filter Rake::Pipeline::Web::Filters::HandlebarsFilter
|
24
|
+
concat do |input|
|
25
|
+
directory = File.dirname(input)
|
26
|
+
js_dirs = Dir["**/*.js"].map { |js_file| File.dirname(js_file) }
|
27
|
+
js_root = js_dirs.sort(&:length).first
|
28
|
+
"#{js_root}/templates.js"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
match "*.scss" do
|
33
|
+
filter Benoit::Filters::SassFilter, additional_load_paths: ["styles", "css"]
|
34
|
+
end
|
35
|
+
|
36
|
+
needs_pagination "*.html"
|
37
|
+
|
38
|
+
match "**/*.html" do
|
39
|
+
filter Benoit::Filters::ContentPageFilter
|
40
|
+
filter Benoit::Filters::CadenzaFilter
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
benoit (1.0.0.alpha.2)
|
5
|
+
cadenza (~> 0.8.0)
|
6
|
+
chunky_png (~> 1.2.0)
|
7
|
+
compass (~> 0.13.alpha)
|
8
|
+
gli (~> 2.5.3)
|
9
|
+
inflecto (~> 0.0.2)
|
10
|
+
kronic (~> 1.1.3)
|
11
|
+
multi_json (~> 1.5.0)
|
12
|
+
rake-pipeline-web-filters (~> 0.7.0)
|
13
|
+
redcarpet (~> 2.2.2)
|
14
|
+
sass (~> 3.2.0)
|
15
|
+
stamp (~> 0.5.0)
|
16
|
+
|
17
|
+
PATH
|
18
|
+
remote: vendor/frontmatter
|
19
|
+
specs:
|
20
|
+
frontmatter (0.0.1)
|
21
|
+
|
22
|
+
PATH
|
23
|
+
remote: vendor/rake-pipeline
|
24
|
+
specs:
|
25
|
+
rake-pipeline (0.8.0)
|
26
|
+
json
|
27
|
+
rake (~> 0.9.0)
|
28
|
+
thor
|
29
|
+
|
30
|
+
GEM
|
31
|
+
remote: https://www.rubygems.org/
|
32
|
+
specs:
|
33
|
+
aruba (0.5.2)
|
34
|
+
childprocess (~> 0.3.6)
|
35
|
+
cucumber (>= 1.1.1)
|
36
|
+
rspec-expectations (>= 2.7.0)
|
37
|
+
builder (3.2.0)
|
38
|
+
cadenza (0.8.0)
|
39
|
+
multi_json (>= 1.3.0)
|
40
|
+
childprocess (0.3.9)
|
41
|
+
ffi (~> 1.0, >= 1.0.11)
|
42
|
+
chunky_png (1.2.8)
|
43
|
+
coderay (1.0.9)
|
44
|
+
compass (0.13.alpha.4)
|
45
|
+
chunky_png (~> 1.2)
|
46
|
+
listen (<= 0.9.9)
|
47
|
+
sass (~> 3.2.5)
|
48
|
+
cucumber (1.2.5)
|
49
|
+
builder (>= 2.1.2)
|
50
|
+
diff-lcs (>= 1.1.3)
|
51
|
+
gherkin (~> 2.11.7)
|
52
|
+
multi_json (~> 1.3)
|
53
|
+
diff-lcs (1.2.4)
|
54
|
+
ffi (1.7.0)
|
55
|
+
gherkin (2.11.8)
|
56
|
+
multi_json (~> 1.3)
|
57
|
+
gli (2.5.6)
|
58
|
+
inflecto (0.0.2)
|
59
|
+
json (1.7.7)
|
60
|
+
kronic (1.1.3)
|
61
|
+
listen (0.7.3)
|
62
|
+
method_source (0.8.1)
|
63
|
+
multi_json (1.5.1)
|
64
|
+
pry (0.9.12)
|
65
|
+
coderay (~> 1.0.5)
|
66
|
+
method_source (~> 0.8)
|
67
|
+
slop (~> 3.4)
|
68
|
+
pry-nav (0.2.3)
|
69
|
+
pry (~> 0.9.10)
|
70
|
+
pry-remote (0.1.7)
|
71
|
+
pry (~> 0.9)
|
72
|
+
slop (~> 3.0)
|
73
|
+
rack (1.5.2)
|
74
|
+
rake (0.9.6)
|
75
|
+
rake-pipeline-web-filters (0.7.0)
|
76
|
+
rack
|
77
|
+
rake-pipeline (~> 0.6)
|
78
|
+
redcarpet (2.2.2)
|
79
|
+
rspec (2.13.0)
|
80
|
+
rspec-core (~> 2.13.0)
|
81
|
+
rspec-expectations (~> 2.13.0)
|
82
|
+
rspec-mocks (~> 2.13.0)
|
83
|
+
rspec-core (2.13.1)
|
84
|
+
rspec-expectations (2.13.0)
|
85
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
86
|
+
rspec-mocks (2.13.1)
|
87
|
+
sass (3.2.7)
|
88
|
+
slop (3.4.4)
|
89
|
+
stamp (0.5.0)
|
90
|
+
thor (0.18.1)
|
91
|
+
turnip (1.1.0)
|
92
|
+
gherkin (>= 2.5)
|
93
|
+
rspec (~> 2.0)
|
94
|
+
turnip-kanban (0.0.1)
|
95
|
+
turnip
|
96
|
+
|
97
|
+
PLATFORMS
|
98
|
+
ruby
|
99
|
+
|
100
|
+
DEPENDENCIES
|
101
|
+
aruba
|
102
|
+
benoit!
|
103
|
+
frontmatter!
|
104
|
+
pry
|
105
|
+
pry-nav
|
106
|
+
pry-remote
|
107
|
+
rake-pipeline!
|
108
|
+
rspec
|
109
|
+
turnip (~> 1.1.0)
|
110
|
+
turnip-kanban
|
data/Rakefile
ADDED
data/benoit.gemspec
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# Ensure we require the local version and not one we might have installed already
|
2
|
+
require File.join([File.dirname(__FILE__),'lib','benoit','version.rb'])
|
3
|
+
spec = Gem::Specification.new do |s|
|
4
|
+
s.name = 'benoit'
|
5
|
+
s.version = Benoit::VERSION
|
6
|
+
s.author = 'Joe Fiorini'
|
7
|
+
s.email = 'joe@joefiorini.com'
|
8
|
+
s.homepage = 'http://static.ly'
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
s.summary = 'The CLI interface behind the Benoit Mac app'
|
11
|
+
|
12
|
+
vendor_files = `git submodule foreach git ls-files`.split("\n")
|
13
|
+
vendor_files =
|
14
|
+
vendor_files.map do |file|
|
15
|
+
if match = /^Entering '(.*)'$/.match(file)
|
16
|
+
@current_dir = match[1]
|
17
|
+
nil
|
18
|
+
else
|
19
|
+
File.join(@current_dir, file)
|
20
|
+
end
|
21
|
+
end.compact
|
22
|
+
|
23
|
+
s.files = `git ls-files -z`.split("\0") + vendor_files
|
24
|
+
|
25
|
+
s.require_paths << 'lib'
|
26
|
+
s.bindir = 'bin'
|
27
|
+
s.executables << 'benoit'
|
28
|
+
|
29
|
+
s.add_dependency "gli", "~> 2.5.3"
|
30
|
+
s.add_dependency "sass", "~> 3.2.0"
|
31
|
+
s.add_dependency "multi_json", "~> 1.5.0"
|
32
|
+
s.add_dependency "redcarpet", "~> 2.2.2"
|
33
|
+
s.add_dependency "compass", "~> 0.13.alpha"
|
34
|
+
s.add_dependency "chunky_png", "~> 1.2.0"
|
35
|
+
s.add_dependency "inflecto", "~> 0.0.2"
|
36
|
+
s.add_dependency "cadenza", "~> 0.8.0"
|
37
|
+
s.add_dependency "rake-pipeline-web-filters", "~> 0.7.0"
|
38
|
+
s.add_dependency "kronic", "~> 1.1.3"
|
39
|
+
s.add_dependency "stamp", "~> 0.5.0"
|
40
|
+
|
41
|
+
|
42
|
+
s.add_development_dependency "rspec"
|
43
|
+
s.add_development_dependency "turnip", "~> 1.1.0"
|
44
|
+
s.add_development_dependency "turnip-kanban"
|
45
|
+
s.add_development_dependency "aruba"
|
46
|
+
s.add_development_dependency "pry"
|
47
|
+
s.add_development_dependency "pry-nav"
|
48
|
+
s.add_development_dependency "pry-remote"
|
49
|
+
|
50
|
+
end
|
data/bin/benoit
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift File.expand_path("../../bundle", __FILE__)
|
3
|
+
$:.unshift File.expand_path("../../lib", __FILE__)
|
4
|
+
|
5
|
+
# Force bundler to load standalone bundle
|
6
|
+
# even if it's already loaded
|
7
|
+
load 'bundler/setup.rb'
|
8
|
+
|
9
|
+
require 'benoit'
|
10
|
+
require 'gli'
|
11
|
+
|
12
|
+
include GLI::App
|
13
|
+
|
14
|
+
default_command :noop
|
15
|
+
|
16
|
+
program_desc 'Describe your application here'
|
17
|
+
|
18
|
+
version Benoit::VERSION
|
19
|
+
|
20
|
+
desc 'Make Benoit\'s output friendly for app communication'
|
21
|
+
switch [:"app-mode"]
|
22
|
+
|
23
|
+
desc 'Path to the site to build'
|
24
|
+
arg_name 'Input path'
|
25
|
+
flag [:i,:"input-path"]
|
26
|
+
|
27
|
+
desc 'Path to which to output the site'
|
28
|
+
arg_name 'Output path'
|
29
|
+
flag [:o,:"output-path"]
|
30
|
+
|
31
|
+
desc 'Path in which to store temporary files'
|
32
|
+
arg_name 'Temp cache path'
|
33
|
+
flag [:c,:"cache-path"]
|
34
|
+
|
35
|
+
desc 'Describe build here'
|
36
|
+
arg_name 'Describe arguments to build here'
|
37
|
+
command :build do |c|
|
38
|
+
c.desc 'Clean up (delete) any existing build files for this site before building'
|
39
|
+
c.switch :clean
|
40
|
+
|
41
|
+
c.desc 'Describe a flag to build'
|
42
|
+
c.default_value 'default'
|
43
|
+
c.flag :f
|
44
|
+
c.action do |global_options,options,args|
|
45
|
+
|
46
|
+
# Your command logic here
|
47
|
+
# benoit build --app-mode --input-path ~/Sites/static.ly --output-path ../test\ site/tmp-output --cache-path ../test\ site/tmp-cache
|
48
|
+
|
49
|
+
site_path = global_options[:"input-path"] || Dir.pwd
|
50
|
+
assetfile_path = File.join(File.expand_path("../../", __FILE__), "Assetfile")
|
51
|
+
Dir.chdir(site_path) do
|
52
|
+
Benoit.configure do |config|
|
53
|
+
config.clean_before_build = options[:clean]
|
54
|
+
end
|
55
|
+
project = Benoit::PipelineProject.new(assetfile_path, Benoit.config.output_path, Benoit.config.cache_path)
|
56
|
+
project.invoke
|
57
|
+
end
|
58
|
+
# If you have any errors, just raise them
|
59
|
+
# raise "that command made no sense"
|
60
|
+
|
61
|
+
puts "build command ran"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
desc 'Describe rebuild here'
|
66
|
+
arg_name 'Describe arguments to rebuild here'
|
67
|
+
command :rebuild do |c|
|
68
|
+
c.action do |global_options,options,args|
|
69
|
+
puts "rebuild command ran"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
command :noop do |c|
|
74
|
+
c.action do |global_options,options,args|
|
75
|
+
if global_options[:version]
|
76
|
+
puts Benoit::VERSION
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
pre do |global,command,options,args|
|
82
|
+
# Pre logic here
|
83
|
+
# Return true to proceed; false to abort and not call the
|
84
|
+
# chosen command
|
85
|
+
# Use skips_pre before a command to skip this block
|
86
|
+
# on that command only
|
87
|
+
Benoit.configure do |config|
|
88
|
+
config.site_path = global[:"input-path"] || Dir.pwd
|
89
|
+
site_name = File.basename(config.site_path)
|
90
|
+
config.output_path = global[:"output-path"] || default_output_path
|
91
|
+
config.cache_path = global[:"cache-path"] || default_cache_path(site_name)
|
92
|
+
if global[:"app-mode"]
|
93
|
+
config.output_mode = :app
|
94
|
+
else
|
95
|
+
config.output_mode = :user
|
96
|
+
end
|
97
|
+
end
|
98
|
+
true
|
99
|
+
end
|
100
|
+
|
101
|
+
def default_output_path
|
102
|
+
File.expand_path(File.join(Dir.pwd, "_build"))
|
103
|
+
end
|
104
|
+
|
105
|
+
def default_cache_path(site_name)
|
106
|
+
File.expand_path("~/.benoit/tmpcache/#{site_name}")
|
107
|
+
end
|
108
|
+
|
109
|
+
post do |global,command,options,args|
|
110
|
+
# Post logic here
|
111
|
+
# Use skips_post before a command to skip this
|
112
|
+
# block on that command only
|
113
|
+
end
|
114
|
+
|
115
|
+
on_error do |exception|
|
116
|
+
# Error logic here
|
117
|
+
# return false to skip default error handling
|
118
|
+
Benoit::Logger.report_error(exception)
|
119
|
+
end
|
120
|
+
|
121
|
+
exit run(ARGV)
|
@@ -0,0 +1 @@
|
|
1
|
+
bundle install --gemfile spec/Gemfile --binstubs=../.bundle/bin
|
data/bin/bundle-sandbox
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
bundle install --standalone=release --binstubs=.bundle/bin
|
data/lib/benoit.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
module Benoit
|
2
|
+
|
3
|
+
require "rake-pipeline-web-filters"
|
4
|
+
|
5
|
+
require_relative "./benoit/file_wrapper_extensions"
|
6
|
+
|
7
|
+
require_relative './benoit/configuration'
|
8
|
+
require_relative './benoit/logger'
|
9
|
+
require_relative './benoit/version'
|
10
|
+
require_relative "./benoit/site_context"
|
11
|
+
require_relative "./benoit/page"
|
12
|
+
require_relative "./benoit/pipeline_project"
|
13
|
+
require_relative "./benoit/compiler_error"
|
14
|
+
require_relative "./benoit/current_site"
|
15
|
+
require_relative "./benoit/cleaner"
|
16
|
+
|
17
|
+
|
18
|
+
require_relative "./benoit/cadenza"
|
19
|
+
|
20
|
+
require_relative "./benoit/filters"
|
21
|
+
require_relative "./benoit/pipeline"
|
22
|
+
|
23
|
+
|
24
|
+
require_relative "./benoit/page_metadata"
|
25
|
+
|
26
|
+
require_relative "./build_notifiers/file_built_notifier"
|
27
|
+
require_relative "./build_notifiers/progress_notifier"
|
28
|
+
|
29
|
+
|
30
|
+
require_relative "./benoit/utils/finds_layouts_for_template"
|
31
|
+
require_relative "./benoit/utils/normalizes_path_to_template"
|
32
|
+
require_relative "./benoit/utils/paginated_list"
|
33
|
+
|
34
|
+
extend Configuration
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
define_filter :format_like do |date,params|
|
2
|
+
date = Date.parse(date) unless date.respond_to? :stamp_like
|
3
|
+
date.stamp_like params[0]
|
4
|
+
end
|
5
|
+
|
6
|
+
define_filter :sort do |input,params|
|
7
|
+
field = params.first.to_sym
|
8
|
+
input.sort_by do |item|
|
9
|
+
::Cadenza::Context.lookup_on_object(field, item)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
define_filter :limit do |input,params|
|
14
|
+
length = params.first
|
15
|
+
|
16
|
+
if length > 0
|
17
|
+
input.take(length)
|
18
|
+
else
|
19
|
+
input.is_a?(Array) ? [] : ""
|
20
|
+
end
|
21
|
+
end
|