mechanic 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1 +1,35 @@
1
+ #!/usr/bin/env rake
1
2
  require "bundler/gem_tasks"
3
+
4
+ begin
5
+ require 'rdoc/task'
6
+ rescue LoadError
7
+ require 'rdoc/rdoc'
8
+ require 'rake/rdoctask'
9
+ RDoc::Task = Rake::RDocTask
10
+ end
11
+
12
+ RDoc::Task.new(:rdoc) do |rdoc|
13
+ rdoc.rdoc_dir = 'rdoc'
14
+ rdoc.title = 'Mechanic'
15
+ rdoc.options << '--line-numbers'
16
+ rdoc.rdoc_files.include('README.md')
17
+ rdoc.rdoc_files.include('lib/**/*.rb')
18
+ end
19
+
20
+ require "cucumber/rake/task"
21
+
22
+ Cucumber::Rake::Task.new(:cucumber) do |task|
23
+ task.cucumber_opts = ["features --format pretty --backtrace"]
24
+ end
25
+
26
+ task :travis do
27
+ ["rake cucumber"].each do |cmd|
28
+ puts "Starting to run #{cmd}..."
29
+ system("export DISPLAY=:99.0 && bundle exec #{cmd}")
30
+ raise "#{cmd} failed!" unless $?.exitstatus == 0
31
+ end
32
+ end
33
+
34
+ task :default => :travis
35
+
@@ -0,0 +1,8 @@
1
+ @disable-bundler
2
+ Feature: Creating a Github repo
3
+
4
+ Scenario: --github=organization/project
5
+ When I take a project called "test_project" to the mechanic with:
6
+ | argument | value |
7
+ | --github | organization/project |
8
+ Then the "organization/project" Github repo should exist
@@ -0,0 +1,21 @@
1
+ @disable-bundler
2
+ Feature: Rake works in the project taken to the mechanic
3
+
4
+ Scenario: Running rake in the project taken to the mechanic
5
+ When I take a project called "test_project" to the mechanic
6
+ And I cd to the "test_project" root
7
+ When I drop and create the required databases
8
+ And I run the rake task "db:create"
9
+ And I run the rake task "db:migrate"
10
+ And I run the rake task "db:test:prepare"
11
+ And I run rake
12
+ Then I see a successful response in the shell
13
+
14
+ Scenario: Making a spec then running rake
15
+ When I drop and create the required databases
16
+ And I take a project called "test_project" to the mechanic
17
+ And I generate "model post title:string"
18
+ And I run the rake task "db:migrate"
19
+ And I run the rake task "db:test:prepare"
20
+ And I run the rake task "spec"
21
+ Then I see a successful response in the shell
@@ -0,0 +1,75 @@
1
+ require 'aruba/cucumber'
2
+
3
+ When 'I run rake' do
4
+ in_current_dir do
5
+ run 'bundle exec rake'
6
+ end
7
+ end
8
+
9
+ When 'I run the rake task "$task_name"' do |task_name|
10
+ in_current_dir do
11
+ run "bundle exec rake #{task_name}"
12
+ end
13
+ end
14
+
15
+ When 'I generate "$generator_with_args"' do |generator_with_args|
16
+ in_current_dir do
17
+ run "bundle exec rails generate #{generator_with_args}"
18
+ end
19
+ end
20
+
21
+ Then 'I see a successful response in the shell' do
22
+ assert_exit_status(0)
23
+ end
24
+
25
+ When 'I drop and create the required databases' do
26
+ in_current_dir do
27
+ run 'bundle exec rake db:drop RAILS_ENV=test'
28
+ run 'bundle exec rake db:drop'
29
+ run 'bundle exec rake db:create RAILS_ENV=test'
30
+ run 'bundle exec rake db:create'
31
+ end
32
+ end
33
+
34
+ When 'I take a project called "$project_name" to the mechanic' do |project_name|
35
+ mechanic_bin = File.expand_path(File.join('..', '..', 'bin', 'mechanic'), File.dirname(__FILE__))
36
+ run "#{mechanic_bin} #{project_name}"
37
+ assert_exit_status(0)
38
+ end
39
+
40
+ When /^I take a project called "([^"]*)" to the mechanic with:$/ do |project_name, arguments_table|
41
+ mechanic_bin = File.expand_path(File.join('..', '..', 'bin', 'mechanic'), File.dirname(__FILE__))
42
+ arguments = arguments_table.hashes.inject([]) do |accum, argument|
43
+ accum << "#{argument['argument']}=#{argument['value']}"
44
+ end.join
45
+ run "#{mechanic_bin} #{project_name} #{arguments}"
46
+ assert_exit_status(0)
47
+ end
48
+
49
+ When 'I cd to the "$test_project" root' do |dirname|
50
+ cd dirname
51
+ end
52
+
53
+ Then 'I can cleanly rake the project' do
54
+ steps %{
55
+ And I run the rake task "db:create"
56
+ And I run the rake task "db:migrate"
57
+ And I run the rake task "db:test:prepare"
58
+ And I run the rake task "cucumber"
59
+ Then I see a successful response in the shell
60
+ }
61
+ end
62
+
63
+ Then /^"(.*)" should not be installed$/ do |gem_name|
64
+ in_current_dir do
65
+ system("bundle show #{gem_name} 2>&1 > /dev/null").should be_false
66
+ end
67
+ end
68
+
69
+ Then /^"(.*)" should not be included in "(.*)"$/ do |content, file_path|
70
+ check_file_content file_path, content, false
71
+ end
72
+
73
+ Then /^the "([^"]*)" Github repo should exist$/ do |repo_name|
74
+ FakeGithub.should have_created_repo(repo_name)
75
+ end
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.expand_path(File.join('..', '..', 'support', 'fake_github'), File.dirname(__FILE__))
4
+
5
+ FakeGithub.new(ARGV).run!
@@ -0,0 +1,9 @@
1
+ Before do
2
+ ENV['TESTING'] = 'true'
3
+ @aruba_timeout_seconds = 560
4
+ end
5
+
6
+ After do
7
+ FakeGithub.clear!
8
+ FileUtils.rm_rf 'test_project'
9
+ end
@@ -0,0 +1,21 @@
1
+ class FakeGithub
2
+ RECORDER = File.expand_path(File.join('..', '..', 'tmp', 'hub_commands'), File.dirname(__FILE__))
3
+
4
+ def initialize(args)
5
+ @args = args
6
+ end
7
+
8
+ def run!
9
+ File.open(RECORDER, 'a') do |file|
10
+ file.write @args.join(' ')
11
+ end
12
+ end
13
+
14
+ def self.clear!
15
+ FileUtils.rm_rf RECORDER
16
+ end
17
+
18
+ def self.has_created_repo?(repo_name)
19
+ File.open(RECORDER, 'r').read.include?("create #{repo_name}")
20
+ end
21
+ end
@@ -0,0 +1,11 @@
1
+ @disable-bundler
2
+ Feature: Skipping Capybara Webkit
3
+
4
+ Scenario: --webkit=false
5
+ When I take a project called "test_project" to the mechanic with:
6
+ | argument | value |
7
+ | --webkit | false |
8
+ And I cd to the "test_project" root
9
+ Then "capybara-webkit" should not be installed
10
+ And "webkit" should not be included in "spec/spec_helper.rb"
11
+ And I can cleanly rake the project
@@ -1,3 +1,3 @@
1
1
  module Mechanic
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -26,6 +26,6 @@ Gem::Specification.new do |gem|
26
26
  gem.add_dependency 'bundler', '>= 1.1'
