cheatorious 0.3.0 → 0.4.0

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
+ SHA1:
3
+ metadata.gz: b3e26b5e25c7e68c5b8f9f78dcd1b4ac02a9ad77
4
+ data.tar.gz: c50279a651f22742dfa825d15e518050779ab48b
5
+ SHA512:
6
+ metadata.gz: e58c7ef787dc55f7ad6dfd834580fd261d99d6b104fc33623dcfd28f52a33651d6561035ac9311ae9212adfa25891eea923220f43b175db3a6994311569288b5
7
+ data.tar.gz: 3e9718b98ed884c9903372d90f4155a332b0ee2a6d939f7a023a150fc7dfd18b2935ae4bc8ede08a10ebb25fb9d1a19f043c368cbc587eca9b6be489d253d013
data/.travis.yml CHANGED
@@ -1,8 +1,7 @@
1
1
  rvm:
2
2
  - 1.8.7
3
- - 1.9.2
4
3
  - 1.9.3
5
- - rbx-2.0
4
+ - 2.0.0
5
+ - rbx-19mode
6
6
  - jruby
7
- - ruby-head
8
- - ree
7
+ - ree
@@ -27,7 +27,7 @@ module Cheatorious
27
27
  w = writer.new
28
28
  print_full?(query) ? w.header(info[:name], info[:author], info[:version], info[:description]) : w.search_header(query, results_count, options)
29
29
  write_contents(filtered, w, options)
30
- w.footer if print_full?(query)
30
+ w.footer
31
31
 
32
32
  return w.result
33
33
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: UTF-8
2
2
  module Cheatorious
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.0"
4
4
  end
@@ -2,5 +2,6 @@ module Cheatorious
2
2
  module Writer
3
3
  autoload :Text, "cheatorious/writer/text"
4
4
  autoload :Tree, "cheatorious/writer/tree"
5
+ autoload :Alfred, "cheatorious/writer/alfred"
5
6
  end
6
7
  end
@@ -0,0 +1,75 @@
1
+ # encoding: UTF-8
2
+
3
+ module Cheatorious
4
+ module Writer
5
+ class Alfred
6
+ def initialize
7
+ @section_stack = []
8
+ @result = ""
9
+ @query = nil
10
+ @options = {}
11
+ end
12
+
13
+ def header(name, author = "", version = "", description = "")
14
+ line "<?xml version=\"1.0\"?>"
15
+ line "<items>"
16
+ end
17
+
18
+ def search_header(query, results_count, options)
19
+ @query = query
20
+ @options = options
21
+ line "<?xml version=\"1.0\"?>"
22
+ line "<items>"
23
+ end
24
+
25
+ def footer
26
+ line "</items>"
27
+ end
28
+
29
+ def section_start(section)
30
+ @section_stack.push(section)
31
+ end
32
+
33
+ def section_end
34
+ @section_stack.pop
35
+ end
36
+
37
+ def entry(name, *values)
38
+ line " <item arg=\"#{name}\">"
39
+ value_text = values.join(", ")
40
+ if @options['reverse']
41
+ line " <subtitle>#{value_text}</subtitle>"
42
+ line " <title>#{@section_stack.join(" > ")} > #{name}</title>"
43
+ else
44
+ line " <title>#{value_text}</title>"
45
+ line " <subtitle>#{@section_stack.join(" > ")} > #{name}</subtitle>"
46
+ end
47
+ line " <icon></icon>"
48
+ line " </item>"
49
+ end
50
+
51
+ def result
52
+ @result
53
+ end
54
+
55
+ private
56
+
57
+ def line(str = "")
58
+ if str.empty?
59
+ if @add_empty_line
60
+ @result += str + "\n"
61
+ @add_empty_line = false
62
+ end
63
+ else
64
+ @result += str + "\n"
65
+ @add_empty_line = true
66
+ end
67
+ end
68
+
69
+ def indentation(char)
70
+ char * 3 * @section_stack.size
71
+ end
72
+
73
+ end
74
+ end
75
+ end
metadata CHANGED
@@ -1,123 +1,106 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: cheatorious
3
- version: !ruby/object:Gem::Version
4
- hash: 19
5
- prerelease:
6
- segments:
7
- - 0
8
- - 3
9
- - 0
10
- version: 0.3.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.0
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Luis Cipriani
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2012-01-19 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
11
+ date: 2013-07-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
21
14
  name: thor
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 43
29
- segments:
30
- - 0
31
- - 14
32
- - 6
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
33
19
  version: 0.14.6
