middleman-journal 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4f3f9fab1125aa632be10f920de866873d65ffa6179fcead198e733b4a603c1b
4
+ data.tar.gz: 7abcf5a50b3646124ee97ca5cf46ee91baa356a4e3f10adf1a8d62bf5973c291
5
+ SHA512:
6
+ metadata.gz: 93b9f718a3afbb9232467a470f3f48bb394b5ee66afd90c192120c46ff9aa8169dd1ca903525420da073f776c027f2d873ec4ef6b917574f91d21e2f5aeaab7a
7
+ data.tar.gz: d832a5bfbefdf211c1957b9a10ba96a43b00b44fe8d876c883e34351ae080dd3bdcbf3c8c3e1a2389b8b8fb748043df41dcf5db17150ea34af160cf3552cc2d2
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ # Ignore bundler lock file
2
+ /Gemfile.lock
3
+
4
+ # Ignore pkg folder
5
+ /pkg
6
+
7
+ *.gem
8
+ tags
data/Gemfile ADDED
@@ -0,0 +1,18 @@
1
+ # If you do not have OpenSSL installed, update
2
+ # the following line to use "http://" instead
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in middleman-journal.gemspec
6
+ gemspec
7
+
8
+ group :development do
9
+ gem 'rake'
10
+ gem 'rdoc'
11
+ gem 'yard'
12
+ end
13
+
14
+ group :test do
15
+ gem 'cucumber'
16
+ gem 'aruba'
17
+ gem 'rspec'
18
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Mauro Morales
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # middleman-journal
2
+
3
+ Middleman Journal Engine Extension
4
+
5
+ The `middleman-blog` extension does a bit too much for what I want from a
6
+ journal. At the same time it does a bit too little about how I'd like to
7
+ interact with my journal from the CLI. With this extension I try to solve those
8
+ problems in a simple way.
9
+
10
+
11
+ _Note: middleman-journal is still under early development. This means you should
12
+ not rely on the commands and functions provided atm, but it also means you can
13
+ help drive the project ;)_
14
+
15
+ ## Installation
16
+
17
+ Add it to your `Gemfile`
18
+
19
+ ```
20
+ gem 'middleman-journal'
21
+ ```
22
+
23
+ ## CLI commands
24
+
25
+ Create a new journal entry for today:
26
+
27
+ ```
28
+ middleman entry
29
+ ```
data/Rakefile ADDED
@@ -0,0 +1,25 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'cucumber/rake/task'
5
+
6
+ require 'middleman-core'
7
+
8
+ Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t|
9
+ t.cucumber_opts = '--color --tags not @wip --strict'
10
+ end
11
+
12
+ require 'rake/clean'
13
+
14
+ task test: [ :spec ]
15
+
16
+ require 'rspec/core/rake_task'
17
+
18
+ desc "Run RSpec"
19
+
20
+ RSpec::Core::RakeTask.new do | spec |
21
+ spec.pattern = 'spec/**/*_spec.rb'
22
+ spec.rspec_opts = [ '--color', '--format documentation' ]
23
+ end
24
+
25
+ task default: :test
@@ -0,0 +1,4 @@
1
+ PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
2
+ require 'middleman-core'
3
+ require 'middleman-core/step_definitions'
4
+ require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-journal')
@@ -0,0 +1,61 @@
1
+ require 'middleman-core/cli'
2
+ require 'date'
3
+
4
+ module Middleman
5
+
6
+ module Cli
7
+
8
+ ##
9
+ # This class provides an "entry" command for the middleman CLI.
10
+ #
11
+ # @usage bundle exec middleman entry --help
12
+ # @usage bundle exec middleman entry
13
+ #
14
+ ##
15
+ class Entry < ::Thor::Group
16
+
17
+ include Thor::Actions
18
+
19
+ check_unknown_options!
20
+
21
+ # Template files are relative to this file
22
+ # @return [String]
23
+ def self.source_root
24
+ File.dirname( __FILE__ )
25
+ end
26
+
27
+ def entry
28
+
29
+ @date = Time.now
30
+ @title = @date.strftime('%F')
31
+ @slug = @date.strftime('%F')
32
+
33
+ app = ::Middleman::Application.new do
34
+ config[ :mode ] = :config
35
+ config[ :disable_sitemap ] = true
36
+ config[ :watcher_disable ] = true
37
+ config[ :exit_before_ready ] = true
38
+ end
39
+
40
+ absolute_entry_path = File.join(app.source_dir, 'journal', "#{@title}.html.markdown")
41
+
42
+ if File.exists?(absolute_entry_path)
43
+ throw "An entry for #{@title} already exists: #{absolute_entry_path}"
44
+ end
45
+
46
+ entry_template = File.expand_path('entry.tt', File.dirname(__FILE__))
47
+
48
+ template entry_template, absolute_entry_path
49
+
50
+ end
51
+
52
+ protected
53
+
54
+ # Add to CLI
55
+ Base.register( self, 'entry', 'entry', 'Add a new entry to the journal' )
56
+
57
+ end
58
+
59
+ end
60
+
61
+ end
@@ -0,0 +1,7 @@
1
+ ---
2
+
3
+ title: <%= @title %>
4
+ date: <%= @date.strftime('%F') %>
5
+
6
+ ---
7
+
@@ -0,0 +1,9 @@
1
+ require 'date'
2
+
3
+ class JournalExtension < Middleman::Extension
4
+ option :date, Date.today.to_s, 'Unique ID for journal entry'
5
+
6
+ def initialize(app, options_hash={}, &block)
7
+ super
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ module Middleman
2
+
3
+ module Journal
4
+ VERSION = '0.0.1'
5
+ end
6
+
7
+ end
@@ -0,0 +1,9 @@
1
+ require "middleman-core"
2
+ require "middleman-journal/version"
3
+ require "middleman-journal/extension"
4
+ require "middleman-journal/commands/entry"
5
+
6
+ Middleman::Extensions.register :journal do
7
+
8
+ JournalExtension
9
+ end
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "middleman-journal/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "middleman-journal"
7
+ s.version = Middleman::Journal::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ['Mauro Morales']
10
+ s.email = ["mauro@mrls.xyz"]
11
+ s.homepage = "http://github.com/mrls/middleman-journal"
12
+ s.summary = %q{Middleman Journal Engine Extension}
13
+ s.description = %q{Middleman Journal Engine Extension}
14
+ s.license = "MIT"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+ s.required_ruby_version = '>= 2.0.0'
21
+
22
+ # The version of middleman-core your extension depends on
23
+ s.add_runtime_dependency("middleman-core", [">= 4.2.1"])
24
+
25
+ # Additional dependencies
26
+ # s.add_runtime_dependency("gem-name", "gem-version")
27
+ end
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: middleman-journal
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Mauro Morales
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-02-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: middleman-core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 4.2.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 4.2.1
27
+ description: Middleman Journal Engine Extension
28
+ email:
29
+ - mauro@mrls.xyz
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".gitignore"
35
+ - Gemfile
36
+ - LICENSE
37
+ - README.md
38
+ - Rakefile
39
+ - features/support/env.rb
40
+ - lib/middleman-journal.rb
41
+ - lib/middleman-journal/commands/entry.rb
42
+ - lib/middleman-journal/commands/entry.tt
43
+ - lib/middleman-journal/extension.rb
44
+ - lib/middleman-journal/version.rb
45
+ - middleman-journal.gemspec
46
+ homepage: http://github.com/mrls/middleman-journal
47
+ licenses:
48
+ - MIT
49
+ metadata: {}
50
+ post_install_message:
51
+ rdoc_options: []
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: 2.0.0
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ requirements: []
65
+ rubyforge_project:
66
+ rubygems_version: 2.7.3
67
+ signing_key:
68
+ specification_version: 4
69
+ summary: Middleman Journal Engine Extension
70
+ test_files: []