ydoc 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +70 -0
- data/README.md +93 -0
- data/README.rdoc +6 -0
- data/Rakefile +44 -0
- data/appcom-ydoc-ruby.gemspec +23 -0
- data/appcom-ydoc-ruby.rdoc +5 -0
- data/bin/ydoc +124 -0
- data/features/appcom-ydoc-ruby.feature +8 -0
- data/features/step_definitions/appcom-ydoc-ruby_steps.rb +6 -0
- data/features/support/env.rb +15 -0
- data/lib/appcom-ydoc-ruby.rb +22 -0
- data/lib/appcom-ydoc-ruby/config.rb +13 -0
- data/lib/appcom-ydoc-ruby/email/email_builder.rb +58 -0
- data/lib/appcom-ydoc-ruby/email/templates/attachment.erb +6 -0
- data/lib/appcom-ydoc-ruby/email/templates/body.erb +6 -0
- data/lib/appcom-ydoc-ruby/email/templates/header.erb +6 -0
- data/lib/appcom-ydoc-ruby/html/html_builder.rb +51 -0
- data/lib/appcom-ydoc-ruby/html/templates/default.html +77 -0
- data/lib/appcom-ydoc-ruby/html/templates/styles.css +1052 -0
- data/lib/appcom-ydoc-ruby/markdown/markdown_builder.rb +33 -0
- data/lib/appcom-ydoc-ruby/markdown/templates/document.erb +35 -0
- data/lib/appcom-ydoc-ruby/version.rb +3 -0
- data/lib/appcom-ydoc-ruby/yaml/templates/empty.erb +17 -0
- data/lib/appcom-ydoc-ruby/yaml/yaml_builder.rb +37 -0
- data/test/default_test.rb +14 -0
- data/test/test_helper.rb +9 -0
- metadata +135 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ed93e1a02c24db6c062f1476f3ef79c5cc561c74
|
4
|
+
data.tar.gz: 4ed7233b5d37caf3ed5f41cbc872cc3aa0a6f255
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7997b292ad538335634dbedb0b5015e461b1494256ac5944892c6ca0c9901087b442e1fea86a7277b17a90b9bb509c058315b292fbe38a4c02545eb67f587cae
|
7
|
+
data.tar.gz: 84b0635ab7bf9258433ed4ee72ecc7719930521ae26bfd250e9df94d9798da826b7c4f62905c511061ff3066330ef6612d5876e4e0b87948290d3cc3c051212b
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
ydoc (0.4.0)
|
5
|
+
gli (= 2.14.0)
|
6
|
+
|
7
|
+
PATH
|
8
|
+
remote: /Users/s.neidig/Projects/Ruby/ruyml
|
9
|
+
specs:
|
10
|
+
ruyml (1.0.0)
|
11
|
+
|
12
|
+
GEM
|
13
|
+
remote: https://rubygems.org/
|
14
|
+
specs:
|
15
|
+
aruba (0.14.2)
|
16
|
+
childprocess (~> 0.5.6)
|
17
|
+
contracts (~> 0.9)
|
18
|
+
cucumber (>= 1.3.19)
|
19
|
+
ffi (~> 1.9.10)
|
20
|
+
rspec-expectations (>= 2.99)
|
21
|
+
thor (~> 0.19)
|
22
|
+
builder (3.2.2)
|
23
|
+
childprocess (0.5.9)
|
24
|
+
ffi (~> 1.0, >= 1.0.11)
|
25
|
+
contracts (0.14.0)
|
26
|
+
cucumber (2.4.0)
|
27
|
+
builder (>= 2.1.2)
|
28
|
+
cucumber-core (~> 1.5.0)
|
29
|
+
cucumber-wire (~> 0.0.1)
|
30
|
+
diff-lcs (>= 1.1.3)
|
31
|
+
gherkin (~> 4.0)
|
32
|
+
multi_json (>= 1.7.5, < 2.0)
|
33
|
+
multi_test (>= 0.1.2)
|
34
|
+
cucumber-core (1.5.0)
|
35
|
+
gherkin (~> 4.0)
|
36
|
+
cucumber-wire (0.0.1)
|
37
|
+
diff-lcs (1.2.5)
|
38
|
+
ffi (1.9.14)
|
39
|
+
gherkin (4.0.0)
|
40
|
+
gli (2.14.0)
|
41
|
+
mail (2.6.4)
|
42
|
+
mime-types (>= 1.16, < 4)
|
43
|
+
map (6.6.0)
|
44
|
+
mime-types (3.1)
|
45
|
+
mime-types-data (~> 3.2015)
|
46
|
+
mime-types-data (3.2016.0521)
|
47
|
+
multi_json (1.12.1)
|
48
|
+
multi_test (0.1.2)
|
49
|
+
rake (11.3.0)
|
50
|
+
rdoc (5.0.0)
|
51
|
+
rspec-expectations (3.5.0)
|
52
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
53
|
+
rspec-support (~> 3.5.0)
|
54
|
+
rspec-support (3.5.0)
|
55
|
+
thor (0.19.4)
|
56
|
+
|
57
|
+
PLATFORMS
|
58
|
+
ruby
|
59
|
+
|
60
|
+
DEPENDENCIES
|
61
|
+
aruba
|
62
|
+
mail
|
63
|
+
map
|
64
|
+
rake
|
65
|
+
rdoc
|
66
|
+
ruyml!
|
67
|
+
ydoc!
|
68
|
+
|
69
|
+
BUNDLED WITH
|
70
|
+
1.13.6
|
data/README.md
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
# YDoc
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
Add this line to your application's Gemfile:
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
gem 'ydoc'
|
9
|
+
```
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install ydoc
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
This gem provides the infrastructure to create, manage and send protocols, which are based on yaml files. Protocols
|
22
|
+
often follow the same scheme and require the same information. Hence we can use a templates based approach. In the
|
23
|
+
yaml file you declare basic information for a meeting. The yaml file can then be converted to html using pandoc as
|
24
|
+
middleware. So make sure pandoc is installed. Also you can send the protocol by email.
|
25
|
+
|
26
|
+
### Create
|
27
|
+
|
28
|
+
```
|
29
|
+
ydoc create
|
30
|
+
```
|
31
|
+
|
32
|
+
Generates a yaml template. You can provide additional information to fill the yaml file.
|
33
|
+
|
34
|
+
### Build
|
35
|
+
|
36
|
+
```
|
37
|
+
ydoc build %file_or_directory
|
38
|
+
```
|
39
|
+
|
40
|
+
Creates a html file based on yaml files. First argument is either a yaml file or a directory containing yaml files.
|
41
|
+
You can provide a config file serving additional information, which are used during pandoc conversion
|
42
|
+
|
43
|
+
{
|
44
|
+
"html": {
|
45
|
+
"toc": true,
|
46
|
+
"tocDepth": 1,
|
47
|
+
"selfContained": true,
|
48
|
+
"standAlone": true,
|
49
|
+
"numbered": true,
|
50
|
+
"version": "1.0.0"
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
### Send
|
55
|
+
|
56
|
+
```
|
57
|
+
ydoc send %file
|
58
|
+
```
|
59
|
+
|
60
|
+
Sends an email to the present people of the meeting containing the html report as attachment. You have to provide a
|
61
|
+
config file serving smtp information to send the email with. Here is an example file
|
62
|
+
|
63
|
+
{
|
64
|
+
"email": {
|
65
|
+
"address": "noreply@domain.com",
|
66
|
+
"port": 587,
|
67
|
+
"host": "smtp.gmail.com",
|
68
|
+
"username": "sender@gmail.com",
|
69
|
+
"password": "senderpassword"
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
### Help
|
74
|
+
|
75
|
+
```
|
76
|
+
ydoc help
|
77
|
+
```
|
78
|
+
|
79
|
+
## Development
|
80
|
+
|
81
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
82
|
+
|
83
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
84
|
+
|
85
|
+
## Contributing
|
86
|
+
|
87
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ydoc. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
88
|
+
|
89
|
+
|
90
|
+
## License
|
91
|
+
|
92
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
93
|
+
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'rake/clean'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rubygems/package_task'
|
4
|
+
require 'rdoc/task'
|
5
|
+
require 'cucumber'
|
6
|
+
require 'cucumber/rake/task'
|
7
|
+
Rake::RDocTask.new do |rd|
|
8
|
+
rd.main = "README.rdoc"
|
9
|
+
rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
|
10
|
+
rd.title = 'Your application title'
|
11
|
+
end
|
12
|
+
|
13
|
+
spec = eval(File.read('appcom-ydoc-ruby.gemspec'))
|
14
|
+
|
15
|
+
Gem::PackageTask.new(spec) do |pkg|
|
16
|
+
end
|
17
|
+
CUKE_RESULTS = 'results.html'
|
18
|
+
CLEAN << CUKE_RESULTS
|
19
|
+
desc 'Run features'
|
20
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
21
|
+
opts = "features --format html -o #{CUKE_RESULTS} --format progress -x"
|
22
|
+
opts += " --tags #{ENV['TAGS']}" if ENV['TAGS']
|
23
|
+
t.cucumber_opts = opts
|
24
|
+
t.fork = false
|
25
|
+
end
|
26
|
+
|
27
|
+
desc 'Run features tagged as work-in-progress (@wip)'
|
28
|
+
Cucumber::Rake::Task.new('features:wip') do |t|
|
29
|
+
tag_opts = ' --tags ~@pending'
|
30
|
+
tag_opts = ' --tags @wip'
|
31
|
+
t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty -x -s#{tag_opts}"
|
32
|
+
t.fork = false
|
33
|
+
end
|
34
|
+
|
35
|
+
task :cucumber => :features
|
36
|
+
task 'cucumber:wip' => 'features:wip'
|
37
|
+
task :wip => 'features:wip'
|
38
|
+
require 'rake/testtask'
|
39
|
+
Rake::TestTask.new do |t|
|
40
|
+
t.libs << "test"
|
41
|
+
t.test_files = FileList['test/*_test.rb']
|
42
|
+
end
|
43
|
+
|
44
|
+
task :default => [:test,:features]
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Ensure we require the local version and not one we might have installed already
|
2
|
+
require File.join([File.dirname(__FILE__),'lib','appcom-ydoc-ruby','version.rb'])
|
3
|
+
spec = Gem::Specification.new do |s|
|
4
|
+
s.name = 'ydoc'
|
5
|
+
s.version = AppcomYdocRuby::VERSION
|
6
|
+
s.author = 'Stefan Neidig'
|
7
|
+
s.email = 's.neidig@appcom-interactive.de'
|
8
|
+
s.homepage = 'http://appcom-interactive.de'
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
s.summary = 'A description of your project'
|
11
|
+
s.files = `git ls-files`.split("
|
12
|
+
")
|
13
|
+
s.require_paths << 'lib'
|
14
|
+
s.has_rdoc = true
|
15
|
+
s.extra_rdoc_files = ['README.rdoc','appcom-ydoc-ruby.rdoc']
|
16
|
+
s.rdoc_options << '--title' << 'appcom-ydoc-ruby' << '--main' << 'README.rdoc' << '-ri'
|
17
|
+
s.bindir = 'bin'
|
18
|
+
s.executables << 'ydoc'
|
19
|
+
s.add_development_dependency('rake')
|
20
|
+
s.add_development_dependency('rdoc')
|
21
|
+
s.add_development_dependency('aruba')
|
22
|
+
s.add_runtime_dependency('gli','2.14.0')
|
23
|
+
end
|
data/bin/ydoc
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'gli'
|
3
|
+
require 'map'
|
4
|
+
require 'yaml'
|
5
|
+
require 'appcom-ydoc-ruby'
|
6
|
+
|
7
|
+
include GLI::App
|
8
|
+
|
9
|
+
program_desc 'This is a CLI for creating and distributing meeting protocols'
|
10
|
+
|
11
|
+
version AppcomYdocRuby::VERSION
|
12
|
+
|
13
|
+
subcommand_option_handling :normal
|
14
|
+
arguments :strict
|
15
|
+
|
16
|
+
desc 'Create an empty yaml template'
|
17
|
+
arg_name ''
|
18
|
+
command :create do |c|
|
19
|
+
c.desc 'The title of the document to create'
|
20
|
+
c.flag [:t, :title]
|
21
|
+
|
22
|
+
c.desc 'The moderator of the meeting'
|
23
|
+
c.flag [:m, :moderator]
|
24
|
+
|
25
|
+
c.desc 'The recorder of the meeting'
|
26
|
+
c.flag [:r, :recorder]
|
27
|
+
|
28
|
+
c.desc 'The objective of the meeting'
|
29
|
+
c.flag [:o, :objective]
|
30
|
+
|
31
|
+
c.desc 'The summary of the meeting'
|
32
|
+
c.flag [:s, :summary]
|
33
|
+
|
34
|
+
c.desc 'The output filename for the generated file'
|
35
|
+
c.default_value '.'
|
36
|
+
c.flag [:d, :directory]
|
37
|
+
|
38
|
+
c.action do |global_options, options, args|
|
39
|
+
builder = YDoc::YamlBuilder.new
|
40
|
+
builder.create options[:d], options
|
41
|
+
|
42
|
+
puts "Created file under #{options[:d]}"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
desc 'Build html from yaml template'
|
47
|
+
arg_name 'Filename of the yaml template or a directory containing yaml files'
|
48
|
+
command :build do |c|
|
49
|
+
c.desc 'The output filename for the generated file'
|
50
|
+
c.default_value '.'
|
51
|
+
c.flag [:d, :directory]
|
52
|
+
|
53
|
+
c.desc 'A flag indicating that the table of contents is also added'
|
54
|
+
c.switch [:t, :toc]
|
55
|
+
|
56
|
+
c.desc 'A number indicating the maximum depth for the table of contents'
|
57
|
+
c.flag [:T, :tocDepth]
|
58
|
+
|
59
|
+
c.desc 'A flag indicating that the sections should be nubered automatically'
|
60
|
+
c.switch [:n, :numbered]
|
61
|
+
|
62
|
+
c.desc 'A flag indicating that the resulting page should be stand alone'
|
63
|
+
c.switch [:s, :standAlone]
|
64
|
+
|
65
|
+
c.desc 'A flag indicating that the resulting page should be self contained'
|
66
|
+
c.switch [:S, :selfContained]
|
67
|
+
|
68
|
+
c.desc 'A file path where a valid configuration file is located'
|
69
|
+
c.flag [:c, :config]
|
70
|
+
|
71
|
+
c.action do |global_options, options, args|
|
72
|
+
temp_directory = "temp_#{Date.new.to_time.to_i}"
|
73
|
+
FileUtils.mkdir_p(temp_directory)
|
74
|
+
|
75
|
+
YDoc::build_html(args[0], temp_directory, options[:d], options)
|
76
|
+
|
77
|
+
FileUtils.rm_rf(temp_directory)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
desc 'Sends a protocol by email. The yaml file is parsed and converted to html and sent to the recipients described in the yaml.'
|
82
|
+
arg_name 'Filename of the yaml template or a directory containing the yaml files, which should be sent'
|
83
|
+
command :send do |c|
|
84
|
+
c.desc 'A file path where a valid configuration file is located'
|
85
|
+
c.flag [:c, :config]
|
86
|
+
|
87
|
+
c.desc 'The subject of the email'
|
88
|
+
c.flag [:s, :subject]
|
89
|
+
|
90
|
+
c.desc 'The body of the email'
|
91
|
+
c.flag [:b, :body]
|
92
|
+
|
93
|
+
c.desc 'The body of the email as file. If present the --body options is ignored'
|
94
|
+
c.flag [:f, :filename]
|
95
|
+
|
96
|
+
c.action do |global_options, options, args|
|
97
|
+
if !args[0] || !args[0].end_with?('yaml')
|
98
|
+
puts 'The first parameter must be a path to a yaml file'
|
99
|
+
abort
|
100
|
+
end
|
101
|
+
|
102
|
+
temp_directory = "temp_#{Date.new.to_time.to_i}"
|
103
|
+
FileUtils.mkdir_p temp_directory
|
104
|
+
|
105
|
+
YDoc::build_html(args[0], temp_directory, temp_directory, options)
|
106
|
+
|
107
|
+
file = Dir["#{temp_directory}/*"].select { |f| f.end_with?('html') }[0]
|
108
|
+
body = options[:filename] ? File.read(options[:filename]) : options[:body]
|
109
|
+
to = Map[YAML.load_file(args[0])][:present].map { |present| present[:email] }.join(',')
|
110
|
+
|
111
|
+
email_builder = YDoc::EmailBuilder.new
|
112
|
+
email_builder.mail_to(to, options[:subject], body, file, options)
|
113
|
+
|
114
|
+
FileUtils.rm_rf temp_directory
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
on_error do |exception|
|
119
|
+
# Error logic here
|
120
|
+
# return false to skip default error handling
|
121
|
+
true
|
122
|
+
end
|
123
|
+
|
124
|
+
exit run(ARGV)
|
@@ -0,0 +1,8 @@
|
|
1
|
+
Feature: My bootstrapped app kinda works
|
2
|
+
In order to get going on coding my awesome app
|
3
|
+
I want to have aruba and cucumber setup
|
4
|
+
So I don't have to do it myself
|
5
|
+
|
6
|
+
Scenario: App just runs
|
7
|
+
When I get help for "appcom-ydoc-ruby"
|
8
|
+
Then the exit status should be 0
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'aruba/cucumber'
|
2
|
+
|
3
|
+
ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
|
4
|
+
LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
|
5
|
+
|
6
|
+
Before do
|
7
|
+
# Using "announce" causes massive warnings on 1.9.2
|
8
|
+
@puts = true
|
9
|
+
@original_rubylib = ENV['RUBYLIB']
|
10
|
+
ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
|
11
|
+
end
|
12
|
+
|
13
|
+
After do
|
14
|
+
ENV['RUBYLIB'] = @original_rubylib
|
15
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require_relative 'appcom-ydoc-ruby/version.rb'
|
2
|
+
require_relative 'appcom-ydoc-ruby/markdown/markdown_builder'
|
3
|
+
require_relative 'appcom-ydoc-ruby/html/html_builder'
|
4
|
+
require_relative 'appcom-ydoc-ruby/yaml/yaml_builder'
|
5
|
+
require_relative 'appcom-ydoc-ruby/email/email_builder'
|
6
|
+
|
7
|
+
# Add requires for other files you add to your project here, so
|
8
|
+
# you just need to require this one file in your bin file
|
9
|
+
|
10
|
+
module YDoc
|
11
|
+
|
12
|
+
def build_html input_directory, temp_directory, output_directory, options
|
13
|
+
markdown_builder = MarkdownBuilder.new
|
14
|
+
markdown_builder.to_markdown(input_directory, temp_directory)
|
15
|
+
|
16
|
+
html_builder = HtmlBuilder.new
|
17
|
+
html_builder.to_html(temp_directory, output_directory, options)
|
18
|
+
end
|
19
|
+
|
20
|
+
module_function :build_html
|
21
|
+
|
22
|
+
end
|