diff --git a/History.txt b/History.txt new file mode 100644 index 0000000..d9c2388 --- /dev/null +++ b/History.txt @@ -0,0 +1,4 @@ +=== 0.0.1 2010-01-10 + +* 1 major enhancement: + * Initial release diff --git a/Manifest b/Manifest new file mode 100644 index 0000000..a658544 --- /dev/null +++ b/Manifest @@ -0,0 +1,12 @@ +History.txt +Manifest +Manifest.txt +PostInstall.txt +README.rdoc +Rakefile +bin/webbynode +lib/wn.rb +oldRakefile +test/test_helper.rb +test/test_webbynode.rb +test/test_wn.rb diff --git a/Manifest.txt b/Manifest.txt new file mode 100644 index 0000000..eafab7a --- /dev/null +++ b/Manifest.txt @@ -0,0 +1,11 @@ +History.txt +Manifest.txt +PostInstall.txt +README.rdoc +Rakefile +lib/wn.rb +script/console +script/destroy +script/generate +test/test_helper.rb +test/test_wn.rb diff --git a/PostInstall.txt b/PostInstall.txt new file mode 100644 index 0000000..1edc193 --- /dev/null +++ b/PostInstall.txt @@ -0,0 +1,12 @@ +-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + Webbynode deployment gem +-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +This deployment engine is highly experimental and +should be considered beta code for now. + +Commands: + + webbynode init Initializes the current app for deployment to a Webby + webbynode push Deploys the current committed code to a Webby + diff --git a/README.rdoc b/README.rdoc new file mode 100644 index 0000000..bac4f8e --- /dev/null +++ b/README.rdoc @@ -0,0 +1,48 @@ += wn + +* http://github.com/#{github_username}/#{project_name} + +== DESCRIPTION: + +FIX (describe your package) + +== FEATURES/PROBLEMS: + +* FIX (list of features or problems) + +== SYNOPSIS: + + FIX (code sample of usage) + +== REQUIREMENTS: + +* FIX (list of requirements) + +== INSTALL: + +* FIX (sudo gem install, anything else) + +== LICENSE: + +(The MIT License) + +Copyright (c) 2010 FIXME full name + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..c55aaa0 --- /dev/null +++ b/Rakefile @@ -0,0 +1,55 @@ +require 'rubygems' +require 'rake' +require 'rake/testtask' + +require 'echoe' + +Echoe.new('webbynode', '0.1.0') do |p| + p.description = "Webbynode Deployment Gem" + p.url = "http://webbynode.com" + p.author = "Felipe Coury" + p.email = "felipe@webbynode.com" + p.ignore_pattern = ["tmp/*", "script/*"] + # p.dependencies = [ + # ['activeresource','>= 2.3.4'], + # ['activesupport','>= 2.3.4'], + # ['rainbow', '>=1.0.4'], + # ['highline', '>=1.5.1'], + # ['httparty', '>=0.4.5'] + # ] + p.install_message = <= 2.1.0' +require 'hoe' +require 'fileutils' +require './lib/wn' + +Hoe.plugin :newgem +# Hoe.plugin :website +# Hoe.plugin :cucumberfeatures + +# Generate all the Rake tasks +# Run 'rake -T' to see list of generated tasks (from gem root directory) +$hoe = Hoe.spec 'wn' do + self.developer 'Felipe Coury', 'felipe@webbynode.com' + self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required + self.rubyforge_name = self.name # TODO this is default value + # self.extra_deps = [['activesupport','>= 2.0.2']] + +end + +require 'newgem/tasks' +Dir['tasks/**/*.rake'].each { |t| load t } + +# TODO - want other tests/tasks run by default? Add them to the list +# remove_task :default +# task :default => [:spec, :features] diff --git a/pkg/webbynode-0.1.0.gem b/pkg/webbynode-0.1.0.gem new file mode 100644 index 0000000..5d7c5a1 Binary files /dev/null and b/pkg/webbynode-0.1.0.gem differ diff --git a/pkg/webbynode-0.1.0.tar.gz b/pkg/webbynode-0.1.0.tar.gz new file mode 100644 index 0000000..c0f588c Binary files /dev/null and b/pkg/webbynode-0.1.0.tar.gz differ diff --git a/pkg/webbynode-0.1.0/History.txt b/pkg/webbynode-0.1.0/History.txt new file mode 100644 index 0000000..d9c2388 --- /dev/null +++ b/pkg/webbynode-0.1.0/History.txt @@ -0,0 +1,4 @@ +=== 0.0.1 2010-01-10 + +* 1 major enhancement: + * Initial release diff --git a/pkg/webbynode-0.1.0/Manifest b/pkg/webbynode-0.1.0/Manifest new file mode 100644 index 0000000..a658544 --- /dev/null +++ b/pkg/webbynode-0.1.0/Manifest @@ -0,0 +1,12 @@ +History.txt +Manifest +Manifest.txt +PostInstall.txt +README.rdoc +Rakefile +bin/webbynode +lib/wn.rb +oldRakefile +test/test_helper.rb +test/test_webbynode.rb +test/test_wn.rb diff --git a/pkg/webbynode-0.1.0/Manifest.txt b/pkg/webbynode-0.1.0/Manifest.txt new file mode 100644 index 0000000..eafab7a --- /dev/null +++ b/pkg/webbynode-0.1.0/Manifest.txt @@ -0,0 +1,11 @@ +History.txt +Manifest.txt +PostInstall.txt +README.rdoc +Rakefile +lib/wn.rb +script/console +script/destroy +script/generate +test/test_helper.rb +test/test_wn.rb diff --git a/pkg/webbynode-0.1.0/PostInstall.txt b/pkg/webbynode-0.1.0/PostInstall.txt new file mode 100644 index 0000000..1edc193 --- /dev/null +++ b/pkg/webbynode-0.1.0/PostInstall.txt @@ -0,0 +1,12 @@ +-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + Webbynode deployment gem +-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +This deployment engine is highly experimental and +should be considered beta code for now. + +Commands: + + webbynode init Initializes the current app for deployment to a Webby + webbynode push Deploys the current committed code to a Webby + diff --git a/pkg/webbynode-0.1.0/README.rdoc b/pkg/webbynode-0.1.0/README.rdoc new file mode 100644 index 0000000..bac4f8e --- /dev/null +++ b/pkg/webbynode-0.1.0/README.rdoc @@ -0,0 +1,48 @@ += wn + +* http://github.com/#{github_username}/#{project_name} + +== DESCRIPTION: + +FIX (describe your package) + +== FEATURES/PROBLEMS: + +* FIX (list of features or problems) + +== SYNOPSIS: + + FIX (code sample of usage) + +== REQUIREMENTS: + +* FIX (list of requirements) + +== INSTALL: + +* FIX (sudo gem install, anything else) + +== LICENSE: + +(The MIT License) + +Copyright (c) 2010 FIXME full name + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/pkg/webbynode-0.1.0/Rakefile b/pkg/webbynode-0.1.0/Rakefile new file mode 100644 index 0000000..c55aaa0 --- /dev/null +++ b/pkg/webbynode-0.1.0/Rakefile @@ -0,0 +1,55 @@ +require 'rubygems' +require 'rake' +require 'rake/testtask' + +require 'echoe' + +Echoe.new('webbynode', '0.1.0') do |p| + p.description = "Webbynode Deployment Gem" + p.url = "http://webbynode.com" + p.author = "Felipe Coury" + p.email = "felipe@webbynode.com" + p.ignore_pattern = ["tmp/*", "script/*"] + # p.dependencies = [ + # ['activeresource','>= 2.3.4'], + # ['activesupport','>= 2.3.4'], + # ['rainbow', '>=1.0.4'], + # ['highline', '>=1.5.1'], + # ['httparty', '>=0.4.5'] + # ] + p.install_message = <= 2.1.0' +require 'hoe' +require 'fileutils' +require './lib/wn' + +Hoe.plugin :newgem +# Hoe.plugin :website +# Hoe.plugin :cucumberfeatures + +# Generate all the Rake tasks +# Run 'rake -T' to see list of generated tasks (from gem root directory) +$hoe = Hoe.spec 'wn' do + self.developer 'Felipe Coury', 'felipe@webbynode.com' + self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required + self.rubyforge_name = self.name # TODO this is default value + # self.extra_deps = [['activesupport','>= 2.0.2']] + +end + +require 'newgem/tasks' +Dir['tasks/**/*.rake'].each { |t| load t } + +# TODO - want other tests/tasks run by default? Add them to the list +# remove_task :default +# task :default => [:spec, :features] diff --git a/pkg/webbynode-0.1.0/test/test_helper.rb b/pkg/webbynode-0.1.0/test/test_helper.rb new file mode 100644 index 0000000..992d4a0 --- /dev/null +++ b/pkg/webbynode-0.1.0/test/test_helper.rb @@ -0,0 +1,6 @@ +require 'stringio' +require 'shoulda' +require 'matchy' +require 'mocha' +require 'test/unit' +require File.dirname(__FILE__) + '/../lib/wn' diff --git a/pkg/webbynode-0.1.0/test/test_webbynode.rb b/pkg/webbynode-0.1.0/test/test_webbynode.rb new file mode 100644 index 0000000..e69de29 diff --git a/pkg/webbynode-0.1.0/test/test_wn.rb b/pkg/webbynode-0.1.0/test/test_wn.rb new file mode 100644 index 0000000..093c92e --- /dev/null +++ b/pkg/webbynode-0.1.0/test/test_wn.rb @@ -0,0 +1,189 @@ +require File.dirname(__FILE__) + '/test_helper.rb' + +class TestWn < Test::Unit::TestCase + + def command(s) + Wn::App.new(s.split(" ")) + end + + context "Parsing commands" do + should "trigger the proper method" do + app = command("init") + app.expects(:init) + app.run + + app = command("push") + app.expects(:push) + app.run + end + + should "separate commands and parameters" do + app = command("init myshot.com") + app.command.should == "init" + app.params.should == ["myshot.com"] + end + end + + context "File exists" do + should "be true if file exists" do + File.expects(:exists?).with(".pushand").returns(true) + app = Wn::App.new(["abcdef"]) + app.file_exists(".pushand").should == true + end + + should "be false if file exists" do + File.expects(:exists?).with(".gitignore").returns(false) + app = Wn::App.new(["abcdef"]) + app.file_exists(".gitignore").should == false + end + end + + context "Dir exists" do + should "be true if dir exists" do + File.expects(:directory?).with(".git").returns(true) + app = Wn::App.new(["abcdef"]) + app.dir_exists(".git").should == true + + File.expects(:directory?).with(".gita").returns(false) + app = Wn::App.new(["abcdef"]) + app.dir_exists(".gita").should == false + end + end + + context "Out" do + app = Wn::App.new(["abcdef"]) + app.expects(:puts).with("help!") + app.out "help!" + + app = Wn::App.new(["abcdef"]) + app.expects(:puts).with("help me!") + app.out "help me!" + end + + context "Create file" do + should "create a file with the given contexts" do + app = Wn::App.new(["abcdef"]) + + file = mock("file") + File.expects(:open).with("/var/rails/my_gosh", "w").yields(file) + file.expects(:write).with("my\nfair\nlady") + app.create_file "/var/rails/my_gosh", "my\nfair\nlady" + + file = mock("file") + File.expects(:open).with("/var/rails/yahoo", "w").yields(file) + file.expects(:write).with("another_brick_in_the_wall") + app.create_file "/var/rails/yahoo", "another_brick_in_the_wall" + end + end + + context "Git init" do + should "call git init and commit initial commit" do + app = Wn::App.new(["abcdef"]) + app.expects(:exec).with("git init") + + app.expects(:app_name).with().returns("my_app") + app.expects(:exec).with("git remote add webbynode git@2.2.3.3:my_app") + + app.expects(:exec).with("git add .") + app.expects(:exec).with("git commit -m \"Initial commit\"") + + app.git_init "2.2.3.3" + + app = Wn::App.new(["abcdef"]) + app.expects(:exec).with("git init") + + app.expects(:app_name).with().returns("another_app") + app.expects(:exec).with("git remote add webbynode git@5.4.2.1:another_app") + + app.expects(:exec).with("git add .") + app.expects(:exec).with("git commit -m \"Initial commit\"") + + app.git_init "5.4.2.1" + end + end + + context "Push command" do + should "push to webbynode master" do + app = command("push") + app.expects(:dir_exists).with(".git").returns(true) + app.expects(:app_name).with().returns("another_app") + app.expects(:out).with("Publishing another_app to Webbynode...") + app.expects(:exec).with("git push webbynode master") + app.run + end + + should "indicate not initialized" do + app = command("push") + app.expects(:dir_exists).with(".git").returns(false) + app.expects(:out).with("Not an application or missing initialization. Use 'webbynode init'.") + app.run + end + end + + context "Init command" do + should "require two arguments" do + app = command("init") + app.expects(:out).with("usage: wn init [webby_ip] [host]") + app.run + + app = command("init abc") + app.expects(:out).with("usage: wn init [webby_ip] [host]") + app.run + end + + should "create .gitignore" do + app = command("init 2.2.2.2 teste.myserver.com") + app.expects(:out).with("Creating .gitignore file...") + app.expects(:dir_exists).with(".git").returns(true) + app.expects(:file_exists).with(".pushand").returns(true) + app.expects(:file_exists).with(".gitignore").returns(false) + app.expects(:create_file).with(".gitignore", <= 1.2") if s.respond_to? :required_rubygems_version= + s.authors = ["Felipe Coury"] + s.date = %q{2010-01-10} + s.default_executable = %q{webbynode} + s.description = %q{Webbynode Deployment Gem} + s.email = %q{felipe@webbynode.com} + s.executables = ["webbynode"] + s.extra_rdoc_files = ["README.rdoc", "bin/webbynode", "lib/wn.rb"] + s.files = ["History.txt", "Manifest", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "bin/webbynode", "lib/wn.rb", "oldRakefile", "test/test_helper.rb", "test/test_webbynode.rb", "test/test_wn.rb", "webbynode.gemspec"] + s.homepage = %q{http://webbynode.com} + s.post_install_message = %q{ -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + Webbynode deployment gem + -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + + This deployment engine is highly experimental and + should be considered beta code for the time being. + + Commands: + + webbynode init Initializes the current app for deployment to a Webby + webbynode push Deploys the current committed code to a Webby + +} + s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Webbynode", "--main", "README.rdoc"] + s.require_paths = ["lib"] + s.rubyforge_project = %q{webbynode} + s.rubygems_version = %q{1.3.5} + s.summary = %q{Webbynode Deployment Gem} + s.test_files = ["test/test_helper.rb", "test/test_webbynode.rb", "test/test_wn.rb"] + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then + else + end + else + end +end diff --git a/script/console b/script/console new file mode 100755 index 0000000..8456d0b --- /dev/null +++ b/script/console @@ -0,0 +1,10 @@ +#!/usr/bin/env ruby +# File: script/console +irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb' + +libs = " -r irb/completion" +# Perhaps use a console_lib to store any extra methods I may want available in the cosole +# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}" +libs << " -r #{File.dirname(__FILE__) + '/../lib/wn.rb'}" +puts "Loading wn gem" +exec "#{irb} #{libs} --simple-prompt" \ No newline at end of file diff --git a/script/destroy b/script/destroy new file mode 100755 index 0000000..e48464d --- /dev/null +++ b/script/destroy @@ -0,0 +1,14 @@ +#!/usr/bin/env ruby +APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')) + +begin + require 'rubigen' +rescue LoadError + require 'rubygems' + require 'rubigen' +end +require 'rubigen/scripts/destroy' + +ARGV.shift if ['--help', '-h'].include?(ARGV[0]) +RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit] +RubiGen::Scripts::Destroy.new.run(ARGV) diff --git a/script/generate b/script/generate new file mode 100755 index 0000000..c27f655 --- /dev/null +++ b/script/generate @@ -0,0 +1,14 @@ +#!/usr/bin/env ruby +APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')) + +begin + require 'rubigen' +rescue LoadError + require 'rubygems' + require 'rubigen' +end +require 'rubigen/scripts/generate' + +ARGV.shift if ['--help', '-h'].include?(ARGV[0]) +RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit] +RubiGen::Scripts::Generate.new.run(ARGV) diff --git a/test/test_helper.rb b/test/test_helper.rb new file mode 100644 index 0000000..992d4a0 --- /dev/null +++ b/test/test_helper.rb @@ -0,0 +1,6 @@ +require 'stringio' +require 'shoulda' +require 'matchy' +require 'mocha' +require 'test/unit' +require File.dirname(__FILE__) + '/../lib/wn' diff --git a/test/test_webbynode.rb b/test/test_webbynode.rb new file mode 100644 index 0000000..e69de29 diff --git a/test/test_wn.rb b/test/test_wn.rb new file mode 100644 index 0000000..093c92e --- /dev/null +++ b/test/test_wn.rb @@ -0,0 +1,189 @@ +require File.dirname(__FILE__) + '/test_helper.rb' + +class TestWn < Test::Unit::TestCase + + def command(s) + Wn::App.new(s.split(" ")) + end + + context "Parsing commands" do + should "trigger the proper method" do + app = command("init") + app.expects(:init) + app.run + + app = command("push") + app.expects(:push) + app.run + end + + should "separate commands and parameters" do + app = command("init myshot.com") + app.command.should == "init" + app.params.should == ["myshot.com"] + end + end + + context "File exists" do + should "be true if file exists" do + File.expects(:exists?).with(".pushand").returns(true) + app = Wn::App.new(["abcdef"]) + app.file_exists(".pushand").should == true + end + + should "be false if file exists" do + File.expects(:exists?).with(".gitignore").returns(false) + app = Wn::App.new(["abcdef"]) + app.file_exists(".gitignore").should == false + end + end + + context "Dir exists" do + should "be true if dir exists" do + File.expects(:directory?).with(".git").returns(true) + app = Wn::App.new(["abcdef"]) + app.dir_exists(".git").should == true + + File.expects(:directory?).with(".gita").returns(false) + app = Wn::App.new(["abcdef"]) + app.dir_exists(".gita").should == false + end + end + + context "Out" do + app = Wn::App.new(["abcdef"]) + app.expects(:puts).with("help!") + app.out "help!" + + app = Wn::App.new(["abcdef"]) + app.expects(:puts).with("help me!") + app.out "help me!" + end + + context "Create file" do + should "create a file with the given contexts" do + app = Wn::App.new(["abcdef"]) + + file = mock("file") + File.expects(:open).with("/var/rails/my_gosh", "w").yields(file) + file.expects(:write).with("my\nfair\nlady") + app.create_file "/var/rails/my_gosh", "my\nfair\nlady" + + file = mock("file") + File.expects(:open).with("/var/rails/yahoo", "w").yields(file) + file.expects(:write).with("another_brick_in_the_wall") + app.create_file "/var/rails/yahoo", "another_brick_in_the_wall" + end + end + + context "Git init" do + should "call git init and commit initial commit" do + app = Wn::App.new(["abcdef"]) + app.expects(:exec).with("git init") + + app.expects(:app_name).with().returns("my_app") + app.expects(:exec).with("git remote add webbynode git@2.2.3.3:my_app") + + app.expects(:exec).with("git add .") + app.expects(:exec).with("git commit -m \"Initial commit\"") + + app.git_init "2.2.3.3" + + app = Wn::App.new(["abcdef"]) + app.expects(:exec).with("git init") + + app.expects(:app_name).with().returns("another_app") + app.expects(:exec).with("git remote add webbynode git@5.4.2.1:another_app") + + app.expects(:exec).with("git add .") + app.expects(:exec).with("git commit -m \"Initial commit\"") + + app.git_init "5.4.2.1" + end + end + + context "Push command" do + should "push to webbynode master" do + app = command("push") + app.expects(:dir_exists).with(".git").returns(true) + app.expects(:app_name).with().returns("another_app") + app.expects(:out).with("Publishing another_app to Webbynode...") + app.expects(:exec).with("git push webbynode master") + app.run + end + + should "indicate not initialized" do + app = command("push") + app.expects(:dir_exists).with(".git").returns(false) + app.expects(:out).with("Not an application or missing initialization. Use 'webbynode init'.") + app.run + end + end + + context "Init command" do + should "require two arguments" do + app = command("init") + app.expects(:out).with("usage: wn init [webby_ip] [host]") + app.run + + app = command("init abc") + app.expects(:out).with("usage: wn init [webby_ip] [host]") + app.run + end + + should "create .gitignore" do + app = command("init 2.2.2.2 teste.myserver.com") + app.expects(:out).with("Creating .gitignore file...") + app.expects(:dir_exists).with(".git").returns(true) + app.expects(:file_exists).with(".pushand").returns(true) + app.expects(:file_exists).with(".gitignore").returns(false) + app.expects(:create_file).with(".gitignore", <