34
20
  type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: rainbow
38
21
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
40
- none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- hash: 21
45
- segments:
46
- - 1
47
- - 1
48
- - 3
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.14.6
27
+ - !ruby/object:Gem::Dependency
28
+ name: rainbow
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
49
33
  version: 1.1.3
50
34
  type: :runtime
51
- version_requirements: *id002
52
- - !ruby/object:Gem::Dependency
53
- name: hirb
54
35
  prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
56
- none: false
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- hash: 7
61
- segments:
62
- - 0
63
- - 6
64
- - 0
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: 1.1.3
41
+ - !ruby/object:Gem::Dependency
42
+ name: hirb
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
65
47
  version: 0.6.0
66
48
  type: :runtime
67
- version_requirements: *id003
68
- - !ruby/object:Gem::Dependency
69
- name: hirb-unicode
70
49
  prerelease: false
71
- requirement: &id004 !ruby/object:Gem::Requirement
72
- none: false
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- hash: 21
77
- segments:
78
- - 0
79
- - 0
80
- - 5
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 0.6.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: hirb-unicode
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
81
61
  version: 0.0.5
82
62
  type: :runtime
83
- version_requirements: *id004
84
- - !ruby/object:Gem::Dependency
85
- name: step-up
86
63
  prerelease: false
87
- requirement: &id005 !ruby/object:Gem::Requirement
88
- none: false
89
- requirements:
90
- - - ">="
91
- - !ruby/object:Gem::Version
92
- hash: 3
93
- segments:
94
- - 0
95
- version: "0"
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: 0.0.5
69
+ - !ruby/object:Gem::Dependency
70
+ name: step-up
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
96
76
  type: :development
97
- version_requirements: *id005
98
- - !ruby/object:Gem::Dependency
99
- name: rake
100
77
  prerelease: false
101
- requirement: &id006 !ruby/object:Gem::Requirement
102
- none: false
103
- requirements:
104
- - - ">="
105
- - !ruby/object:Gem::Version
106
- hash: 3
107
- segments:
108
- - 0
109
- version: "0"
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
110
90
  type: :development
111
- version_requirements: *id006
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
112
97
  description:
113
98
  email: lfcipriani@gmail.com
114
- executables:
99
+ executables:
115
100
  - cheatorious
116
101
  extensions: []
117
-
118
102
  extra_rdoc_files: []
119
-
120
- files:
103
+ files:
121
104
  - .travis.yml
122
105
  - CHANGELOG.md
123
106
  - LICENSE
@@ -135,40 +118,30 @@ files:
135
118
  - lib/cheatorious/utils.rb
136
119
  - lib/cheatorious/version.rb
137
120
  - lib/cheatorious/writer.rb
121
+ - lib/cheatorious/writer/alfred.rb
138
122
  - lib/cheatorious/writer/text.rb
139
123
  - lib/cheatorious/writer/tree.rb
140
124
  homepage: https://github.com/abril/cheatorious
141
125
  licenses: []
142
-
126
+ metadata: {}
143
127
  post_install_message:
144
128
  rdoc_options: []
145
-
146
- require_paths:
129
+ require_paths:
147
130
  - lib
148
- required_ruby_version: !ruby/object:Gem::Requirement
149
- none: false
150
- requirements:
151
- - - ">="
152
- - !ruby/object:Gem::Version
153
- hash: 3
154
- segments:
155
- - 0
156
- version: "0"
157
- required_rubygems_version: !ruby/object:Gem::Requirement
158
- none: false
159
- requirements:
160
- - - ">="
161
- - !ruby/object:Gem::Version
162
- hash: 3
163
- segments:
164
- - 0
165
- version: "0"
131
+ required_ruby_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - '>='
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ required_rubygems_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - '>='
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
166
141
  requirements: []
167
-
168
142
  rubyforge_project:
169
- rubygems_version: 1.8.10
143
+ rubygems_version: 2.0.3
170
144
  signing_key:
171
- specification_version: 3
145
+ specification_version: 4
172
146
  summary: generator of simple, searchable, command line cheatsheets
173
147
  test_files: []
174
-