juli 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +26 -0
  3. data/CODE_OF_CONDUCT.md +13 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.rdoc +39 -0
  7. data/Rakefile +89 -0
  8. data/bin/console +14 -0
  9. data/bin/je +73 -0
  10. data/bin/juli +82 -0
  11. data/bin/juli_tb.rb +76 -0
  12. data/bin/setup +7 -0
  13. data/juli.gemspec +29 -0
  14. data/lib/juli.rb +21 -0
  15. data/lib/juli/absyn.rb +206 -0
  16. data/lib/juli/command.rb +180 -0
  17. data/lib/juli/command/file_entry.rb +12 -0
  18. data/lib/juli/command/recent_update.rb +52 -0
  19. data/lib/juli/command/sitemap.rb +55 -0
  20. data/lib/juli/command/tag.rb +81 -0
  21. data/lib/juli/line_parser.y +212 -0
  22. data/lib/juli/macro.rb +39 -0
  23. data/lib/juli/macro/amazon.rb +33 -0
  24. data/lib/juli/macro/jmap.rb +38 -0
  25. data/lib/juli/macro/photo.rb +161 -0
  26. data/lib/juli/macro/tag.rb +136 -0
  27. data/lib/juli/macro/template.rb +37 -0
  28. data/lib/juli/macro/template_base.rb +44 -0
  29. data/lib/juli/macro/wikipedia.rb +19 -0
  30. data/lib/juli/parser.y +360 -0
  31. data/lib/juli/template/default.html +64 -0
  32. data/lib/juli/template/facebook.html +82 -0
  33. data/lib/juli/template/je-bash-complete +42 -0
  34. data/lib/juli/template/juli.css +173 -0
  35. data/lib/juli/template/juli.js +87 -0
  36. data/lib/juli/template/locale/en.yml +10 -0
  37. data/lib/juli/template/locale/ja.yml +10 -0
  38. data/lib/juli/template/prototype.js +4320 -0
  39. data/lib/juli/template/simple.html +45 -0
  40. data/lib/juli/template/sitemap.html +78 -0
  41. data/lib/juli/template/sitemap_order_by_mtime_DESC.html +78 -0
  42. data/lib/juli/template/slidy.html +126 -0
  43. data/lib/juli/template/sourceforge.html +71 -0
  44. data/lib/juli/template/takahashi_method.html +116 -0
  45. data/lib/juli/util.rb +255 -0
  46. data/lib/juli/util/juli_i18n.rb +32 -0
  47. data/lib/juli/version.rb +3 -0
  48. data/lib/juli/visitor.rb +12 -0
  49. data/lib/juli/visitor/html.rb +462 -0
  50. data/lib/juli/visitor/html/helper.rb +97 -0
  51. data/lib/juli/visitor/html/helper/contents.rb +76 -0
  52. data/lib/juli/visitor/html/helper/fb_comments.rb +68 -0
  53. data/lib/juli/visitor/html/helper/fb_like.rb +37 -0
  54. data/lib/juli/visitor/html/tag_helper.rb +40 -0
  55. data/lib/juli/visitor/slidy.rb +39 -0
  56. data/lib/juli/visitor/takahashi_method.rb +41 -0
  57. data/lib/juli/visitor/tree.rb +135 -0
  58. data/lib/juli/wiki.rb +52 -0
  59. data/sample/protected_photo/2012-04-22/DCIM/101_PANA/P1010441.JPG +0 -0
  60. data/sample/update_public_juli.rb +71 -0
  61. data/setup.rb +1585 -0
  62. metadata +211 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c07761a500166a6eebb2e082600dbc97d2687d1d