27
27
  gem.add_dependency 'hub', '~> 1.10.2'
28
28
 
29
- gem.add_development_dependency 'cucumber', '~> 1.1.9'
29
+ gem.add_development_dependency 'cucumber-rails'
30
30
  gem.add_development_dependency 'aruba', '~> 0.4.11'
31
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mechanic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -60,21 +60,21 @@ dependencies:
60
60
  - !ruby/object:Gem::Version
61
61
  version: 1.10.2
62
62
  - !ruby/object:Gem::Dependency
63
- name: cucumber
63
+ name: cucumber-rails
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  none: false
66
66
  requirements:
67
- - - ~>
67
+ - - ! '>='
68
68
  - !ruby/object:Gem::Version
69
- version: 1.1.9
69
+ version: '0'
70
70
  type: :development
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
- - - ~>
75
+ - - ! '>='
76
76
  - !ruby/object:Gem::Version
77
- version: 1.1.9
77
+ version: '0'
78
78
  - !ruby/object:Gem::Dependency
79
79
  name: aruba
80
80
  requirement: !ruby/object:Gem::Requirement
@@ -105,6 +105,13 @@ files:
105
105
  - README.md
106
106
  - Rakefile
107
107
  - bin/mechanic
108
+ - features/github_repo.feature
109
+ - features/rake_clean.feature
110
+ - features/step_definitions/suspenders_steps.rb
111
+ - features/support/bin/hub
112
+ - features/support/env.rb
113
+ - features/support/fake_github.rb
114
+ - features/webkit_false.feature
108
115
  - lib/mechanic.rb
109
116
  - lib/mechanic/actions.rb
110
117
  - lib/mechanic/engine_builder.rb
@@ -130,16 +137,29 @@ required_ruby_version: !ruby/object:Gem::Requirement
130
137
  - - ! '>='
131
138
  - !ruby/object:Gem::Version
132
139
  version: '0'
140
+ segments:
141
+ - 0
142
+ hash: 3386309494972885241
133
143
  required_rubygems_version: !ruby/object:Gem::Requirement
134
144
  none: false
135
145
  requirements:
136
146
  - - ! '>='
137
147
  - !ruby/object:Gem::Version
138
148
  version: '0'
149
+ segments:
150
+ - 0
151
+ hash: 3386309494972885241
139
152
  requirements: []
140
153
  rubyforge_project:
141
154
  rubygems_version: 1.8.24
142
155
  signing_key:
143
156
  specification_version: 3
144
157
  summary: Mechanic creates engines the Group Buddies way.
145
- test_files: []
158
+ test_files:
159
+ - features/github_repo.feature
160
+ - features/rake_clean.feature
161
+ - features/step_definitions/suspenders_steps.rb
162
+ - features/support/bin/hub
163
+ - features/support/env.rb
164
+ - features/support/fake_github.rb
165
+ - features/webkit_false.feature