engage 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/README.markdown +3 -3
- data/engage.gemspec +1 -0
- data/lib/engage/actions.rb +8 -12
- data/lib/engage/helpers.rb +1 -5
- data/lib/engage/runner.rb +4 -3
- data/lib/engage/version.rb +1 -1
- data/spec/runner_spec.rb +26 -3
- data/spec/spec_helper.rb +3 -1
- metadata +21 -7
data/.gitignore
CHANGED
data/README.markdown
CHANGED
@@ -30,6 +30,6 @@ Behind the curtains, engage will:
|
|
30
30
|
|
31
31
|
### Available Commands
|
32
32
|
|
33
|
-
engage init [PROJECT] # init a new project from one of the registered sources
|
34
|
-
engage add [SOURCE]
|
35
|
-
engage list
|
33
|
+
engage init [PROJECT] [DIRECTORY] # init a new project from one of the registered sources
|
34
|
+
engage add [SOURCE] # register the given source to `~/.engage.sources`
|
35
|
+
engage list # list all the registered sources
|
data/engage.gemspec
CHANGED
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.add_development_dependency "bundler", "~> 1.0"
|
18
18
|
s.add_development_dependency "rspec", "~> 2.3"
|
19
19
|
s.add_development_dependency "fakefs"
|
20
|
+
s.add_development_dependency "simplecov"
|
20
21
|
s.add_runtime_dependency "thor", "~> 0.14"
|
21
22
|
|
22
23
|
s.files = `git ls-files`.split("\n")
|
data/lib/engage/actions.rb
CHANGED
@@ -4,7 +4,7 @@ module Engage
|
|
4
4
|
|
5
5
|
def clone_repo
|
6
6
|
source = ask_for_source
|
7
|
-
run "git clone #{source}:#{project}.git"
|
7
|
+
run "git clone #{source}:#{project}.git #{target_folder}"
|
8
8
|
end
|
9
9
|
|
10
10
|
def setup_rvm
|
@@ -14,19 +14,19 @@ module Engage
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def create_gemset
|
17
|
-
run "rvm gemset create #{
|
17
|
+
run "rvm gemset create #{target_folder}"
|
18
18
|
end
|
19
19
|
|
20
20
|
def create_rvmrc
|
21
|
-
create_file "#{
|
21
|
+
create_file "#{target_folder}/.rvmrc", rvm_env
|
22
22
|
end
|
23
23
|
|
24
24
|
def trust_rvmrc
|
25
|
-
run "rvm rvmrc trust #{
|
25
|
+
run "rvm rvmrc trust #{target_folder}"
|
26
26
|
end
|
27
27
|
|
28
28
|
def run_bundler
|
29
|
-
run "cd #{
|
29
|
+
run "cd #{target_folder} && #{rvm_env} exec bundle"
|
30
30
|
end
|
31
31
|
|
32
32
|
protected
|
@@ -34,19 +34,15 @@ module Engage
|
|
34
34
|
def ask_for_source
|
35
35
|
return sources.first if sources.size == 1
|
36
36
|
list
|
37
|
-
sources[ask("Select the git source of '#{
|
37
|
+
sources[ask("Select the git source of '#{target_folder}':").to_i]
|
38
38
|
end
|
39
39
|
|
40
40
|
def rvm_env
|
41
|
-
"rvm #{
|
42
|
-
end
|
43
|
-
|
44
|
-
def current_ruby
|
45
|
-
`rvm-prompt v`.strip
|
41
|
+
"rvm #{RUBY_VERSION}@#{target_folder}"
|
46
42
|
end
|
47
43
|
|
48
44
|
def using_bundler?
|
49
|
-
File.exists?(File.join(
|
45
|
+
File.exists?(File.join(target_folder, "Gemfile"))
|
50
46
|
end
|
51
47
|
end
|
52
48
|
end
|
data/lib/engage/helpers.rb
CHANGED
@@ -1,10 +1,6 @@
|
|
1
1
|
module Engage
|
2
2
|
module Helpers
|
3
3
|
|
4
|
-
def folder_name
|
5
|
-
project.split("/").last
|
6
|
-
end
|
7
|
-
|
8
4
|
def file_path
|
9
5
|
File.join(ENV["HOME"], ".engage.sources")
|
10
6
|
end
|
@@ -14,7 +10,7 @@ module Engage
|
|
14
10
|
end
|
15
11
|
|
16
12
|
def sources_table
|
17
|
-
sources.each_with_index.map { |line| line.reverse }
|
13
|
+
sources.each_with_index.to_a.map { |line| line.reverse }
|
18
14
|
end
|
19
15
|
|
20
16
|
def default_sources
|
data/lib/engage/runner.rb
CHANGED
@@ -6,11 +6,12 @@ module Engage
|
|
6
6
|
include Engage::Actions
|
7
7
|
include Engage::Helpers
|
8
8
|
|
9
|
-
attr_accessor :project
|
9
|
+
attr_accessor :project, :target_folder
|
10
10
|
|
11
|
-
desc "init [PROJECT]", "init a new project from one of the registered sources"
|
12
|
-
def init(project)
|
11
|
+
desc "init [PROJECT] [DIRECTORY]", "init a new project from one of the registered sources"
|
12
|
+
def init(project, dir = nil)
|
13
13
|
self.project = project
|
14
|
+
self.target_folder = dir || project.split("/").last
|
14
15
|
clone_repo
|
15
16
|
setup_rvm
|
16
17
|
run_bundler if using_bundler?
|
data/lib/engage/version.rb
CHANGED
data/spec/runner_spec.rb
CHANGED
@@ -10,7 +10,7 @@ describe Engage::Runner do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it "clones the git repository" do
|
13
|
-
expect_command "git clone git@github.com:lucasmazza/engage.git"
|
13
|
+
expect_command "git clone git@github.com:lucasmazza/engage.git engage"
|
14
14
|
subject.init('lucasmazza/engage')
|
15
15
|
end
|
16
16
|
|
@@ -30,7 +30,7 @@ describe Engage::Runner do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it "runs the `bundle` command" do
|
33
|
-
expect_command "cd skynet && rvm
|
33
|
+
expect_command "cd skynet && rvm #{RUBY_VERSION}@skynet exec bundle"
|
34
34
|
subject.init("cyberdyne/skynet")
|
35
35
|
end
|
36
36
|
end
|
@@ -70,10 +70,33 @@ describe Engage::Runner do
|
|
70
70
|
end
|
71
71
|
|
72
72
|
it "clones from the selected source" do
|
73
|
-
expect_command "git clone git@omgwtfbbq.com:rails/rails.git"
|
73
|
+
expect_command "git clone git@omgwtfbbq.com:rails/rails.git rails"
|
74
74
|
subject.init('rails/rails')
|
75
75
|
end
|
76
76
|
end
|
77
|
+
|
78
|
+
context "when we're pointing to another directory to use" do
|
79
|
+
before do
|
80
|
+
subject.stub(:using_bundler?) { true }
|
81
|
+
end
|
82
|
+
|
83
|
+
it "clones to the given directory" do
|
84
|
+
expect_command "git clone git@github.com:rails/rails.git zomg_rails"
|
85
|
+
subject.init('rails/rails', 'zomg_rails')
|
86
|
+
end
|
87
|
+
it "creates a `.rvmrc` file inside the given directory" do
|
88
|
+
expect_command "rvm gemset create zomg_rails"
|
89
|
+
subject.init('rails/rails', 'zomg_rails')
|
90
|
+
end
|
91
|
+
it "trusts the created `.rvmrc` inside the given directory" do
|
92
|
+
expect_command "rvm rvmrc trust zomg_rails"
|
93
|
+
subject.init('rails/rails', 'zomg_rails')
|
94
|
+
end
|
95
|
+
it "runs the `bundle` command on the given directory" do
|
96
|
+
expect_command "cd zomg_rails && rvm #{RUBY_VERSION}@zomg_rails exec bundle"
|
97
|
+
subject.init('rails/rails', 'zomg_rails')
|
98
|
+
end
|
99
|
+
end
|
77
100
|
end
|
78
101
|
|
79
102
|
describe "#list" do
|
data/spec/spec_helper.rb
CHANGED
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: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
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: 2011-01-
|
18
|
+
date: 2011-01-26 00:00:00 -02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -63,9 +63,23 @@ dependencies:
|
|
63
63
|
type: :development
|
64
64
|
version_requirements: *id003
|
65
65
|
- !ruby/object:Gem::Dependency
|
66
|
-
name:
|
66
|
+
name: simplecov
|
67
67
|
prerelease: false
|
68
68
|
requirement: &id004 !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
hash: 3
|
74
|
+
segments:
|
75
|
+
- 0
|
76
|
+
version: "0"
|
77
|
+
type: :development
|
78
|
+
version_requirements: *id004
|
79
|
+
- !ruby/object:Gem::Dependency
|
80
|
+
name: thor
|
81
|
+
prerelease: false
|
82
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
69
83
|
none: false
|
70
84
|
requirements:
|
71
85
|
- - ~>
|
@@ -76,7 +90,7 @@ dependencies:
|
|
76
90
|
- 14
|
77
91
|
version: "0.14"
|
78
92
|
type: :runtime
|
79
|
-
version_requirements: *
|
93
|
+
version_requirements: *id005
|
80
94
|
description: Engage is a CLI for rapid bootstrap for your ruby apps using Git, RVM and Bundler.
|
81
95
|
email:
|
82
96
|
- luc4smazza@gmail.com
|
@@ -133,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
147
|
requirements: []
|
134
148
|
|
135
149
|
rubyforge_project: engage
|
136
|
-
rubygems_version: 1.4.
|
150
|
+
rubygems_version: 1.4.2
|
137
151
|
signing_key:
|
138
152
|
specification_version: 3
|
139
153
|
summary: Quick setup for your ruby apps
|