4
+ data.tar.gz: fa6bb4a9b3af8b9db0d0cab95659816a73c485b2
5
+ SHA512:
6
+ metadata.gz: 7f520f40af1f9876a55df21fe1aebb1ef1b8fc8d25f6877eb899e0e35297603a99184c9a84f2ff7d5449273ff1a65ce4b4972cafa45416da8010d2b5bfd98b87
7
+ data.tar.gz: 298e3aebca19c9b846081a8850761f3cea35a6db1c604409c14368860fbe018a59482d4706ed6cad84460961ba05d271edcda2ed9da0c6bcd3d5f436b82f5438
data/.gitignore ADDED
@@ -0,0 +1,26 @@
1
+ *~
2
+ /lib/juli/parser.tab.rb
3
+ /lib/juli/line_parser.tab.rb
4
+ /bin/juli.rb
5
+ /doc/app
6
+ /test/html
7
+ /test/html_for_test
8
+ /doc_html/
9
+ /coverage/
10
+ /parser.output
11
+
12
+ # tag DB
13
+ /doc/.juli/*.sdbm.*
14
+ /test/repo/.juli/*.sdbm.*
15
+ /test/repo2/.juli/*.sdbm.*
16
+
17
+ # by bundle
18
+ /.bundle/
19
+ /.yardoc
20
+ /Gemfile.lock
21
+ /_yardoc/
22
+ /coverage/
23
+ /doc/
24
+ /pkg/
25
+ /spec/reports/
26
+ /tmp/
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in juli.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 ido
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,39 @@
1
+ == Juli
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/juli`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'juli'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install juli
22
+
23
+ == Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ == Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ 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` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ == Contributing
34
+
35
+ 1. Fork it ( https://github.com/[my-github-username]/juli/fork )
36
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
37
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
38
+ 4. Push to the branch (`git push origin my-new-feature`)
39
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,89 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ $LOAD_PATH.insert(0, File.join(File.dirname(__FILE__), 'lib'))
4
+
5
+ require 'rake'
6
+ require 'rake/testtask'
7
+ gem 'rdoc', '~> 4.2'
8
+ require 'rdoc/task'
9
+ require 'juli'
10
+ require 'racc'
11
+
12
+ juli_parser_rb = 'lib/juli/parser.tab.rb'
13
+ juli_line_parser_rb = 'lib/juli/line_parser.tab.rb'
14
+ parsers = [juli_parser_rb, juli_line_parser_rb]
15
+ test_conf_outout_top = 'test/html'
16
+
17
+ task :default => parsers
18
+
19
+ file juli_parser_rb => 'lib/juli/parser.y' do |t|
20
+ sh "racc -v -g #{t.prerequisites[0]}"
21
+ end
22
+
23
+ file juli_line_parser_rb => 'lib/juli/line_parser.y' do |t|
24
+ sh "racc #{t.prerequisites[0]}"
25
+ end
26
+
27
+ Rake::TestTask.new('test' => parsers) do |t|
28
+ t.libs << 'test'
29
+ t.pattern = 'test/**/*_test.rb'
30
+ t.verbose = true
31
+ end
32
+
33
+ desc "build package from HEAD with version #{Juli::VERSION}"
34
+ task :dist do
35
+ pkg_name = "juli-#{Juli::VERSION}"
36
+ work_prefix = "/tmp/#{pkg_name}"
37
+ sh "git archive --format=tar --prefix=#{pkg_name}/ HEAD | gzip >#{work_prefix}.tgz"
38
+
39
+ # include racc geneerated files
40
+ FileUtils.mkdir_p work_prefix
41
+ Dir.chdir work_prefix do
42
+ sh "tar zxvf #{work_prefix}.tgz"
43
+ Dir.chdir pkg_name do
44
+ sh 'rake'
45
+ end
46
+ sh "tar zcvf #{work_prefix}.tgz #{pkg_name}"
47
+ end
48
+ FileUtils.rm_rf work_prefix
49
+ end
50
+
51
+
52
+ namespace :doc do
53
+ desc 'generate HTML by juli'
54
+ task :juli do
55
+ sh <<-EOSH
56
+ (cd doc; ../bin/juli; ../bin/juli sitemap; ../bin/juli recent_update)
57
+ (cd doc; ../bin/juli gen -g slidy -t slidy.html slidy.txt)
58
+ (cd doc; ../bin/juli gen -g takahashi_method -t takahashi_method.html -o ../doc_html/slidy_takahashi_method_version.shtml slidy.txt)
59
+ EOSH
60
+ end
61
+
62
+ desc 'update project doc to SourceForge site'
63
+ task :up => :juli do
64
+ sh <<-EOSH
65
+ cd doc_html/
66
+ find . -type f -exec chmod o+r {} \\;
67
+ find . -type d -exec chmod o+x {} \\;
68
+ rsync -avP --delete -e ssh . fwells00,jjjuli@web.sourceforge.net:htdocs/
69
+ EOSH
70
+ end
71
+
72
+ RDoc::Task.new('app') do |t|
73
+ t.rdoc_dir = 'doc/app'
74
+ t.title = 'juli API'
75
+ t.options << '--line-numbers' << '--inline-source' <<
76
+ '--charset' << 'utf-8'
77
+ t.rdoc_files.include('doc/README_FOR_API')
78
+ t.rdoc_files.include('lib/**/*.rb')
79
+ t.rdoc_files.include('bin/juli')
80
+ end
81
+ end
82
+
83
+ desc 'clean working files'
84
+ task :clean => ['doc:clobber_app', :'test:coverage:clobber_juli'] do
85
+ sh "find . -name '*~' -exec rm {} \\;"
86
+ sh 'rm', '-rf', *[parsers, test_conf_outout_top,
87
+ 'InstalledFiles', '.config', # setup.rb generated
88
+ 'doc/html'].flatten
89
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "juli"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/je ADDED
@@ -0,0 +1,73 @@
1
+ #!/bin/sh
2
+ #
3
+ # = NAME
4
+ # je - edit wikipage and run juli(1)
5
+ #
6
+ # = SYNOPSIS
7
+ # je wikiname
8
+ #
9
+ # = DESCRIPTION
10
+ # Please read html/je(1).html generated by
11
+ # juli(1) from doc/je(1).txt for the detail.
12
+
13
+ #-----------------------------------------------------------------
14
+ # Subroutines
15
+ #-----------------------------------------------------------------
16
+ usage(){
17
+ echo "USAGE: je wikiname"
18
+ exit 2
19
+ }
20
+
21
+ # check if $1 environment variable is set.
22
+ check_env(){
23
+ value=`eval echo $"$1"`
24
+ if [ "X$value" = "X" ]; then
25
+ echo "ERROR: environment variable '$1' is not set."
26
+ exit 2
27
+ fi
28
+ }
29
+
30
+ run_juli(){
31
+ if [ "X$JULI" = "X" ]; then
32
+ juli $*
33
+ else
34
+ # for debug purpose
35
+ ruby $JULI $*
36
+ fi
37
+ }
38
+
39
+ #-----------------------------------------------------------------
40
+ # Main
41
+ #-----------------------------------------------------------------
42
+ LOGFILE='/tmp/juli_je.log'
43
+ wikiname=$1
44
+ check_env 'JULI_REPO'
45
+ check_env 'EDITOR'
46
+ if [ "X$wikiname" = "X" ]; then
47
+ usage
48
+ fi
49
+
50
+ cd $JULI_REPO
51
+ test -f "$wikiname.txt"
52
+ new_file=$?
53
+ $EDITOR "$wikiname.txt"
54
+ git add "$wikiname.txt"
55
+ git commit -v "$wikiname.txt"
56
+
57
+ juli_opts=''
58
+ if [ $new_file -eq 1 ]; then
59
+ echo
60
+ echo "Re-generate other pages also since new page is added."
61
+ echo "This will run in background because it may take long time."
62
+ echo "See $LOGFILE later for the result."
63
+ (
64
+ date; echo "-- begin background task"
65
+ run_juli gen -f
66
+ run_juli sitemap
67
+ run_juli recent_update
68
+ date; echo "-- end background"; echo
69
+ ) >>$LOGFILE 2>&1 &
70
+ else
71
+ run_juli
72
+ run_juli recent_update
73
+ fi
data/bin/juli ADDED
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # = NAME
4
+ # juli - Personal outline processor and wiki
5
+ #
6
+ # = SYNOPSIS
7
+ # juli [options] [files]
8
+ #
9
+ # = DESCRIPTION
10
+ # see doc/juli.txt for more detail.
11
+
12
+ $LOAD_PATH.insert(0, File.join(File.dirname(__FILE__), '../lib'))
13
+
14
+ require 'erb'
15
+ require 'fileutils'
16
+ require 'optparse'
17
+ require 'juli/command'
18
+
19
+
20
+ #------------------------------------------------------------------
21
+ # Global variable
22
+ #------------------------------------------------------------------
23
+ Version = Juli::VERSION
24
+
25
+
26
+ #------------------------------------------------------------------
27
+ # Subroutine Part
28
+ #------------------------------------------------------------------
29
+
30
+
31
+ #------------------------------------------------------------------
32
+ # Main
33
+ #------------------------------------------------------------------
34
+ Juli.init
35
+
36
+ include Juli::Util
37
+ include Juli::Command
38
+
39
+ command = 'gen'
40
+
41
+ # parse common & default options
42
+ parser = OptionParser.new(usage)
43
+
44
+ subparsers = Hash.new{|h,k|
45
+ $stderr.puts "no such juli command: #{k}"
46
+ exit 1
47
+ }
48
+
49
+ # set 'gen' options
50
+ s = subparsers['gen'] = OptionParser.new
51
+ GEN_OPTS = { # default option values for 'gen'
52
+ :g=>'html',
53
+ }
54
+ s.on('-g generator', visitor_list.join(',')) {|v| GEN_OPTS[:g] = v}
55
+ s.on('-f') {|v| GEN_OPTS[:f] = true}
56
+ s.on('-t template') {|v| GEN_OPTS[:t] = v}
57
+ s.on('-o output_path') {|v| GEN_OPTS[:o] = v}
58
+ opts = GEN_OPTS
59
+
60
+ # set 'init' options
61
+ s = subparsers['init'] = OptionParser.new
62
+ INIT_OPTS = { # default option values for 'init'
63
+ :o=>'../html/',
64
+ :t=>'default.html',
65
+ :e=>'.shtml'
66
+ }
67
+ s.on('-o output_top') {|v| INIT_OPTS[:o] = v}
68
+ s.on('-t template') {|v| INIT_OPTS[:t] = v}
69
+ s.on('-e extention') {|v| INIT_OPTS[:e] = v}
70
+
71
+ parser.order!(ARGV)
72
+
73
+ # check command
74
+ command = ARGV.shift if !ARGV.empty?
75
+
76
+ # switch opts
77
+ opts = INIT_OPTS if command == 'init'
78
+
79
+ # parse command options
80
+ subparsers[command].parse!(ARGV) if !ARGV.empty?
81
+
82
+ Juli::Command::run(command, opts)
data/bin/juli_tb.rb ADDED
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # = NAME
4
+ # juil_tb.rb - track back to external site
5
+ #
6
+ # = SYNOPSIS
7
+ # juli_tb.rb trackback-url juli-url [title [exerpt [blog_name]]]
8
+ #
9
+ # = DESCRIPTION
10
+ # Send 'trackback ping' to the requesting trackback-url.
11
+ # Response XML body, which is sent back from the target trackback,
12
+ # is printed to stdout. If the value in <error>...</error>
13
+ # is 0 then it means successful.
14
+
15
+ $LOAD_PATH.insert(0, File.join(File.dirname(__FILE__), '../lib'))
16
+
17
+ require 'optparse'
18
+ require 'cgi'
19
+ require 'net/http'
20
+ require 'juli'
21
+
22
+
23
+ #------------------------------------------------------------------
24
+ # Global variable
25
+ #------------------------------------------------------------------
26
+ Version = Juli::VERSION
27
+ USAGE = "USAGE: juli_tb.rb trackback-url juli-url [title [exerpt [blog_name]]]"
28
+
29
+
30
+ Net::HTTP.version_1_2
31
+
32
+ #------------------------------------------------------------------
33
+ # Subroutines
34
+ #------------------------------------------------------------------
35
+ # print usage and exit with errno==2
36
+ def usage(msg)
37
+ STDERR.printf("%s\n\n%s\n", msg, USAGE)
38
+ exit(2)
39
+ end
40
+
41
+ # check required arg and return if exists
42
+ def check_arg(arg, msg)
43
+ usage(msg) if !arg
44
+ arg
45
+ end
46
+
47
+ # generate url-encoded from hash. skip if value is nil
48
+ def to_query(hash)
49
+ a = []
50
+ for k, v in hash do
51
+ a << "#{k}=#{CGI.escape(v)}" if v
52
+ end
53
+ a.join('&')
54
+ end
55
+
56
+
57
+ #-------------------------------------------------------------------
58
+ # Main
59
+ #-------------------------------------------------------------------
60
+ opt = OptionParser.new(USAGE)
61
+ opt.parse!(ARGV)
62
+
63
+ tb_url = check_arg(ARGV[0], 'no trackback-url')
64
+ juli_url = check_arg(ARGV[1], 'no juli-url')
65
+ form = to_query(
66
+ 'url' => juli_url,
67
+ 'title' => ARGV[2],
68
+ 'exerpt' => ARGV[3],
69
+ 'blog_name' => ARGV[4])
70
+ usage('too much arguments') if ARGV[5]
71
+
72
+ uri = URI.parse(tb_url)
73
+ Net::HTTP.start(uri.host, uri.port) do |http|
74
+ res = http.post(uri.path, form)
75
+ print res.body.to_s
76
+ end