syclink 0.0.1
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 +2 -0
- data/.rspec +1 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +33 -0
- data/LICENSE +21 -0
- data/README.md +191 -0
- data/README.rdoc +9 -0
- data/Rakefile +5 -0
- data/bin/syclink +290 -0
- data/doc/Gemfile.html +109 -0
- data/doc/Gemfile_lock.html +147 -0
- data/doc/LICENSE.html +129 -0
- data/doc/Object.html +188 -0
- data/doc/README_md.html +322 -0
- data/doc/README_rdoc.html +171 -0
- data/doc/SycLink/Designer.html +560 -0
- data/doc/SycLink/Exporter.html +149 -0
- data/doc/SycLink/Formatter.html +416 -0
- data/doc/SycLink/Infrastructure.html +297 -0
- data/doc/SycLink/Link.html +296 -0
- data/doc/SycLink/Website.html +428 -0
- data/doc/SycLink.html +127 -0
- data/doc/created.rid +31 -0
- data/doc/css/fonts.css +167 -0
- data/doc/css/rdoc.css +590 -0
- data/doc/fonts/Lato-Light.ttf +0 -0
- data/doc/fonts/Lato-LightItalic.ttf +0 -0
- data/doc/fonts/Lato-Regular.ttf +0 -0
- data/doc/fonts/Lato-RegularItalic.ttf +0 -0
- data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
- data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
- data/doc/images/add.png +0 -0
- data/doc/images/arrow_up.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +131 -0
- data/doc/js/darkfish.js +161 -0
- data/doc/js/jquery.js +4 -0
- data/doc/js/navigation.js +142 -0
- data/doc/js/navigation.js.gz +0 -0
- data/doc/js/search.js +109 -0
- data/doc/js/search_index.js +1 -0
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js +228 -0
- data/doc/js/searcher.js.gz +0 -0
- data/doc/links_csv.html +113 -0
- data/doc/setup_md.html +192 -0
- data/doc/syclink_gemspec.html +133 -0
- data/doc/syclink_rdoc.html +154 -0
- data/doc/table_of_contents.html +336 -0
- data/doc/templates/example_html.html +399 -0
- data/doc/templates/links.html +116 -0
- data/doc/templates/stylesheets/style_css.html +170 -0
- data/doc/templates/stylesheets/style_css_map.html +111 -0
- data/doc/templates/stylesheets/style_css_scss.html +198 -0
- data/doc/templates/syc-link_html.html +235 -0
- data/lib/syclink/designer.rb +97 -0
- data/lib/syclink/designer_example.rb +9 -0
- data/lib/syclink/exporter.rb +17 -0
- data/lib/syclink/formatter.rb +70 -0
- data/lib/syclink/infrastructure.rb +44 -0
- data/lib/syclink/link.rb +62 -0
- data/lib/syclink/version.rb +7 -0
- data/lib/syclink/website.rb +62 -0
- data/lib/syclink/website_example.rb +68 -0
- data/lib/syclink.rb +7 -0
- data/setup.md +92 -0
- data/spec/syclink/designer_spec.rb +100 -0
- data/spec/syclink/link_spec.rb +47 -0
- data/spec/syclink/website_spec.rb +75 -0
- data/syclink.gemspec +23 -0
- data/syclink.rdoc +39 -0
- data/templates/links +4 -0
- data/templates/stylesheets/style.css +55 -0
- data/templates/stylesheets/style.css.map +7 -0
- data/templates/stylesheets/style.css.scss +76 -0
- data/templates/syc-link.html +123 -0
- data/templates/syclink.html.erb +63 -0
- metadata +193 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 42124dedde2e500e40f48c650c8a785f4b0cbf1b
|
|
4
|
+
data.tar.gz: a29891c66efb0c567db21fcbd5b2d555df36e282
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 1d3cfd10b1c918ff281e7cbe41c03ed1ce4856bf7427c4d09b40f137492be568327e763b3e0a168c99f13f8054147697547892f8c834c7f93495d23bad6b0b0b
|
|
7
|
+
data.tar.gz: 7d14080d1fb40568bd6c0c4e8f79b3ac4dcd6d0eb8ef327a595b2b25de45ef934b1a453b2ea7a9a7b1aab115ec3c4721541b9e40d078667feccd6773723350c8
|
data/.gitignore
ADDED
data/.rspec
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--color
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
syclink (0.0.1)
|
|
5
|
+
gli (= 2.13.1)
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
diff-lcs (1.2.5)
|
|
11
|
+
gli (2.13.1)
|
|
12
|
+
rspec (3.3.0)
|
|
13
|
+
rspec-core (~> 3.3.0)
|
|
14
|
+
rspec-expectations (~> 3.3.0)
|
|
15
|
+
rspec-mocks (~> 3.3.0)
|
|
16
|
+
rspec-core (3.3.1)
|
|
17
|
+
rspec-support (~> 3.3.0)
|
|
18
|
+
rspec-expectations (3.3.0)
|
|
19
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
20
|
+
rspec-support (~> 3.3.0)
|
|
21
|
+
rspec-mocks (3.3.1)
|
|
22
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
23
|
+
rspec-support (~> 3.3.0)
|
|
24
|
+
rspec-support (3.3.0)
|
|
25
|
+
sass (3.4.15)
|
|
26
|
+
|
|
27
|
+
PLATFORMS
|
|
28
|
+
ruby
|
|
29
|
+
|
|
30
|
+
DEPENDENCIES
|
|
31
|
+
rspec
|
|
32
|
+
sass
|
|
33
|
+
syclink!
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015 sugaryourcoffee
|
|
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.md
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
syclink
|
|
2
|
+
=======
|
|
3
|
+
_syclink_ is a comand line application to create a website with a link
|
|
4
|
+
collection. _syclink_ allows to add, update and delete links.
|
|
5
|
+
|
|
6
|
+
Installation
|
|
7
|
+
============
|
|
8
|
+
The application is installed with _RubyGems_
|
|
9
|
+
|
|
10
|
+
$ gem install syclink
|
|
11
|
+
|
|
12
|
+
Command Line Interface
|
|
13
|
+
======================
|
|
14
|
+
_syclink_ comes with a default website template and a CSS file. This can be
|
|
15
|
+
adjusted to your convenience.
|
|
16
|
+
|
|
17
|
+
Templates
|
|
18
|
+
---------
|
|
19
|
+
The templates are located in ~/.syc/syclink/templates and can be adjusted or
|
|
20
|
+
completely replaced.
|
|
21
|
+
|
|
22
|
+
Command Line
|
|
23
|
+
------------
|
|
24
|
+
Following list comprises the commands available
|
|
25
|
+
|
|
26
|
+
_Website commands_
|
|
27
|
+
* website show - show all websites or search for websites
|
|
28
|
+
* website remove - Remove website
|
|
29
|
+
* website create - Create a HTML representation of the website
|
|
30
|
+
|
|
31
|
+
_Link commands_
|
|
32
|
+
* add - Add a link
|
|
33
|
+
* file - Add links from a file
|
|
34
|
+
* update - Update a link
|
|
35
|
+
* delete - Delete a link
|
|
36
|
+
* list - List all links with an optional filter
|
|
37
|
+
* find - Find links based on a search string
|
|
38
|
+
|
|
39
|
+
Commands
|
|
40
|
+
========
|
|
41
|
+
Following the commands and how to use them is explained based on examples.
|
|
42
|
+
|
|
43
|
+
Create a website
|
|
44
|
+
----------------
|
|
45
|
+
A website is send to syclink with the global `-w` flag. If the website does not
|
|
46
|
+
exist yet the user is asked whether to create it and whether to set it as the
|
|
47
|
+
default website. This is done with commands that require a website to operate
|
|
48
|
+
on.
|
|
49
|
+
|
|
50
|
+
$ syclink -w my-new-website add "http://example.com"
|
|
51
|
+
|
|
52
|
+
Before the command `add` is executed the website is created. In this
|
|
53
|
+
case a website called 'my-new-website' is created in the default directory at
|
|
54
|
+
`~/.syc/syclink/websites/my-new-website.website
|
|
55
|
+
|
|
56
|
+
Commands that require a website are `add`, `update`, `delete`, `list`, `find`
|
|
57
|
+
and `website create`.
|
|
58
|
+
|
|
59
|
+
If no website is specified the default website is used.
|
|
60
|
+
|
|
61
|
+
Add a link
|
|
62
|
+
----------
|
|
63
|
+
A link may have a title, a description and a tag. Title, description and tag
|
|
64
|
+
are optional but a link obviously has to be provided. If no title is given the
|
|
65
|
+
link is used as the title.
|
|
66
|
+
|
|
67
|
+
$ syclink add --title "Test page" --tag TEST \
|
|
68
|
+
--description 'For testing purposes' http://example.com
|
|
69
|
+
|
|
70
|
+
It is also possible to add links from a file
|
|
71
|
+
|
|
72
|
+
$ syclink file file-with-links
|
|
73
|
+
|
|
74
|
+
Update a link
|
|
75
|
+
-------------
|
|
76
|
+
To update a link the URL has to be specified. If more than one link has the
|
|
77
|
+
same URL only the first link is updated.
|
|
78
|
+
|
|
79
|
+
$ syclink update --title "Example" http://example.com
|
|
80
|
+
|
|
81
|
+
Remove a Link
|
|
82
|
+
-------------
|
|
83
|
+
To remove one or more links the URLs have to be provided.
|
|
84
|
+
|
|
85
|
+
$ syclink delete http://example.com,http://challenge.com
|
|
86
|
+
|
|
87
|
+
List links
|
|
88
|
+
----------
|
|
89
|
+
Links can be selected based on a filter. If no filter is given all links are
|
|
90
|
+
listed. It is possible to specify the columns to print. Possible columns are
|
|
91
|
+
`url`, `name`, `description` and `tag`.
|
|
92
|
+
|
|
93
|
+
$ syclink list --tag TEST --columns 'url,description'
|
|
94
|
+
|
|
95
|
+
url | description
|
|
96
|
+
-------------------+---------------------
|
|
97
|
+
http://example.com | For testing purposes
|
|
98
|
+
|
|
99
|
+
Find links
|
|
100
|
+
----------
|
|
101
|
+
It is also possible to search for links based on a search string. The find
|
|
102
|
+
command searches all attributes of the links and is searching for the occurance
|
|
103
|
+
of the search string within the attributes. So the search is not list only
|
|
104
|
+
exact matches.
|
|
105
|
+
|
|
106
|
+
$ syclink find --columns 'url,tag' 'example'
|
|
107
|
+
|
|
108
|
+
url | tag
|
|
109
|
+
-------------------+-----
|
|
110
|
+
http://example.com | TEST
|
|
111
|
+
|
|
112
|
+
List websites
|
|
113
|
+
-------------
|
|
114
|
+
The websites are saved to `~/.syc/syclink/websites/` and the html
|
|
115
|
+
representations are saved to `~/.syc/syclink/html/`. When listing websites
|
|
116
|
+
both _webstites_ and _html_ files are listed.
|
|
117
|
+
|
|
118
|
+
The following command will list all websites
|
|
119
|
+
|
|
120
|
+
$ syclink website list
|
|
121
|
+
|
|
122
|
+
To list websites based on a search string the search string has to be send to
|
|
123
|
+
the list command
|
|
124
|
+
|
|
125
|
+
$ syclink website list "example"
|
|
126
|
+
|
|
127
|
+
If the `--exact` switch is given the command is only listing exact matches of
|
|
128
|
+
the search string
|
|
129
|
+
|
|
130
|
+
$ syclink website list -e "http://example.com"
|
|
131
|
+
|
|
132
|
+
Remove websites
|
|
133
|
+
---------------
|
|
134
|
+
Websites and their html representations can be deleted based on a filter string.
|
|
135
|
+
To delete all websites and respective html representation the filter string
|
|
136
|
+
'\*' can be provided
|
|
137
|
+
|
|
138
|
+
$ syclink website remove "*"
|
|
139
|
+
|
|
140
|
+
About to delete:
|
|
141
|
+
|
|
142
|
+
Websites
|
|
143
|
+
--------
|
|
144
|
+
/home/user/.syc/syclink/website/example.website
|
|
145
|
+
|
|
146
|
+
HTML-Files
|
|
147
|
+
----------
|
|
148
|
+
/home/user/.syc/syclink/html/example.html
|
|
149
|
+
|
|
150
|
+
Delete websites and corresponding html files (y/n)?
|
|
151
|
+
|
|
152
|
+
Other exmamples of filter strings are `*mple` which will find `example` as well
|
|
153
|
+
as `ex*`.
|
|
154
|
+
|
|
155
|
+
Make a html representation of the website
|
|
156
|
+
-----------------------------------------
|
|
157
|
+
The ultimate command is `website create` which will create the html
|
|
158
|
+
representation of the website.
|
|
159
|
+
|
|
160
|
+
The html file is created based on an erb file located in
|
|
161
|
+
`~/.syc/syclink/templates/syclink.html.erb`. This can be adjusted to your
|
|
162
|
+
convenience. The methods that can be used can be looked up in
|
|
163
|
+
`lib/syctask/website.rb`.
|
|
164
|
+
|
|
165
|
+
The html file will search for a css file in the directory `stylesheets` which
|
|
166
|
+
is relative to the html file. The stylesheet is named `styles.css`. It is
|
|
167
|
+
possible to change it or replace it entirely. If the stylesheet's name is
|
|
168
|
+
changed this also has to be done in `~/.syc/syclink/templates/syclink.html.erb`.
|
|
169
|
+
|
|
170
|
+
There is also a _scss_ file which needs to be compiled to _css_ with _sass_
|
|
171
|
+
like so
|
|
172
|
+
|
|
173
|
+
$ sass ~/.syc/syclink/html/stylesheets/styles.css.scss:\
|
|
174
|
+
~/.syc/syclink/html/stylesheets/styles.css
|
|
175
|
+
|
|
176
|
+
Warning: If the _css_ file has been changed all changes will be overridden by
|
|
177
|
+
_sass_.
|
|
178
|
+
|
|
179
|
+
Workflow
|
|
180
|
+
========
|
|
181
|
+
To create a website the steps are as follows
|
|
182
|
+
|
|
183
|
+
* add links to a website
|
|
184
|
+
* create the html representation
|
|
185
|
+
|
|
186
|
+
Following is showing the above sequence in commands
|
|
187
|
+
|
|
188
|
+
$ syclink -w example add "http://example.com" --tag EXAMPLE
|
|
189
|
+
$ syclink add "http://github.com" --tag DEVELOPMENT
|
|
190
|
+
$ syclink website create
|
|
191
|
+
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
data/bin/syclink
ADDED
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require 'gli'
|
|
3
|
+
begin # XXX: Remove this begin/rescue before distributing your app
|
|
4
|
+
require 'syclink'
|
|
5
|
+
rescue LoadError
|
|
6
|
+
STDERR.puts "In development, you need to use `bundle exec bin/syclink` to run your app"
|
|
7
|
+
STDERR.puts "At install-time, RubyGems will make sure lib, etc. are in the load path"
|
|
8
|
+
STDERR.puts "Feel free to remove this message from bin/syclink now"
|
|
9
|
+
exit 64
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
include GLI::App
|
|
13
|
+
include SycLink::Infrastructure
|
|
14
|
+
include SycLink::Formatter
|
|
15
|
+
|
|
16
|
+
# Commands that need to have a website and a designer object
|
|
17
|
+
WEBSITE_COMMANDS = [ :create, :add, :file, :update, :delete, :list, :find ]
|
|
18
|
+
|
|
19
|
+
# syclink's configuration directory
|
|
20
|
+
syclink_directory = File.expand_path("~/.syc/syclink")
|
|
21
|
+
# syclink's configuration file
|
|
22
|
+
syclink_file = File.join(syclink_directory, "syclink.rc")
|
|
23
|
+
# syclink's template directory
|
|
24
|
+
syclink_template_directory = File.join(syclink_directory, "templates/")
|
|
25
|
+
# syclink's html template"
|
|
26
|
+
syclink_html_template = File.join(syclink_template_directory,
|
|
27
|
+
"syclink.html.erb")
|
|
28
|
+
# syclink's website directory
|
|
29
|
+
syclink_website_directory = File.join(syclink_directory, "website/")
|
|
30
|
+
# syclink's html directory
|
|
31
|
+
syclink_html_directory = File.join(syclink_directory, "html/")
|
|
32
|
+
# syclink's stylesheet directory
|
|
33
|
+
syclink_stylesheets_directory = File.join(syclink_html_directory,
|
|
34
|
+
"stylesheets/")
|
|
35
|
+
|
|
36
|
+
create_directory_if_missing(syclink_directory)
|
|
37
|
+
|
|
38
|
+
create_directory_if_missing(syclink_template_directory)
|
|
39
|
+
copy_file_if_missing(File.join(File.dirname(__FILE__),
|
|
40
|
+
'../templates/syclink.html.erb'),
|
|
41
|
+
syclink_template_directory)
|
|
42
|
+
|
|
43
|
+
create_directory_if_missing(syclink_website_directory)
|
|
44
|
+
|
|
45
|
+
create_directory_if_missing(syclink_html_directory)
|
|
46
|
+
|
|
47
|
+
create_directory_if_missing(syclink_stylesheets_directory)
|
|
48
|
+
copy_file_if_missing(File.join(File.dirname(__FILE__),
|
|
49
|
+
'../templates/stylesheets/style.css'),
|
|
50
|
+
syclink_stylesheets_directory)
|
|
51
|
+
copy_file_if_missing(File.join(File.dirname(__FILE__),
|
|
52
|
+
'../templates/stylesheets/style.css.scss'),
|
|
53
|
+
syclink_stylesheets_directory)
|
|
54
|
+
|
|
55
|
+
config = load_config(syclink_file)
|
|
56
|
+
|
|
57
|
+
program_desc 'Create a link list and display it as an html page'
|
|
58
|
+
|
|
59
|
+
version SycLink::VERSION
|
|
60
|
+
|
|
61
|
+
subcommand_option_handling :normal
|
|
62
|
+
arguments :strict
|
|
63
|
+
|
|
64
|
+
desc 'Website to operate on'
|
|
65
|
+
arg_name 'WEBSITE'
|
|
66
|
+
flag [:w,:website]
|
|
67
|
+
|
|
68
|
+
desc 'Add a link to the website'
|
|
69
|
+
arg_name 'URL'
|
|
70
|
+
command :add do |c|
|
|
71
|
+
|
|
72
|
+
c.desc 'Name of the link'
|
|
73
|
+
c.arg_name 'NAME'
|
|
74
|
+
c.flag [:n, :name]
|
|
75
|
+
|
|
76
|
+
c.desc 'Description of the link'
|
|
77
|
+
c.arg_name 'DESCRIPTION'
|
|
78
|
+
c.flag [:d, :description]
|
|
79
|
+
|
|
80
|
+
c.desc 'Tag the link is associated to'
|
|
81
|
+
c.arg_name 'TAG'
|
|
82
|
+
c.flag [:t, :tag]
|
|
83
|
+
|
|
84
|
+
c.action do |global_options,options,args|
|
|
85
|
+
|
|
86
|
+
@designer.add_link(args[0], options)
|
|
87
|
+
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
desc 'Add links from a file to the website'
|
|
92
|
+
arg_name 'FILE'
|
|
93
|
+
command :file do |c|
|
|
94
|
+
|
|
95
|
+
c.action do |global_options,options,args|
|
|
96
|
+
|
|
97
|
+
@designer.add_links_from_file(args[0])
|
|
98
|
+
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
desc 'Update a link'
|
|
103
|
+
arg_name 'URL'
|
|
104
|
+
command :update do |c|
|
|
105
|
+
|
|
106
|
+
c.desc 'Name of the link'
|
|
107
|
+
c.arg_name 'NAME'
|
|
108
|
+
c.flag [:n, :name]
|
|
109
|
+
|
|
110
|
+
c.desc 'Description of the link'
|
|
111
|
+
c.arg_name 'DESCRIPTION'
|
|
112
|
+
c.flag [:d, :description]
|
|
113
|
+
|
|
114
|
+
c.desc 'Tag the link is associated to'
|
|
115
|
+
c.arg_name 'TAG'
|
|
116
|
+
c.flag [:t, :tag]
|
|
117
|
+
|
|
118
|
+
c.action do |global_options,options,args|
|
|
119
|
+
|
|
120
|
+
@designer.update_link(args[0], options)
|
|
121
|
+
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
desc 'Find a link'
|
|
126
|
+
arg_name 'FIND_STRING'
|
|
127
|
+
command :find do |c|
|
|
128
|
+
|
|
129
|
+
c.desc 'Table columns to print'
|
|
130
|
+
c.default_value 'url, name, description, tag'
|
|
131
|
+
c.arg_name 'URL, NAME, DESCRIPTION, TAG'
|
|
132
|
+
c.flag [:c, :columns]
|
|
133
|
+
|
|
134
|
+
c.action do |global_options,options,args|
|
|
135
|
+
|
|
136
|
+
print_links(@designer.find_links(args[0].downcase), options[:c])
|
|
137
|
+
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
desc 'Remove one or more links'
|
|
142
|
+
arg_name 'URL[URL,URL]'
|
|
143
|
+
command :delete do |c|
|
|
144
|
+
c.action do |global_options,options,args|
|
|
145
|
+
@designer.remove_links(args)
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
desc 'List and optionally filter links'
|
|
150
|
+
command :list do |c|
|
|
151
|
+
|
|
152
|
+
c.desc 'Link\'s URL'
|
|
153
|
+
c.arg_name 'URL'
|
|
154
|
+
c.flag [:u, :url]
|
|
155
|
+
|
|
156
|
+
c.desc 'Name of the link'
|
|
157
|
+
c.arg_name 'NAME'
|
|
158
|
+
c.flag [:n, :name]
|
|
159
|
+
|
|
160
|
+
c.desc 'Description of the link'
|
|
161
|
+
c.arg_name 'DESCRIPTION'
|
|
162
|
+
c.flag [:d, :description]
|
|
163
|
+
|
|
164
|
+
c.desc 'Tag the link is associated to'
|
|
165
|
+
c.arg_name 'TAG'
|
|
166
|
+
c.flag [:t, :tag]
|
|
167
|
+
|
|
168
|
+
c.desc 'Table columns to print'
|
|
169
|
+
c.default_value 'url, name, description, tag'
|
|
170
|
+
c.arg_name 'URL, NAME, DESCRIPTION, TAG'
|
|
171
|
+
c.flag [:c, :columns]
|
|
172
|
+
|
|
173
|
+
c.action do |global_options,options,args|
|
|
174
|
+
|
|
175
|
+
print_links(@designer.list_links(options), options[:c])
|
|
176
|
+
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
desc "Operate on websites"
|
|
181
|
+
command :website do |c|
|
|
182
|
+
c.desc 'Show all websites or search for websites'
|
|
183
|
+
c.arg_name 'WEBSITE'
|
|
184
|
+
c.skips_pre
|
|
185
|
+
c.skips_post
|
|
186
|
+
c.command :show do |s|
|
|
187
|
+
|
|
188
|
+
s.desc 'Show only the exactly matching website'
|
|
189
|
+
s.switch [:e, :exact]
|
|
190
|
+
|
|
191
|
+
s.action do |global_options,options,args|
|
|
192
|
+
if options[:e]
|
|
193
|
+
puts Dir.glob(yaml_file(syclink_website_directory, args[0]))
|
|
194
|
+
else
|
|
195
|
+
puts Dir.glob(File.join(syclink_website_directory, "*.website"))
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
c.desc 'Remove one or more websites'
|
|
201
|
+
c.arg_name 'WEBSITE_PATTERN'
|
|
202
|
+
c.skips_pre
|
|
203
|
+
c.skips_post
|
|
204
|
+
c.command :remove do |s|
|
|
205
|
+
s.action do |global_options,options,args|
|
|
206
|
+
websites = Dir.glob(File.join(syclink_website_directory,
|
|
207
|
+
"#{args[0]}.website"))
|
|
208
|
+
html_files = Dir.glob(File.join(syclink_html_directory,
|
|
209
|
+
"#{args[0]}.html"))
|
|
210
|
+
puts "About to delete:"
|
|
211
|
+
puts; puts "Websites"
|
|
212
|
+
puts "--------"
|
|
213
|
+
puts websites
|
|
214
|
+
puts; puts "HTML-Files"
|
|
215
|
+
puts "----------"
|
|
216
|
+
puts html_files
|
|
217
|
+
puts; print "Delete websites and corresponding html files (y/n)? "
|
|
218
|
+
if STDIN.gets.chomp =~ /y/i
|
|
219
|
+
websites.each { |website| FileUtils.rm website }
|
|
220
|
+
html_files.each { |html_file| FileUtils.rm html_file }
|
|
221
|
+
end
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
c.desc 'Create html representation of website'
|
|
226
|
+
c.command [:create] do |s|
|
|
227
|
+
s.action do |global_options,options,args|
|
|
228
|
+
@designer.create_website(syclink_html_directory, syclink_html_template)
|
|
229
|
+
end
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
c.default_command :create
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
pre do |global,command,options,args|
|
|
236
|
+
|
|
237
|
+
if WEBSITE_COMMANDS.include?(command.name)
|
|
238
|
+
@designer = SycLink::Designer.new
|
|
239
|
+
global[:website] ||= config[:default_website]
|
|
240
|
+
|
|
241
|
+
if File.exists? yaml_file(syclink_website_directory, global[:website])
|
|
242
|
+
@designer.load_website(yaml_file(syclink_website_directory,
|
|
243
|
+
global[:website]))
|
|
244
|
+
else
|
|
245
|
+
print "Website #{global[:website]} doesn't exist. Create it (y/n)? "
|
|
246
|
+
if STDIN.gets.chomp =~ /y/i
|
|
247
|
+
puts; puts "Creating #{global[:website]}"
|
|
248
|
+
@designer.new_website(global[:website])
|
|
249
|
+
else
|
|
250
|
+
exit(0)
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
if (global[:website] != config[:default_website])
|
|
254
|
+
print "Want to make #{global[:website]} the default (y/n)? "
|
|
255
|
+
if STDIN.gets.chomp =~ /y/i
|
|
256
|
+
puts; puts "Making #{global[:website]} the default website"
|
|
257
|
+
File.open(syclink_file, 'w') do |f|
|
|
258
|
+
YAML.dump({ default_website: global[:website] }, f)
|
|
259
|
+
end
|
|
260
|
+
end
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
true
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
post do |global,command,options,args|
|
|
271
|
+
if WEBSITE_COMMANDS.include? command.name
|
|
272
|
+
@designer.save_website(syclink_website_directory)
|
|
273
|
+
end
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
on_error do |exception|
|
|
277
|
+
if exception.message == "exit"
|
|
278
|
+
false
|
|
279
|
+
else
|
|
280
|
+
true
|
|
281
|
+
end
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
def print_links(links, columns)
|
|
285
|
+
allowed_cols = %w{ url name description tag }
|
|
286
|
+
cols = columns.delete(' ').downcase.split(',') & allowed_cols
|
|
287
|
+
SycLink::Formatter.table(links, cols)
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
exit run(ARGV)
|
data/doc/Gemfile.html
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
|
|
7
|
+
<title>Gemfile - RDoc Documentation</title>
|
|
8
|
+
|
|
9
|
+
<script type="text/javascript">
|
|
10
|
+
var rdoc_rel_prefix = "./";
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<script src="./js/jquery.js"></script>
|
|
14
|
+
<script src="./js/darkfish.js"></script>
|
|
15
|
+
|
|
16
|
+
<link href="./css/fonts.css" rel="stylesheet">
|
|
17
|
+
<link href="./css/rdoc.css" rel="stylesheet">
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
<body id="top" role="document" class="file">
|
|
22
|
+
<nav role="navigation">
|
|
23
|
+
<div id="project-navigation">
|
|
24
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
|
25
|
+
<h2>
|
|
26
|
+
<a href="./index.html" rel="home">Home</a>
|
|
27
|
+
</h2>
|
|
28
|
+
|
|
29
|
+
<div id="table-of-contents-navigation">
|
|
30
|
+
<a href="./table_of_contents.html#pages">Pages</a>
|
|
31
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
|
32
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
|
37
|
+
<form action="#" method="get" accept-charset="utf-8">
|
|
38
|
+
<div id="search-field-wrapper">
|
|
39
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
|
40
|
+
aria-autocomplete="list" aria-controls="search-results"
|
|
41
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
|
42
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<ul id="search-results" aria-label="Search Results"
|
|
46
|
+
aria-busy="false" aria-expanded="false"
|
|
47
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
|
48
|
+
</form>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
<div id="project-metadata">
|
|
56
|
+
<div id="fileindex-section" class="nav-section">
|
|
57
|
+
<h3>Pages</h3>
|
|
58
|
+
|
|
59
|
+
<ul class="link-list">
|
|
60
|
+
|
|
61
|
+
<li><a href="./Gemfile.html">Gemfile</a>
|
|
62
|
+
|
|
63
|
+
<li><a href="./Gemfile_lock.html">Gemfile.lock</a>
|
|
64
|
+
|
|
65
|
+
<li><a href="./LICENSE.html">LICENSE</a>
|
|
66
|
+
|
|
67
|
+
<li><a href="./README_md.html">README</a>
|
|
68
|
+
|
|
69
|
+
<li><a href="./README_rdoc.html">README</a>
|
|
70
|
+
|
|
71
|
+
<li><a href="./links_csv.html">links.csv</a>
|
|
72
|
+
|
|
73
|
+
<li><a href="./setup_md.html">setup</a>
|
|
74
|
+
|
|
75
|
+
<li><a href="./syclink_gemspec.html">syclink.gemspec</a>
|
|
76
|
+
|
|
77
|
+
<li><a href="./syclink_rdoc.html">syclink</a>
|
|
78
|
+
|
|
79
|
+
<li><a href="./templates/example_html.html">example.html</a>
|
|
80
|
+
|
|
81
|
+
<li><a href="./templates/links.html">links</a>
|
|
82
|
+
|
|
83
|
+
<li><a href="./templates/stylesheets/style_css.html">style.css</a>
|
|
84
|
+
|
|
85
|
+
<li><a href="./templates/stylesheets/style_css_map.html">style.css.map</a>
|
|
86
|
+
|
|
87
|
+
<li><a href="./templates/stylesheets/style_css_scss.html">style.css.scss</a>
|
|
88
|
+
|
|
89
|
+
<li><a href="./templates/syc-link_html.html">syc-link.html</a>
|
|
90
|
+
|
|
91
|
+
</ul>
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
</div>
|
|
95
|
+
</nav>
|
|
96
|
+
|
|
97
|
+
<main role="main" aria-label="Page Gemfile">
|
|
98
|
+
|
|
99
|
+
<p>source '<a href="https://rubygems.org">rubygems.org</a>' gemspec</p>
|
|
100
|
+
</main>
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
<footer id="validator-badges" role="contentinfo">
|
|
105
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
|
106
|
+
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
|
|
107
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
|
108
|
+
</footer>
|
|
109
|
+
|