radiant-ray-extension 3.0.0.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. data/LICENSE +19 -0
  2. data/README.markdown +30 -0
  3. data/Rakefile +26 -0
  4. data/bin/ray +5 -0
  5. data/doc/Extension.html +1189 -0
  6. data/doc/Ray.html +175 -0
  7. data/doc/Ray/CLI.html +585 -0
  8. data/doc/Ray/Cache.html +709 -0
  9. data/doc/Ray/Gem.html +760 -0
  10. data/doc/Ray/Git.html +278 -0
  11. data/doc/Ray/GitHub.html +553 -0
  12. data/doc/Ray/RubyGems.html +501 -0
  13. data/doc/Ray/Zip.html +300 -0
  14. data/doc/Search.html +433 -0
  15. data/doc/String.html +242 -0
  16. data/doc/_index.html +84 -0
  17. data/doc/class_list.html +47 -0
  18. data/doc/css/common.css +1 -0
  19. data/doc/css/full_list.css +55 -0
  20. data/doc/css/style.css +322 -0
  21. data/doc/file.LICENSE.html +85 -0
  22. data/doc/file.README.html +97 -0
  23. data/doc/file_list.html +46 -0
  24. data/doc/frames.html +13 -0
  25. data/doc/index.html +84 -0
  26. data/doc/js/app.js +205 -0
  27. data/doc/js/full_list.js +167 -0
  28. data/doc/js/jquery.js +16 -0
  29. data/doc/method_list.html +46 -0
  30. data/doc/top-level-namespace.html +105 -0
  31. data/lib/ray.rb +8 -0
  32. data/lib/ray/cli.rb +271 -0
  33. data/lib/ray/constants.rb +17 -0
  34. data/lib/ray/extension.rb +116 -0
  35. data/lib/ray/extension/gem.rb +96 -0
  36. data/lib/ray/extension/git.rb +30 -0
  37. data/lib/ray/extension/zip.rb +44 -0
  38. data/lib/ray/search.rb +62 -0
  39. data/lib/ray/search/cache.rb +61 -0
  40. data/lib/ray/search/github.rb +40 -0
  41. data/lib/ray/search/rubygems.rb +36 -0
  42. data/lib/ray/string.rb +18 -0
  43. data/ray.gemspec +31 -0
  44. data/spec/fixtures/Gemfile +4 -0
  45. data/spec/fixtures/cache_single.yml +8 -0
  46. data/spec/fixtures/cassettes/github_v2_api_no_matches.yml +38 -0
  47. data/spec/fixtures/cassettes/github_v2_api_search_no_matches.yml +38 -0
  48. data/spec/fixtures/cassettes/github_v2_api_search_reorder_children.yml +75 -0
  49. data/spec/fixtures/cassettes/github_v2_api_search_single.yml +74 -0
  50. data/spec/fixtures/cassettes/github_v3_api_owner_name.yml +75 -0
  51. data/spec/fixtures/cassettes/rubygems_v1_api_gem_info.yml +36 -0
  52. data/spec/fixtures/cassettes/rubygems_v1_api_no_matches.yml +34 -0
  53. data/spec/fixtures/cassettes/rubygems_v1_api_search_no_matches.yml +34 -0
  54. data/spec/fixtures/cassettes/rubygems_v1_api_search_reorder.yml +36 -0
  55. data/spec/fixtures/cassettes/rubygems_v1_api_search_reorder_children.yml +36 -0
  56. data/spec/fixtures/cassettes/rubygems_v1_api_search_single.yml +41 -0
  57. data/spec/fixtures/cassettes/zip_file.yml +101 -0
  58. data/spec/fixtures/dummy.zip +0 -0
  59. data/spec/fixtures/dummy/README +1 -0
  60. data/spec/fixtures/dummy/Rakefile +109 -0
  61. data/spec/fixtures/dummy/config/initializers/radiant_config.rb +3 -0
  62. data/spec/fixtures/dummy/config/locales/en.yml +3 -0
  63. data/spec/fixtures/dummy/config/routes.rb +5 -0
  64. data/spec/fixtures/dummy/dummy_extension.rb +21 -0
  65. data/spec/fixtures/dummy/lib/radiant-dummy-extension.rb +8 -0
  66. data/spec/fixtures/dummy/lib/tasks/dummy_extension_tasks.rake +47 -0
  67. data/spec/fixtures/dummy/public/stylesheets/extensions/dummy/dummy.css +0 -0
  68. data/spec/fixtures/dummy/radiant-dummy-extension.gemspec +29 -0
  69. data/spec/ray/cli_spec.rb +56 -0
  70. data/spec/ray/extension/gem_spec.rb +214 -0
  71. data/spec/ray/extension/git_spec.rb +216 -0
  72. data/spec/ray/extension/zip_spec.rb +239 -0
  73. data/spec/ray/search/cache_spec.rb +74 -0
  74. data/spec/ray/search/github_spec.rb +137 -0
  75. data/spec/ray/search/rubygems_spec.rb +127 -0
  76. data/spec/ray/string_spec.rb +30 -0
  77. data/spec/spec_helper.rb +27 -0
  78. metadata +205 -0
