engage 0.0.3 → 0.0.4
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.
- data/Gemfile.lock +1 -1
 - data/README.markdown +6 -5
 - data/lib/engage/core_ext/blank.rb +50 -0
 - data/lib/engage/runner.rb +14 -2
 - data/lib/engage/version.rb +1 -1
 - data/lib/engage.rb +1 -0
 - data/spec/runner_spec.rb +33 -10
 - metadata +5 -4
 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/README.markdown
    CHANGED
    
    | 
         @@ -1,6 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # engage
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            engage is a  
     | 
| 
      
 3 
     | 
    
         
            +
            engage is a tiny gem to setup an already existent ruby(or rails) app on your current environment. It expects that you use [rvm](http://rvm.beginrescueend.com/) and [git](http://git-scm.com/) - [bundler](http://gembundler.com/) is supported but not required.
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            ### What?
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
         @@ -14,15 +14,16 @@ Engage aims to provide a single command to run all those tasks. All you need to 
     | 
|
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
            ### Usage
         
     | 
| 
       16 
16 
     | 
    
         
             
            First, you can set your common git servers - the default list include only `git@github.com`.
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
       17 
18 
     | 
    
         
             
                engage --sources git@git.acme.com
         
     | 
| 
       18 
19 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
            After that you can  
     | 
| 
      
 20 
     | 
    
         
            +
            After that you can start a project by just running:
         
     | 
| 
       20 
21 
     | 
    
         | 
| 
       21 
22 
     | 
    
         
             
                engage some_project
         
     | 
| 
       22 
23 
     | 
    
         | 
| 
       23 
24 
     | 
    
         
             
            Behind the curtains, engage will: 
         
     | 
| 
       24 
25 
     | 
    
         | 
| 
       25 
26 
     | 
    
         
             
            * Prompt the git server to use - either "github.com" or "acme.com";
         
     | 
| 
       26 
     | 
    
         
            -
            * Clone the some_project repository form the  
     | 
| 
       27 
     | 
    
         
            -
            *  
     | 
| 
       28 
     | 
    
         
            -
            *  
     | 
| 
      
 27 
     | 
    
         
            +
            * Clone the some_project repository form the selected server - `git@git.acme.com/some_project.git`;
         
     | 
| 
      
 28 
     | 
    
         
            +
            * Create a gemset name `some_project` and a .rvmrc file;
         
     | 
| 
      
 29 
     | 
    
         
            +
            * Run bundler to install all the dependencies.
         
     | 
| 
         @@ -0,0 +1,50 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # https://github.com/rails/rails/blob/87ae85d5360ac8965f24/activesupport/lib/active_support/core_ext/object/blank.rb
         
     | 
| 
      
 2 
     | 
    
         
            +
            class Object #:nodoc:
         
     | 
| 
      
 3 
     | 
    
         
            +
              def blank?
         
     | 
| 
      
 4 
     | 
    
         
            +
                respond_to?(:empty?) ? empty? : !self
         
     | 
| 
      
 5 
     | 
    
         
            +
              end
         
     | 
| 
      
 6 
     | 
    
         
            +
              def present?
         
     | 
| 
      
 7 
     | 
    
         
            +
                !blank?
         
     | 
| 
      
 8 
     | 
    
         
            +
              end
         
     | 
| 
      
 9 
     | 
    
         
            +
              def presence
         
     | 
| 
      
 10 
     | 
    
         
            +
                self if present?
         
     | 
| 
      
 11 
     | 
    
         
            +
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
            end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            class NilClass #:nodoc:
         
     | 
| 
      
 15 
     | 
    
         
            +
              def blank?
         
     | 
| 
      
 16 
     | 
    
         
            +
                true
         
     | 
| 
      
 17 
     | 
    
         
            +
              end
         
     | 
| 
      
 18 
     | 
    
         
            +
            end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            class FalseClass #:nodoc:
         
     | 
| 
      
 21 
     | 
    
         
            +
              def blank?
         
     | 
| 
      
 22 
     | 
    
         
            +
                true
         
     | 
| 
      
 23 
     | 
    
         
            +
              end
         
     | 
| 
      
 24 
     | 
    
         
            +
            end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            class TrueClass #:nodoc:
         
     | 
| 
      
 27 
     | 
    
         
            +
              def blank?
         
     | 
| 
      
 28 
     | 
    
         
            +
                false
         
     | 
| 
      
 29 
     | 
    
         
            +
              end
         
     | 
| 
      
 30 
     | 
    
         
            +
            end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            class Array #:nodoc:
         
     | 
| 
      
 33 
     | 
    
         
            +
              alias_method :blank?, :empty?
         
     | 
| 
      
 34 
     | 
    
         
            +
            end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            class Hash #:nodoc:
         
     | 
| 
      
 37 
     | 
    
         
            +
              alias_method :blank?, :empty?
         
     | 
| 
      
 38 
     | 
    
         
            +
            end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
            class String #:nodoc:
         
     | 
| 
      
 41 
     | 
    
         
            +
              def blank?
         
     | 
| 
      
 42 
     | 
    
         
            +
                self !~ /\S/
         
     | 
| 
      
 43 
     | 
    
         
            +
              end
         
     | 
| 
      
 44 
     | 
    
         
            +
            end
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            class Numeric #:nodoc:
         
     | 
| 
      
 47 
     | 
    
         
            +
              def blank?
         
     | 
| 
      
 48 
     | 
    
         
            +
                false
         
     | 
| 
      
 49 
     | 
    
         
            +
              end
         
     | 
| 
      
 50 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/engage/runner.rb
    CHANGED
    
    | 
         @@ -4,6 +4,18 @@ module Engage 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
                argument :name, :optional => true, :desc => "The targeted project name"
         
     | 
| 
       6 
6 
     | 
    
         
             
                class_option :source, :type => :string, :desc => "Adds the given source to the user list."
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                def self.banner
         
     | 
| 
      
 9 
     | 
    
         
            +
                  "USAGE: engage [project] [options]"
         
     | 
| 
      
 10 
     | 
    
         
            +
                end
         
     | 
| 
      
 11 
     | 
    
         
            +
                
         
     | 
| 
      
 12 
     | 
    
         
            +
                def check_parameters
         
     | 
| 
      
 13 
     | 
    
         
            +
                  if name.blank? && options.source.blank?
         
     | 
| 
      
 14 
     | 
    
         
            +
                    say self.class.banner
         
     | 
| 
      
 15 
     | 
    
         
            +
                    say_status 'quitting...', 'no arguments given.', :red
         
     | 
| 
      
 16 
     | 
    
         
            +
                    raise SystemExit
         
     | 
| 
      
 17 
     | 
    
         
            +
                  end
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
       7 
19 
     | 
    
         | 
| 
       8 
20 
     | 
    
         
             
                def clone_repo
         
     | 
| 
       9 
21 
     | 
    
         
             
                  return if adding_source?
         
     | 
| 
         @@ -60,11 +72,11 @@ module Engage 
     | 
|
| 
       60 
72 
     | 
    
         
             
                  end
         
     | 
| 
       61 
73 
     | 
    
         | 
| 
       62 
74 
     | 
    
         
             
                  def adding_source?
         
     | 
| 
       63 
     | 
    
         
            -
                     
     | 
| 
      
 75 
     | 
    
         
            +
                    options.source.present?
         
     | 
| 
       64 
76 
     | 
    
         
             
                  end
         
     | 
| 
       65 
77 
     | 
    
         | 
| 
       66 
78 
     | 
    
         
             
                  def rubyversion
         
     | 
| 
       67 
     | 
    
         
            -
                    `#{ENV["HOME"]}/.rvm/bin/rvm-prompt v 
     | 
| 
      
 79 
     | 
    
         
            +
                    `#{ENV["HOME"]}/.rvm/bin/rvm-prompt v`.strip
         
     | 
| 
       68 
80 
     | 
    
         
             
                  end
         
     | 
| 
       69 
81 
     | 
    
         | 
| 
       70 
82 
     | 
    
         
             
                end
         
     | 
    
        data/lib/engage/version.rb
    CHANGED
    
    
    
        data/lib/engage.rb
    CHANGED
    
    
    
        data/spec/runner_spec.rb
    CHANGED
    
    | 
         @@ -3,6 +3,17 @@ require 'spec_helper' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            describe Engage::Runner do
         
     | 
| 
       4 
4 
     | 
    
         
             
              subject { Engage::Runner.new(["lucasmazza/engage"]) }
         
     | 
| 
       5 
5 
     | 
    
         
             
              before { stub_commands }
         
     | 
| 
      
 6 
     | 
    
         
            +
              
         
     | 
| 
      
 7 
     | 
    
         
            +
              context "without parameters" do
         
     | 
| 
      
 8 
     | 
    
         
            +
                subject { Engage::Runner.new([""]) }
         
     | 
| 
      
 9 
     | 
    
         
            +
                
         
     | 
| 
      
 10 
     | 
    
         
            +
                it "outputs the script banner and quits" do
         
     | 
| 
      
 11 
     | 
    
         
            +
                  subject.should_receive(:say).with(Engage::Runner.banner)
         
     | 
| 
      
 12 
     | 
    
         
            +
                  subject.should_receive(:say_status).with('quitting...', 'no arguments given.', :red)
         
     | 
| 
      
 13 
     | 
    
         
            +
                  lambda { run }.should raise_error SystemExit
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
              end
         
     | 
| 
      
 16 
     | 
    
         
            +
              
         
     | 
| 
       6 
17 
     | 
    
         
             
              context "Starting projects" do
         
     | 
| 
       7 
18 
     | 
    
         | 
| 
       8 
19 
     | 
    
         
             
                context "a full featured project" do
         
     | 
| 
         @@ -65,17 +76,29 @@ describe Engage::Runner do 
     | 
|
| 
       65 
76 
     | 
    
         
             
                  end
         
     | 
| 
       66 
77 
     | 
    
         
             
                end
         
     | 
| 
       67 
78 
     | 
    
         
             
              end
         
     | 
| 
       68 
     | 
    
         
            -
              
         
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
                 
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
                   
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
      
 79 
     | 
    
         
            +
              context "with the --source option" do
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
                context "when passing a new source" do
         
     | 
| 
      
 82 
     | 
    
         
            +
                  subject { Engage::Runner.new(["wrong"], :source => "git@acme.com") }
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
                  it "doesn't trigger any system call" do
         
     | 
| 
      
 85 
     | 
    
         
            +
                    subject.should_not_receive(:system)
         
     | 
| 
      
 86 
     | 
    
         
            +
                    run
         
     | 
| 
      
 87 
     | 
    
         
            +
                  end
         
     | 
| 
      
 88 
     | 
    
         
            +
                  it "adds the given source to the list" do
         
     | 
| 
      
 89 
     | 
    
         
            +
                    run
         
     | 
| 
      
 90 
     | 
    
         
            +
                    subject.sources.should include("git@acme.com")
         
     | 
| 
      
 91 
     | 
    
         
            +
                  end
         
     | 
| 
       75 
92 
     | 
    
         
             
                end
         
     | 
| 
       76 
     | 
    
         
            -
                 
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
                  subject. 
     | 
| 
      
 93 
     | 
    
         
            +
                
         
     | 
| 
      
 94 
     | 
    
         
            +
                context "when passing an already existent source" do
         
     | 
| 
      
 95 
     | 
    
         
            +
                  subject { Engage::Runner.new([], :source => "git@github.com") }
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
                  it "doesn't duplicate the sources" do
         
     | 
| 
      
 98 
     | 
    
         
            +
                    run
         
     | 
| 
      
 99 
     | 
    
         
            +
                    subject.should have(1).sources
         
     | 
| 
      
 100 
     | 
    
         
            +
                  end
         
     | 
| 
       79 
101 
     | 
    
         
             
                end
         
     | 
| 
      
 102 
     | 
    
         
            +
                
         
     | 
| 
       80 
103 
     | 
    
         
             
              end
         
     | 
| 
       81 
104 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,13 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: engage
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              hash:  
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 23
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       6 
6 
     | 
    
         
             
              segments: 
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 0
         
     | 
| 
       8 
8 
     | 
    
         
             
              - 0
         
     | 
| 
       9 
     | 
    
         
            -
              -  
     | 
| 
       10 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 9 
     | 
    
         
            +
              - 4
         
     | 
| 
      
 10 
     | 
    
         
            +
              version: 0.0.4
         
     | 
| 
       11 
11 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       12 
12 
     | 
    
         
             
            authors: 
         
     | 
| 
       13 
13 
     | 
    
         
             
            - Lucas Mazza
         
     | 
| 
         @@ -15,7 +15,7 @@ autorequire: 
     | 
|
| 
       15 
15 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       16 
16 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
            date: 2010-12- 
     | 
| 
      
 18 
     | 
    
         
            +
            date: 2010-12-21 00:00:00 -02:00
         
     | 
| 
       19 
19 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       20 
20 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       21 
21 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -95,6 +95,7 @@ files: 
     | 
|
| 
       95 
95 
     | 
    
         
             
            - bin/engage
         
     | 
| 
       96 
96 
     | 
    
         
             
            - engage.gemspec
         
     | 
| 
       97 
97 
     | 
    
         
             
            - lib/engage.rb
         
     | 
| 
      
 98 
     | 
    
         
            +
            - lib/engage/core_ext/blank.rb
         
     | 
| 
       98 
99 
     | 
    
         
             
            - lib/engage/runner.rb
         
     | 
| 
       99 
100 
     | 
    
         
             
            - lib/engage/version.rb
         
     | 
| 
       100 
101 
     | 
    
         
             
            - spec/helpers.rb
         
     |