radiant-ray-extension 3.0.0.alpha

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.
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,47 @@
1
+ namespace :radiant do
2
+ namespace :extensions do
3
+ namespace :dummy do
4
+
5
+ desc "Runs the migration of the Dummy extension"
6
+ task :migrate => :environment do
7
+ require 'radiant/extension_migrator'
8
+ if ENV["VERSION"]
9
+ DummyExtension.migrator.migrate(ENV["VERSION"].to_i)
10
+ Rake::Task['db:schema:dump'].invoke
11
+ else
12
+ DummyExtension.migrator.migrate
13
+ Rake::Task['db:schema:dump'].invoke
14
+ end
15
+ end
16
+
17
+ desc "Copies public assets of the Dummy to the instance public/ directory."
18
+ task :update => :environment do
19
+ is_svn_or_dir = proc {|path| path =~ /\.svn/ || File.directory?(path) }
20
+ puts "Copying assets from DummyExtension"
21
+ Dir[DummyExtension.root + "/public/**/*"].reject(&is_svn_or_dir).each do |file|
22
+ path = file.sub(DummyExtension.root, '')
23
+ directory = File.dirname(path)
24
+ mkdir_p RAILS_ROOT + directory, :verbose => false
25
+ cp file, RAILS_ROOT + path, :verbose => false
26
+ end
27
+ end
28
+
29
+ desc "Syncs all available translations for this ext to the English ext master"
30
+ task :sync => :environment do
31
+ # The main translation root, basically where English is kept
32
+ language_root = DummyExtension.root + "/config/locales"
33
+ words = TranslationSupport.get_translation_keys(language_root)
34
+
35
+ Dir["#{language_root}/*.yml"].each do |filename|
36
+ next if filename.match('_available_tags')
37
+ basename = File.basename(filename, '.yml')
38
+ puts "Syncing #{basename}"
39
+ (comments, other) = TranslationSupport.read_file(filename, basename)
40
+ words.each { |k,v| other[k] ||= words[k] } # Initializing hash variable as empty if it does not exist
41
+ other.delete_if { |k,v| !words[k] } # Remove if not defined in en.yml
42
+ TranslationSupport.write_file(filename, basename, comments, other)
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,29 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "radiant-dummy-extension"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "radiant-dummy-extension"
7
+ s.version = RadiantDummyExtension::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = RadiantDummyExtension::AUTHORS
10
+ s.email = RadiantDummyExtension::EMAIL
11
+ s.homepage = RadiantDummyExtension::URL
12
+ s.summary = RadiantDummyExtension::SUMMARY
13
+ s.description = RadiantDummyExtension::DESCRIPTION
14
+
15
+ # Define gem dependencies here.
16
+ # Don't include a dependency on radiant itself: it causes problems when radiant is in vendor/radiant.
17
+ # s.add_dependency "something", "~> 1.0.0"
18
+ # s.add_dependency "radiant-some-extension", "~> 1.0.0"
19
+
20
+ ignores = if File.exist?('.gitignore')
21
+ File.read('.gitignore').split("\n").inject([]) {|a,p| a + Dir[p] }
22
+ else
23
+ []
24
+ end
25
+ s.files = Dir['**/*'] - ignores
26
+ s.test_files = Dir['test/**/*','spec/**/*','features/**/*'] - ignores
27
+ # s.executables = Dir['bin/*'] - ignores
28
+ s.require_paths = ["lib"]
29
+ end
@@ -0,0 +1,56 @@
1
+ require "spec_helper"
2
+ require "ray/cli"
3
+
4
+ describe Ray::CLI do
5
+
6
+ describe "search task" do
7
+ it "must complain when no query is given" do
8
+ `./bin/ray search`.must_match /A\ search\ query\ is\ required/
9
+ end
10
+
11
+ it "must complain when no extensions are found" do
12
+ `./bin/ray search zzz`.must_equal "No extensions matched 'zzz'\n"
13
+ end
14
+
15
+ it "must show search results" do
16
+ `./bin/ray search reorder`.must_match /----.*reorder_children\n\n/m
17
+ end
18
+
19
+ it "must search RubyGems when the --rubygems flag is set" do
20
+ `./bin/ray search reorder --rubygems`.must_match /----.*reorder_children\n\n/m
21
+ end
22
+
23
+ it "must search GitHub when the --github flag is set" do
24
+ `./bin/ray search reorder --github`.must_match /----.*reorder_children\n\n/m
25
+ end
26
+ end
27
+
28
+ describe "install task" do
29
+ before do
30
+ FileUtils.mkdir_p Ray::EXT_DIR
31
+ end
32
+
33
+ after do
34
+ cleanup
35
+ FileUtils.rm_rf "#{Dir.pwd}/vendor"
36
+ end
37
+
38
+ it "must install the extension when the --zip flag is set" do
39
+ `./bin/ray install reorder-children --zip`
40
+ File.exist?("vendor/extensions/reorder_children/reorder_children_extension.rb").must_equal true
41
+ end
42
+
43
+ it "must install multiple extensions when the --zip flag is set" do
44
+ `./bin/ray install reorder-children sitemap-xml --zip`
45
+ File.exist?("vendor/extensions/reorder_children/reorder_children_extension.rb").must_equal true
46
+ File.exist?("vendor/extensions/sitemap_xml/sitemap_xml_extension.rb").must_equal true
47
+ end
48
+
49
+ it "must install the extension from a specific location when the --zip flag is set" do
50
+ `./bin/ray install reorder-children --zip https://github.com/jomz/radiant-reorder_children-extension/zipball/master`
51
+ File.exist?("vendor/extensions/reorder_children/reorder_children_extension.rb").must_equal true
52
+ end
53
+
54
+ end
55
+
56
+ end
@@ -0,0 +1,214 @@
1
+ require "spec_helper"
2
+ require "ray/extension/gem"
3
+
4
+ module Ray
5
+
6
+ class Gem
7
+ def bundle ; end
8
+ def run_task task, options = {} ; "" ; end
9
+ end
10
+
11
+ end
12
+
13
+ describe Ray::Gem do
14
+
15
+ describe "install" do
16
+
17
+ before do
18
+ FileUtils.mkdir_p Ray::ROOT
19
+ FileUtils.mkdir_p "#{Ray::ROOT}/lib/tasks"
20
+ FileUtils.cp "#{Dir.pwd}/spec/fixtures/Gemfile", "#{Ray::ROOT}/Gemfile"
21
+ end
22
+
23
+ after { cleanup }
24
+
25
+ it "must raise if no name is given" do
26
+ proc { Ray::Gem.new.install }.must_raise RuntimeError
27
+ end
28
+
29
+ it "must install the extension" do
30
+ Ray::Gem.new({
31
+ :name => "dummy",
32
+ :version => "1.0.0"
33
+ }).install
34
+ `bundle exec gem list`.must_match /radiant-dummy-extension/
35
+ end
36
+
37
+ end
38
+
39
+ describe "add_gem" do
40
+
41
+ before do
42
+ FileUtils.mkdir_p Ray::ROOT
43
+ FileUtils.cp "#{Dir.pwd}/spec/fixtures/Gemfile", "#{Ray::ROOT}/Gemfile"
44
+ end
45
+
46
+ after { cleanup }
47
+
48
+ it "must add the extension to the Gemfile" do
49
+ VCR.use_cassette("rubygems_v1_api_gem_info") do
50
+ Ray::Gem.new({ :name => "reorder-children" }).add_gem
51
+ gemfile = File.read(Ray::GEMFILE)
52
+ gemfile.include?('gem "radiant-reorder_children-extension", "~> 1.0.5"').must_equal true
53
+ end
54
+ end
55
+
56
+ end
57
+
58
+ describe "bundle" do
59
+
60
+ it "must install the gem" do
61
+ skip "Assuming bundler works for now"
62
+ end
63
+
64
+ end
65
+
66
+ describe "copy_tasks" do
67
+
68
+ before do
69
+ FileUtils.mkdir_p "#{Ray::ROOT}/lib/tasks"
70
+ end
71
+
72
+ after { cleanup }
73
+
74
+ it "must copy tasks from the RubyGem" do
75
+ Ray::Gem.new({ :name => "dummy", :version => "1.0.0" }).copy_tasks
76
+ File.exist?("#{Ray::ROOT}/lib/tasks/dummy_extension_tasks.rake").must_equal true
77
+ end
78
+
79
+ end
80
+
81
+ describe "load_tasks" do
82
+
83
+ before do
84
+ FileUtils.mkdir_p "#{Ray::ROOT}/lib/tasks"
85
+ FileUtils.cp_r "#{Dir.pwd}/spec/fixtures/dummy/lib/tasks/dummy_extension_tasks.rake", "#{Ray::ROOT}/lib/tasks/dummy_extension_tasks.rake"
86
+ end
87
+
88
+ after { cleanup }
89
+
90
+ it "must load available Rake tasks" do
91
+ tasks = Ray::Gem.new({ :name => "dummy", :version => "1.0.0" }).load_tasks - ["default", "spec", "spec:cli"]
92
+ tasks.must_equal ["radiant:extensions:dummy:migrate", "radiant:extensions:dummy:sync", "radiant:extensions:dummy:update"]
93
+ end
94
+
95
+ end
96
+
97
+ describe "version" do
98
+
99
+ it "must return version 0 if no name is given" do
100
+ Ray::Gem.new.version.must_equal 0
101
+ end
102
+
103
+ it "must return gem version" do
104
+ VCR.use_cassette("rubygems_v1_api_gem_info") do
105
+ Ray::Gem.new({ :name => "reorder-children" }).version.must_equal "1.0.5"
106
+ end
107
+ end
108
+
109
+ end
110
+
111
+ describe "disable" do
112
+
113
+ it "must raise if the extension is not installed" do
114
+ skip
115
+ end
116
+
117
+ it "must disable the extension" do
118
+ skip
119
+ end
120
+
121
+ end
122
+
123
+ describe "enable" do
124
+
125
+ it "must raise if the extension is not disabled" do
126
+ skip
127
+ end
128
+
129
+ it "must enable the extension" do
130
+ skip
131
+ end
132
+
133
+ end
134
+
135
+ describe "uninstall" do
136
+
137
+ it "must raise if the extension is not installed" do
138
+ skip
139
+ end
140
+
141
+ it "must uninstall the extension" do
142
+ skip
143
+ end
144
+
145
+ end
146
+
147
+ describe "run_task" do
148
+
149
+ before do
150
+ FileUtils.mkdir_p Ray::EXT_DIR
151
+ FileUtils.cp_r "#{Dir.pwd}/spec/fixtures/dummy", "#{Ray::EXT_DIR}/dummy"
152
+ end
153
+
154
+ after { cleanup }
155
+
156
+ it "must run Rake tasks" do
157
+ task = Ray::Gem.new({ :name => "dummy", :version => "1.0.0" }).run_task "migrate"
158
+ task.must_equal ""
159
+ end
160
+
161
+ end
162
+
163
+ describe "run_tasks" do
164
+
165
+ before do
166
+ FileUtils.mkdir_p Ray::EXT_DIR
167
+ FileUtils.cp_r "#{Dir.pwd}/spec/fixtures/dummy", "#{Ray::EXT_DIR}/dummy"
168
+ end
169
+
170
+ after { cleanup }
171
+
172
+ it "must run the appropriate Rake tasks" do
173
+ extension = Ray::Gem.new({ :name => "dummy", :version => "1.0.0" })
174
+ tasks = extension.run_tasks - ["default", "spec", "spec:cli"]
175
+ tasks.must_equal ["radiant:extensions:dummy:migrate", "radiant:extensions:dummy:sync", "radiant:extensions:dummy:update"]
176
+ end
177
+
178
+ end
179
+
180
+ describe "name=" do
181
+
182
+ it "must convert the name to a proper extension name" do
183
+ extension = Ray::Gem.new
184
+ extension.name = "what-ever"
185
+ extension.name.must_equal "what_ever"
186
+ extension.name = "radiant-what-ever"
187
+ extension.name.must_equal "what_ever"
188
+ extension.name = "what-ever-extension"
189
+ extension.name.must_equal "what_ever"
190
+ extension.name = "radiant-what-ever-extension"
191
+ extension.name.must_equal "what_ever"
192
+ extension.name = "what_ever"
193
+ extension.name.must_equal "what_ever"
194
+ extension.name = "radiant_what_ever"
195
+ extension.name.must_equal "what_ever"
196
+ extension.name = "what_ever_extension"
197
+ extension.name.must_equal "what_ever"
198
+ extension.name = "radiant_what_ever_extension"
199
+ extension.name.must_equal "what_ever"
200
+ extension.name = "whatever"
201
+ extension.name.must_equal "whatever"
202
+ extension.name = "radiant_whatever"
203
+ extension.name.must_equal "whatever"
204
+ extension.name = "whatever_extension"
205
+ extension.name.must_equal "whatever"
206
+ extension.name = "radiant_whatever_extension"
207
+ extension.name.must_equal "whatever"
208
+ extension.name = "RADIANT-WHAT-EVER-EXTENSION"
209
+ extension.name.must_equal "what_ever"
210
+ end
211
+
212
+ end
213
+
214
+ end
@@ -0,0 +1,216 @@
1
+ require "spec_helper"
2
+ require "ray/extension/git"
3
+
4
+ module Extension
5
+ def run_task task, options = {} ; "" ; end
6
+ end
7
+
8
+ describe Ray::Git do
9
+
10
+ describe "install" do
11
+
12
+ before do
13
+ FileUtils.mkdir_p Ray::EXT_DIR
14
+ @extension = Ray::Git.new({
15
+ :name => "dummy",
16
+ :uri => "file:///#{Dir.pwd}/spec/fixtures/dummy"
17
+ })
18
+ end
19
+
20
+ after { cleanup }
21
+
22
+ it "must raise if the extension is already installed" do
23
+ FileUtils.cp_r "#{Dir.pwd}/spec/fixtures/dummy", "#{Ray::EXT_DIR}/dummy"
24
+ proc { @extension.install }.must_raise RuntimeError
25
+ end
26
+
27
+ it "must install the extension" do
28
+ Dir.chdir "#{Dir.pwd}/spec/fixtures/dummy" do
29
+ `git init && git add . && git commit -am "inital commit"`
30
+ end
31
+ @extension.install
32
+ FileUtils.rm_rf "#{Dir.pwd}/spec/fixtures/dummy/.git"
33
+ File.exist?("#{Ray::EXT_DIR}/dummy/dummy_extension.rb").must_equal true
34
+ end
35
+
36
+ end
37
+
38
+ describe "clone" do
39
+
40
+ before do
41
+ FileUtils.mkdir_p Ray::TMP_DIR
42
+ @extension = Ray::Git.new({ :name => "dummy" })
43
+ end
44
+
45
+ after { cleanup }
46
+
47
+ it "must raise if the name is not given" do
48
+ proc { Ray::Git.new.clone }.must_raise RuntimeError
49
+ end
50
+
51
+ it "must raise if the uri is not given" do
52
+ proc { @extension.clone }.must_raise RuntimeError
53
+ end
54
+
55
+ it "must clone the repository" do
56
+ Dir.chdir "#{Dir.pwd}/spec/fixtures/dummy" do
57
+ `git init && git add . && git commit -am "inital commit"`
58
+ end
59
+ @extension.uri = "file:///#{Dir.pwd}/spec/fixtures/dummy"
60
+ @extension.clone
61
+ FileUtils.rm_rf "#{Dir.pwd}/spec/fixtures/dummy/.git"
62
+ File.exist?("#{Ray::TMP_DIR}/dummy/dummy_extension.rb").must_equal true
63
+ end
64
+
65
+ end
66
+
67
+ describe "disable" do
68
+
69
+ before do
70
+ FileUtils.mkdir_p Ray::EXT_DIR
71
+ FileUtils.mkdir_p Ray::TMP_DIR
72
+ @extension = Ray::Git.new({ :name => "dummy" })
73
+ end
74
+
75
+ after { cleanup }
76
+
77
+ it "must raise if the extension is not installed" do
78
+ proc { @extension.disable }.must_raise RuntimeError
79
+ end
80
+
81
+ it "must disable the extension" do
82
+ FileUtils.cp_r "#{Dir.pwd}/spec/fixtures/dummy", "#{Ray::EXT_DIR}/dummy"
83
+ @extension.disable
84
+ File.exist?("#{Ray::EXT_DIR}/.disabled/dummy/dummy_extension.rb").must_equal true
85
+ end
86
+
87
+ end
88
+
89
+ describe "enable" do
90
+
91
+ before do
92
+ FileUtils.mkdir_p "#{Ray::EXT_DIR}/.disabled"
93
+ FileUtils.mkdir_p Ray::TMP_DIR
94
+ @extension = Ray::Git.new({ :name => "dummy" })
95
+ end
96
+
97
+ after { cleanup }
98
+
99
+ it "must raise if the extension is not disabled" do
100
+ proc { @extension.enable }.must_raise RuntimeError
101
+ end
102
+
103
+ it "must enable the extension" do
104
+ FileUtils.cp_r "#{Dir.pwd}/spec/fixtures/dummy", "#{Ray::EXT_DIR}/.disabled/dummy"
105
+ @extension.enable
106
+ File.exist?("#{Ray::EXT_DIR}/dummy/dummy_extension.rb").must_equal true
107
+ end
108
+
109
+ end
110
+
111
+ describe "uninstall" do
112
+
113
+ before do
114
+ FileUtils.mkdir_p Ray::EXT_DIR
115
+ FileUtils.mkdir_p Ray::TMP_DIR
116
+ @extension = Ray::Git.new({ :name => "dummy" })
117
+ end
118
+
119
+ after { cleanup }
120
+
121
+ it "must raise if the extension is not installed" do
122
+ proc { @extension.uninstall }.must_raise RuntimeError
123
+ end
124
+
125
+ it "must uninstall the extension" do
126
+ FileUtils.cp_r "#{Dir.pwd}/spec/fixtures/dummy", "#{Ray::EXT_DIR}/dummy"
127
+ @extension.uninstall
128
+ File.exist?("#{Ray::EXT_DIR}/dummy/dummy_extension.rb").must_equal false
129
+ end
130
+
131
+ end
132
+
133
+ describe "load_tasks" do
134
+
135
+ before do
136
+ FileUtils.mkdir_p Ray::EXT_DIR
137
+ FileUtils.cp_r "#{Dir.pwd}/spec/fixtures/dummy", "#{Ray::EXT_DIR}/dummy"
138
+ end
139
+
140
+ after { cleanup }
141
+
142
+ it "must load available Rake tasks" do
143
+ tasks = Ray::Git.new({ :name => "dummy" }).load_tasks - ["default", "spec", "spec:cli"]
144
+ tasks.must_equal ["radiant:extensions:dummy:migrate", "radiant:extensions:dummy:sync", "radiant:extensions:dummy:update"]
145
+ end
146
+
147
+ end
148
+
149
+ describe "run_task" do
150
+
151
+ before do
152
+ FileUtils.mkdir_p Ray::EXT_DIR
153
+ FileUtils.cp_r "#{Dir.pwd}/spec/fixtures/dummy", "#{Ray::EXT_DIR}/dummy"
154
+ end
155
+
156
+ after { cleanup }
157
+
158
+ it "must run Rake tasks" do
159
+ task = Ray::Git.new({ :name => "dummy" }).run_task "migrate"
160
+ task.must_equal ""
161
+ end
162
+
163
+ end
164
+
165
+ describe "run_tasks" do
166
+
167
+ before do
168
+ FileUtils.mkdir_p Ray::EXT_DIR
169
+ FileUtils.cp_r "#{Dir.pwd}/spec/fixtures/dummy", "#{Ray::EXT_DIR}/dummy"
170
+ end
171
+
172
+ after { cleanup }
173
+
174
+ it "must run the appropriate Rake tasks" do
175
+ extension = Ray::Git.new({ :name => "dummy" })
176
+ tasks = extension.run_tasks - ["default", "spec", "spec:cli"]
177
+ tasks.must_equal ["radiant:extensions:dummy:migrate", "radiant:extensions:dummy:sync", "radiant:extensions:dummy:update"]
178
+ end
179
+
180
+ end
181
+
182
+ describe "name=" do
183
+
184
+ it "must convert the name to a proper extension name" do
185
+ extension = Ray::Git.new
186
+ extension.name = "what-ever"
187
+ extension.name.must_equal "what_ever"
188
+ extension.name = "radiant-what-ever"
189
+ extension.name.must_equal "what_ever"
190
+ extension.name = "what-ever-extension"
191
+ extension.name.must_equal "what_ever"
192
+ extension.name = "radiant-what-ever-extension"
193
+ extension.name.must_equal "what_ever"
194
+ extension.name = "what_ever"
195
+ extension.name.must_equal "what_ever"
196
+ extension.name = "radiant_what_ever"
197
+ extension.name.must_equal "what_ever"
198
+ extension.name = "what_ever_extension"
199
+ extension.name.must_equal "what_ever"
200
+ extension.name = "radiant_what_ever_extension"
201
+ extension.name.must_equal "what_ever"
202
+ extension.name = "whatever"
203
+ extension.name.must_equal "whatever"
204
+ extension.name = "radiant_whatever"
205
+ extension.name.must_equal "whatever"
206
+ extension.name = "whatever_extension"
207
+ extension.name.must_equal "whatever"
208
+ extension.name = "radiant_whatever_extension"
209
+ extension.name.must_equal "whatever"
210
+ extension.name = "RADIANT-WHAT-EVER-EXTENSION"
211
+ extension.name.must_equal "what_ever"
212
+ end
213
+
214
+ end
215
+
216
+ end