From cfcea1d53ae5ce38a7cbeb41e05958dc009988b0 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Fri, 15 Oct 2010 17:46:31 +0300 Subject: Added 'rails plugin new' generator which generates gem plugin skeleton. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This command is based on enginex gem by José Valim. It generates gem structure and ads dummy application into test/dummy. This can be used to start developing any kind of extension for rails 3. --- railties/test/fixtures/lib/plugin_builders/empty_builder.rb | 2 ++ railties/test/fixtures/lib/plugin_builders/simple_builder.rb | 7 +++++++ railties/test/fixtures/lib/plugin_builders/tweak_builder.rb | 7 +++++++ 3 files changed, 16 insertions(+) create mode 100644 railties/test/fixtures/lib/plugin_builders/empty_builder.rb create mode 100644 railties/test/fixtures/lib/plugin_builders/simple_builder.rb create mode 100644 railties/test/fixtures/lib/plugin_builders/tweak_builder.rb (limited to 'railties/test/fixtures') diff --git a/railties/test/fixtures/lib/plugin_builders/empty_builder.rb b/railties/test/fixtures/lib/plugin_builders/empty_builder.rb new file mode 100644 index 0000000000..5c5607621c --- /dev/null +++ b/railties/test/fixtures/lib/plugin_builders/empty_builder.rb @@ -0,0 +1,2 @@ +class PluginBuilder +end diff --git a/railties/test/fixtures/lib/plugin_builders/simple_builder.rb b/railties/test/fixtures/lib/plugin_builders/simple_builder.rb new file mode 100644 index 0000000000..08f6c5535d --- /dev/null +++ b/railties/test/fixtures/lib/plugin_builders/simple_builder.rb @@ -0,0 +1,7 @@ +class PluginBuilder + def gitignore + create_file ".gitignore", <<-R.strip +foobar + R + end +end diff --git a/railties/test/fixtures/lib/plugin_builders/tweak_builder.rb b/railties/test/fixtures/lib/plugin_builders/tweak_builder.rb new file mode 100644 index 0000000000..1e801409a4 --- /dev/null +++ b/railties/test/fixtures/lib/plugin_builders/tweak_builder.rb @@ -0,0 +1,7 @@ +class PluginBuilder < Rails::PluginBuilder + def gitignore + create_file ".gitignore", <<-R.strip +foobar + R + end +end -- cgit v1.2.3 From b36fa51a3f56431d8e46c1fff6a6493d3c10607a Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Wed, 20 Oct 2010 21:21:14 +0200 Subject: Allow easy overriding of test framework in 'rake plugin new' generator, using PluginBuilder --- railties/test/fixtures/lib/plugin_builders/spec_builder.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 railties/test/fixtures/lib/plugin_builders/spec_builder.rb (limited to 'railties/test/fixtures') diff --git a/railties/test/fixtures/lib/plugin_builders/spec_builder.rb b/railties/test/fixtures/lib/plugin_builders/spec_builder.rb new file mode 100644 index 0000000000..bdaa1fb8e1 --- /dev/null +++ b/railties/test/fixtures/lib/plugin_builders/spec_builder.rb @@ -0,0 +1,13 @@ +class PluginBuilder < Rails::PluginBuilder + def test + create_file "spec/spec_helper.rb" + end + + def test_path + "spec" + end + + def rakefile_test_tasks + "# spec tasks in rakefile" + end +end -- cgit v1.2.3 From ae1debd442113ed9476e776fe27cd95730896b59 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Thu, 21 Oct 2010 00:55:08 +0200 Subject: Make tests for app and plugin generators more DRY --- railties/test/fixtures/lib/app_builders/empty_builder.rb | 2 ++ railties/test/fixtures/lib/app_builders/simple_builder.rb | 7 +++++++ railties/test/fixtures/lib/app_builders/tweak_builder.rb | 7 +++++++ railties/test/fixtures/lib/empty_builder.rb | 2 -- railties/test/fixtures/lib/simple_builder.rb | 7 ------- railties/test/fixtures/lib/tweak_builder.rb | 7 ------- 6 files changed, 16 insertions(+), 16 deletions(-) create mode 100644 railties/test/fixtures/lib/app_builders/empty_builder.rb create mode 100644 railties/test/fixtures/lib/app_builders/simple_builder.rb create mode 100644 railties/test/fixtures/lib/app_builders/tweak_builder.rb delete mode 100644 railties/test/fixtures/lib/empty_builder.rb delete mode 100644 railties/test/fixtures/lib/simple_builder.rb delete mode 100644 railties/test/fixtures/lib/tweak_builder.rb (limited to 'railties/test/fixtures') diff --git a/railties/test/fixtures/lib/app_builders/empty_builder.rb b/railties/test/fixtures/lib/app_builders/empty_builder.rb new file mode 100644 index 0000000000..babd9c2461 --- /dev/null +++ b/railties/test/fixtures/lib/app_builders/empty_builder.rb @@ -0,0 +1,2 @@ +class AppBuilder +end \ No newline at end of file diff --git a/railties/test/fixtures/lib/app_builders/simple_builder.rb b/railties/test/fixtures/lib/app_builders/simple_builder.rb new file mode 100644 index 0000000000..993d3a2aa2 --- /dev/null +++ b/railties/test/fixtures/lib/app_builders/simple_builder.rb @@ -0,0 +1,7 @@ +class AppBuilder + def gitignore + create_file ".gitignore", <<-R.strip +foobar + R + end +end diff --git a/railties/test/fixtures/lib/app_builders/tweak_builder.rb b/railties/test/fixtures/lib/app_builders/tweak_builder.rb new file mode 100644 index 0000000000..cb50be01cb --- /dev/null +++ b/railties/test/fixtures/lib/app_builders/tweak_builder.rb @@ -0,0 +1,7 @@ +class AppBuilder < Rails::AppBuilder + def gitignore + create_file ".gitignore", <<-R.strip +foobar + R + end +end diff --git a/railties/test/fixtures/lib/empty_builder.rb b/railties/test/fixtures/lib/empty_builder.rb deleted file mode 100644 index babd9c2461..0000000000 --- a/railties/test/fixtures/lib/empty_builder.rb +++ /dev/null @@ -1,2 +0,0 @@ -class AppBuilder -end \ No newline at end of file diff --git a/railties/test/fixtures/lib/simple_builder.rb b/railties/test/fixtures/lib/simple_builder.rb deleted file mode 100644 index 47dcdc0d96..0000000000 --- a/railties/test/fixtures/lib/simple_builder.rb +++ /dev/null @@ -1,7 +0,0 @@ -class AppBuilder - def configru - create_file "config.ru", <<-R.strip -run proc { |env| [200, { "Content-Type" => "text/html" }, ["Hello World"]] } - R - end -end \ No newline at end of file diff --git a/railties/test/fixtures/lib/tweak_builder.rb b/railties/test/fixtures/lib/tweak_builder.rb deleted file mode 100644 index eed20ecc9b..0000000000 --- a/railties/test/fixtures/lib/tweak_builder.rb +++ /dev/null @@ -1,7 +0,0 @@ -class AppBuilder < Rails::AppBuilder - def configru - create_file "config.ru", <<-R.strip -run proc { |env| [200, { "Content-Type" => "text/html" }, ["Hello World"]] } - R - end -end \ No newline at end of file -- cgit v1.2.3 From f9e33fc09a6731ad56ff8cfe24b49532ed65039c Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Tue, 2 Nov 2010 15:13:10 +0100 Subject: create_dummy_app method that allows to easily create dummy application from template --- railties/test/fixtures/lib/create_test_dummy_template.rb | 1 + railties/test/fixtures/lib/plugin_builders/spec_builder.rb | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 railties/test/fixtures/lib/create_test_dummy_template.rb (limited to 'railties/test/fixtures') diff --git a/railties/test/fixtures/lib/create_test_dummy_template.rb b/railties/test/fixtures/lib/create_test_dummy_template.rb new file mode 100644 index 0000000000..e4378bbd1a --- /dev/null +++ b/railties/test/fixtures/lib/create_test_dummy_template.rb @@ -0,0 +1 @@ +create_dummy_app("spec/dummy") diff --git a/railties/test/fixtures/lib/plugin_builders/spec_builder.rb b/railties/test/fixtures/lib/plugin_builders/spec_builder.rb index bdaa1fb8e1..aa18c7ddaa 100644 --- a/railties/test/fixtures/lib/plugin_builders/spec_builder.rb +++ b/railties/test/fixtures/lib/plugin_builders/spec_builder.rb @@ -1,13 +1,19 @@ class PluginBuilder < Rails::PluginBuilder def test create_file "spec/spec_helper.rb" + append_file "Rakefile", <<-EOF +# spec tasks in rakefile + +task :default => :spec + EOF end - def test_path - "spec" + def generate_test_dummy + dummy_path("spec/dummy") + super end - def rakefile_test_tasks - "# spec tasks in rakefile" + def skip_test_unit? + true end end -- cgit v1.2.3