@@ -0,0 +1,127 @@
1
+ require "spec_helper"
2
+ require "ray/search/rubygems"
3
+
4
+ describe Ray::RubyGems do
5
+
6
+ describe "new" do
7
+
8
+ it "must have search results when there are matches" do
9
+ VCR.use_cassette("rubygems_v1_api_search_reorder") do
10
+ search = Ray::RubyGems.new "reorder"
11
+ search.results.must_equal({
12
+ "reorder_children" => {
13
+ :author => "Benny Degezelle",
14
+ :description => "Makes Radiant better by adding reorder_children!",
15
+ :homepage => "http://github.com/jomz/radiant-reorder_children-extension",
16
+ :name => "reorder_children",
17
+ :uri => "http://rubygems.org/gems/radiant-reorder_children-extension-1.0.5.gem",
18
+ :version => "1.0.5"
19
+ }
20
+ })
21
+ end
22
+ end
23
+
24
+ it "won't have search results when there are no matches" do
25
+ VCR.use_cassette("rubygems_v1_api_search_no_matches") do
26
+ search = Ray::RubyGems.new "no-matches"
27
+ search.results.must_equal({})
28
+ end
29
+ end
30
+
31
+ end
32
+
33
+ describe "cache" do
34
+
35
+ before do
36
+ FileUtils.mkdir_p Ray::RAY
37
+ VCR.use_cassette("rubygems_v1_api_search_single") do
38
+ @search = Ray::RubyGems.new "ray"
39
+ end
40
+ end
41
+
42
+ after { cleanup }
43
+
44
+ it "must create the cache in none exist" do
45
+ @search.cache
46
+ File.exist?(Ray::CACHE).must_equal true
47
+ end
48
+
49
+ it "must cache search" do
50
+ @search.cache
51
+ cache = YAML.load_file Ray::CACHE
52
+ cache.must_equal @search.results
53
+ end
54
+
55
+ it "must add to an existing cache" do
56
+ FileUtils.mkdir_p Ray::RAY
57
+ FileUtils.cp "#{Dir.pwd}/spec/fixtures/cache_single.yml", Ray::CACHE
58
+ old_cache = YAML.load_file Ray::CACHE
59
+ @search.cache
60
+ cache = YAML.load_file Ray::CACHE
61
+ cache.must_equal old_cache.merge(@search.results)
62
+ end
63
+
64
+ it "must update existing cache entries" do
65
+ FileUtils.mkdir_p Ray::RAY
66
+ FileUtils.cp "#{Dir.pwd}/spec/fixtures/cache_single.yml", Ray::CACHE
67
+ VCR.use_cassette("rubygems_v1_api_search_reorder_children") do
68
+ search = Ray::RubyGems.new "reorder_children"
69
+ search.cache
70
+ cache = YAML.load_file Ray::CACHE
71
+ cache.must_equal search.results
72
+ end
73
+ end
74
+
75
+ end
76
+
77
+ describe "output" do
78
+
79
+ it "must output formatted search results" do
80
+ VCR.use_cassette("rubygems_v1_api_search_single") do
81
+ search = Ray::RubyGems.new "ray"
82
+ search.output.must_match /ray install ray/
83
+ end
84
+ end
85
+
86
+ it "must output an explaination when there are no search results" do
87
+ VCR.use_cassette("rubygems_v1_api_no_matches") do
88
+ search = Ray::RubyGems.new "no-matches"
89
+ search.output.must_match /no extensions matched/i
90
+ end
91
+ end
92
+
93
+ end
94
+
95
+ describe "merge" do
96
+
97
+ it "must merge search results" do
98
+ VCR.use_cassette("rubygems_v1_api_search_single") do
99
+ @first = Ray::RubyGems.new "ray"
100
+ @first.results["ray"][:description] = ""
101
+ end
102
+ VCR.use_cassette("rubygems_v1_api_search_reorder_children") do
103
+ @second = Ray::RubyGems.new "reorder_children"
104
+ end
105
+ @first.merge(@second).results.must_equal({
106
+ "ray" => {
107
+ :author => "john muhl",
108
+ :description => "",
109
+ :homepage => "http://johnmuhl.github.com/radiant-ray-extension/",
110
+ :name => "ray",
111
+ :uri => "http://rubygems.org/gems/radiant-ray-extension-3.0.0.pre.gem",
112
+ :version => "3.0.0.pre"
113
+ },
114
+ "reorder_children" => {
115
+ :author => "Benny Degezelle",
116
+ :description => "Makes Radiant better by adding reorder_children!",
117
+ :homepage => "http://github.com/jomz/radiant-reorder_children-extension",
118
+ :name => "reorder_children",
119
+ :uri => "http://rubygems.org/gems/radiant-reorder_children-extension-1.0.5.gem",
120
+ :version => "1.0.5"
121
+ }
122
+ })
123
+ end
124
+
125
+ end
126
+
127
+ end
@@ -0,0 +1,30 @@
1
+ require File.expand_path "../../spec_helper", __FILE__
2
+ require "ray/string"
3
+
4
+ describe String do
5
+
6
+ describe "to_extension_name" do
7
+
8
+ it "must convert the name to a proper extension name" do
9
+ "what-ever".to_extension_name.must_equal "what_ever"
10
+ "radiant-what-ever".to_extension_name.must_equal "what_ever"
11
+ "what-ever-extension".to_extension_name.must_equal "what_ever"
12
+ "radiant-what-ever-extension".to_extension_name.must_equal "what_ever"
13
+ "what_ever".to_extension_name.must_equal "what_ever"
14
+ "radiant_what_ever".to_extension_name.must_equal "what_ever"
15
+ "what_ever_extension".to_extension_name.must_equal "what_ever"
16
+ "radiant_what_ever_extension".to_extension_name.must_equal "what_ever"
17
+ "whatever".to_extension_name.must_equal "whatever"
18
+ "radiant_whatever".to_extension_name.must_equal "whatever"
19
+ "whatever_extension".to_extension_name.must_equal "whatever"
20
+ "radiant_whatever_extension".to_extension_name.must_equal "whatever"
21
+ "RADIANT-WHAT-EVER-EXTENSION".to_extension_name.must_equal "what_ever"
22
+ end
23
+
24
+ it "must return nil if the name is emtpy" do
25
+ "".to_extension_name.must_equal nil
26
+ end
27
+
28
+ end
29
+
30
+ end
@@ -0,0 +1,27 @@
1
+ $:.push File.expand_path "../../lib", __FILE__
2
+
3
+ require "minitest/autorun"
4
+ require "minitest/pride" unless ENV['CI']
5
+ require "open-uri"
6
+ require "pp"
7
+ require "vcr"
8
+
9
+ $VERBOSE = nil
10
+
11
+ module Ray
12
+ ROOT = File.expand_path "#{Dir.pwd}/tmp"
13
+ RAY = "#{ROOT}/ray"
14
+ CACHE = "#{RAY}/cache.yml"
15
+ GEMFILE = "#{ROOT}/Gemfile"
16
+ EXT_DIR = "#{ROOT}/vendor/extensions"
17
+ TMP_DIR = "#{ROOT}/tmp/ray"
18
+ end
19
+
20
+ def cleanup
21
+ FileUtils.rm_rf Ray::ROOT
22
+ end
23
+
24
+ VCR.config do |c|
25
+ c.cassette_library_dir = "spec/fixtures/cassettes"
26
+ c.stub_with :fakeweb
27
+ end
metadata ADDED
@@ -0,0 +1,205 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: radiant-ray-extension
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.0.0.alpha
5
+ prerelease: 6
6
+ platform: ruby
7
+ authors:
8
+ - john muhl
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-11-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: multi_json
16
+ requirement: &70208094440600 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70208094440600
25
+ - !ruby/object:Gem::Dependency
26
+ name: rake
27
+ requirement: &70208094439960 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: '0.8'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70208094439960
36
+ - !ruby/object:Gem::Dependency
37
+ name: thor
38
+ requirement: &70208094439440 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: '0.14'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *70208094439440
47
+ - !ruby/object:Gem::Dependency
48
+ name: zip
49
+ requirement: &70208094438940 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '2'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *70208094438940
58
+ description: ! "Ray simplifies finding, installing, disabling, enabling and uninstalling
59
+ \nRadiant extensions. It uses RubyGems and GitHub to find (and cache) extension
60
+ \ninformation but you can install extensions from any location.\n\nRubyGems, Git
61
+ and zip archives are used to install extensions based on \npreference or availability.\n"
62
+ email:
63
+ - git@johnmuhl.com
64
+ executables:
65
+ - ray
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - bin/ray
70
+ - doc/_index.html
71
+ - doc/class_list.html
72
+ - doc/css/common.css
73
+ - doc/css/full_list.css
74
+ - doc/css/style.css
75
+ - doc/Extension.html
76
+ - doc/file.LICENSE.html
77
+ - doc/file.README.html
78
+ - doc/file_list.html
79
+ - doc/frames.html
80
+ - doc/index.html
81
+ - doc/js/app.js
82
+ - doc/js/full_list.js
83
+ - doc/js/jquery.js
84
+ - doc/method_list.html
85
+ - doc/Ray/Cache.html
86
+ - doc/Ray/CLI.html
87
+ - doc/Ray/Gem.html
88
+ - doc/Ray/Git.html
89
+ - doc/Ray/GitHub.html
90
+ - doc/Ray/RubyGems.html
91
+ - doc/Ray/Zip.html
92
+ - doc/Ray.html
93
+ - doc/Search.html
94
+ - doc/String.html
95
+ - doc/top-level-namespace.html
96
+ - lib/ray/cli.rb
97
+ - lib/ray/constants.rb
98
+ - lib/ray/extension/gem.rb
99
+ - lib/ray/extension/git.rb
100
+ - lib/ray/extension/zip.rb
101
+ - lib/ray/extension.rb
102
+ - lib/ray/search/cache.rb
103
+ - lib/ray/search/github.rb
104
+ - lib/ray/search/rubygems.rb
105
+ - lib/ray/search.rb
106
+ - lib/ray/string.rb
107
+ - lib/ray.rb
108
+ - LICENSE
109
+ - Rakefile
110
+ - ray.gemspec
111
+ - README.markdown
112
+ - spec/fixtures/cache_single.yml
113
+ - spec/fixtures/cassettes/github_v2_api_no_matches.yml
114
+ - spec/fixtures/cassettes/github_v2_api_search_no_matches.yml
115
+ - spec/fixtures/cassettes/github_v2_api_search_reorder_children.yml
116
+ - spec/fixtures/cassettes/github_v2_api_search_single.yml
117
+ - spec/fixtures/cassettes/github_v3_api_owner_name.yml
118
+ - spec/fixtures/cassettes/rubygems_v1_api_gem_info.yml
119
+ - spec/fixtures/cassettes/rubygems_v1_api_no_matches.yml
120
+ - spec/fixtures/cassettes/rubygems_v1_api_search_no_matches.yml
121
+ - spec/fixtures/cassettes/rubygems_v1_api_search_reorder.yml
122
+ - spec/fixtures/cassettes/rubygems_v1_api_search_reorder_children.yml
123
+ - spec/fixtures/cassettes/rubygems_v1_api_search_single.yml
124
+ - spec/fixtures/cassettes/zip_file.yml
125
+ - spec/fixtures/dummy/config/initializers/radiant_config.rb
126
+ - spec/fixtures/dummy/config/locales/en.yml
127
+ - spec/fixtures/dummy/config/routes.rb
128
+ - spec/fixtures/dummy/dummy_extension.rb
129
+ - spec/fixtures/dummy/lib/radiant-dummy-extension.rb
130
+ - spec/fixtures/dummy/lib/tasks/dummy_extension_tasks.rake
131
+ - spec/fixtures/dummy/public/stylesheets/extensions/dummy/dummy.css
132
+ - spec/fixtures/dummy/radiant-dummy-extension.gemspec
133
+ - spec/fixtures/dummy/Rakefile
134
+ - spec/fixtures/dummy/README
135
+ - spec/fixtures/dummy.zip
136
+ - spec/fixtures/Gemfile
137
+ - spec/ray/cli_spec.rb
138
+ - spec/ray/extension/gem_spec.rb
139
+ - spec/ray/extension/git_spec.rb
140
+ - spec/ray/extension/zip_spec.rb
141
+ - spec/ray/search/cache_spec.rb
142
+ - spec/ray/search/github_spec.rb
143
+ - spec/ray/search/rubygems_spec.rb
144
+ - spec/ray/string_spec.rb
145
+ - spec/spec_helper.rb
146
+ homepage: http://johnmuhl.github.com/radiant-ray-extension/
147
+ licenses: []
148
+ post_install_message:
149
+ rdoc_options: []
150
+ require_paths:
151
+ - lib
152
+ required_ruby_version: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ required_rubygems_version: !ruby/object:Gem::Requirement
159
+ none: false
160
+ requirements:
161
+ - - ! '>'
162
+ - !ruby/object:Gem::Version
163
+ version: 1.3.1
164
+ requirements: []
165
+ rubyforge_project:
166
+ rubygems_version: 1.8.10
167
+ signing_key:
168
+ specification_version: 3
169
+ summary: Friendly extension management for Radiant CMS
170
+ test_files:
171
+ - spec/fixtures/cache_single.yml
172
+ - spec/fixtures/cassettes/github_v2_api_no_matches.yml
173
+ - spec/fixtures/cassettes/github_v2_api_search_no_matches.yml
174
+ - spec/fixtures/cassettes/github_v2_api_search_reorder_children.yml
175
+ - spec/fixtures/cassettes/github_v2_api_search_single.yml
176
+ - spec/fixtures/cassettes/github_v3_api_owner_name.yml
177
+ - spec/fixtures/cassettes/rubygems_v1_api_gem_info.yml
178
+ - spec/fixtures/cassettes/rubygems_v1_api_no_matches.yml
179
+ - spec/fixtures/cassettes/rubygems_v1_api_search_no_matches.yml
180
+ - spec/fixtures/cassettes/rubygems_v1_api_search_reorder.yml
181
+ - spec/fixtures/cassettes/rubygems_v1_api_search_reorder_children.yml
182
+ - spec/fixtures/cassettes/rubygems_v1_api_search_single.yml
183
+ - spec/fixtures/cassettes/zip_file.yml
184
+ - spec/fixtures/dummy/config/initializers/radiant_config.rb
185
+ - spec/fixtures/dummy/config/locales/en.yml
186
+ - spec/fixtures/dummy/config/routes.rb
187
+ - spec/fixtures/dummy/dummy_extension.rb
188
+ - spec/fixtures/dummy/lib/radiant-dummy-extension.rb
189
+ - spec/fixtures/dummy/lib/tasks/dummy_extension_tasks.rake
190
+ - spec/fixtures/dummy/public/stylesheets/extensions/dummy/dummy.css
191
+ - spec/fixtures/dummy/radiant-dummy-extension.gemspec
192
+ - spec/fixtures/dummy/Rakefile
193
+ - spec/fixtures/dummy/README
194
+ - spec/fixtures/dummy.zip
195
+ - spec/fixtures/Gemfile
196
+ - spec/ray/cli_spec.rb
197
+ - spec/ray/extension/gem_spec.rb
198
+ - spec/ray/extension/git_spec.rb
199
+ - spec/ray/extension/zip_spec.rb
200
+ - spec/ray/search/cache_spec.rb
201
+ - spec/ray/search/github_spec.rb
202
+ - spec/ray/search/rubygems_spec.rb
203
+ - spec/ray/string_spec.rb
204
+ - spec/spec_helper.rb
205
+ has_rdoc: