dtf-rvm 0.0.1

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/.gitignore ADDED
@@ -0,0 +1,44 @@
1
+ .project
2
+ *~
3
+ .config
4
+ pmip/**/*
5
+ .idea/**/*
6
+ *.log
7
+ pkg
8
+ .yardoc
9
+ dtf.sublime-workspace
10
+ _yardoc
11
+ tmp
12
+ Thumbs.db
13
+ *.bak
14
+ .iws
15
+ pmip
16
+ .DS_Store
17
+ *.rbc
18
+ .svn/
19
+ *.gem
20
+ InstalledFiles
21
+ Gemfile.lock
22
+ rdoc
23
+ dtf.sublime-project
24
+ *.swp
25
+ lib/bundler/man
26
+ .bundle
27
+ ~*
28
+ coverage
29
+ coverage.data
30
+ .*proj
31
+ *.iml
32
+ .idea/
33
+ *.patch
34
+ spec/reports
35
+ .idea
36
+ node_modules/
37
+ /db/*.sqlite3
38
+ .classpath
39
+ target/
40
+ .settings/
41
+ test/version_tmp
42
+ *.diff
43
+ .ipr
44
+ test/tmp
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color --format doc
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm --install --create use 1.9.3-p286@dtf-rvm
data/.travis.yml ADDED
@@ -0,0 +1,35 @@
1
+ language: ruby
2
+ branches:
3
+ only:
4
+ - master
5
+ - stable
6
+ rvm:
7
+ - 1.9.2
8
+ - 1.9.3
9
+ matrix:
10
+ allow_failures:
11
+ - rvm: 1.9.2
12
+ env:
13
+ global:
14
+ RAILS_ENV='test'
15
+ before_install:
16
+ - gem update bundler
17
+ install:
18
+ - bundle install --without development
19
+ before_script:
20
+ - bundle exec gem list
21
+ - bundle exec rake dtf:install
22
+ - bundle exec thor dtf_setup:install
23
+ script: bundle exec rspec spec --profile
24
+ after_script: RAILS_ENV='production' gem build dtf-rvm.gemspec
25
+ notifications:
26
+ irc:
27
+ channels:
28
+ - "irc.freenode.org#pgpkeys"
29
+ on_failure: always
30
+ on_success: always
31
+ email:
32
+ recipients:
33
+ - me@daviddwdowney.com
34
+ on_failure: always
35
+ on_success: always
data/Gemfile ADDED
@@ -0,0 +1,32 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in dtf-session.gemspec
4
+ group :development do
5
+ gem 'debugger'
6
+ gem 'pry'
7
+ gem 'pry-doc'
8
+ gem 'pry-debugger'
9
+ gem "pry-git"
10
+ gem "pry-developer_tools"
11
+ gem "pry-syntax-hacks"
12
+ gem "pry-editline"
13
+ gem "pry-highlight"
14
+ gem "pry-buffers"
15
+ gem "pry-stack_explorer"
16
+ gem "pry-exception_explorer"
17
+ gem "jist"
18
+ gem "pry-theme"
19
+ gem 'travis-lint'
20
+ gem 'rspec-formatter-webkit'
21
+ end
22
+
23
+ group :test do
24
+ gem 'rspec'
25
+ gem 'rspec-given'
26
+ gem 'fabrication'
27
+ gem 'cover_me'
28
+ gem 'database_cleaner'
29
+ gem 'simplecov'
30
+ end
31
+
32
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 David Deryl Downey
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,110 @@
1
+ [![Build Status](https://travis-ci.org/dtf-gems/dtf-rvm.png)](https://travis-ci.org/dtf-gems/dtf-rvm)
2
+ [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/dtf-gems/dtf-rvm)
3
+
4
+ # Deryls Testing Framework
5
+
6
+ DTF is designed to be a modular framework for testing everything from shell scripts, to Ruby, to Rails apps.
7
+
8
+ DTF is an umbrella which is designed to incorporate multiple sub-gems, each of which provides additional
9
+ functionality to DTF. DTF is the master skeleton within which all other dtf-* gems integrate.
10
+
11
+ ## Internal architecture
12
+
13
+ DTF is designed in such a way that, with the master skeleton in place, one has only to load additional plugins
14
+ from any available DTF extension gem to add additional functionality. This can be anything ranging from
15
+ additional languages such as Ruby, Python, C, C++, etc, to testing methods and methodologies.
16
+
17
+ ## DTF-RVM Gem
18
+
19
+ 'dtf-rvm' gem is part of the DTF <dtf-gems.deryldoucette.com> framework, and
20
+ is designed to integrate RVM <https://rvm.io> into the DTF family.
21
+
22
+ ## Installation
23
+ There are several ways to install, and configure the 'dtf-rvm' gem.
24
+
25
+ 1) You would run ```gem install dtf-rvm```, and once installed, run ```rake dtf:install``` to
26
+ install the DTF baseline thor task(s).
27
+
28
+ 2) You would include the gem in your project's Gemfile and ```bundle install```. Once installed,
29
+ you would then run ```rake dtf:install``` to install the DTF baseline thor task(s).
30
+
31
+ In both instances, you would continue on with the following instructions.
32
+
33
+ DTF uses Thor for setup and configuration, and has 3 possible sub-tasks under task name 'dtf_setup':
34
+
35
+ ```sh
36
+ ∴ thor list
37
+ dtf_setup
38
+ ---------
39
+ thor dtf_setup:config [NAME] # Copy db configuration file(s)
40
+ thor dtf_setup:install # Installs database migrations, the main schema, and configuration files
41
+ ```
42
+
43
+ As you can see, you can copy just the db config files, and/or the migrations, and main schema.
44
+
45
+ ```sh
46
+ ∴ thor help dtf_setup
47
+ Tasks:
48
+ thor dtf_setup:config [NAME] # Copy db configuration file(s)
49
+ thor dtf_setup:help [TASK] # Describe available tasks or one specific task
50
+ thor dtf_setup:install # Installs database migrations, the main schema, and configuration files
51
+ ```
52
+
53
+ To see how to install everything you would run the following command:
54
+
55
+ ```sh
56
+ ∴ thor dtf_setup:help install
57
+ Usage:
58
+ thor dtf_setup:install
59
+
60
+ Options:
61
+ [--force]
62
+
63
+ Installs database migrations, the main schema, and configuration files
64
+ ```
65
+
66
+ To see how to install just the configuration files for accessing the database(s), you would run:
67
+
68
+ ```sh
69
+ ∴ thor dtf_setup:help config
70
+ Usage:
71
+ thor dtf_setup:config [NAME]
72
+
73
+ Options:
74
+ [--force]
75
+
76
+ Copy db configuration file(s)
77
+ ```
78
+
79
+ Once the configuration files and/or database migrations are in place, the remaining setup is handled by 'rake'.
80
+ To see all possible commands, you would run 'rake -T', and pick the one(s) you need.
81
+
82
+ ```sh
83
+ ∴ rake -T
84
+ rake build # Build dtf-0.2.2.gem into the pkg directory
85
+ rake db:create # Create the database from config/database.yml for the current Rails.env (use db:create:all to create all dbs i...
86
+ rake db:drop # Drops the database for the current Rails.env (use db:drop:all to drop all databases)
87
+ rake db:fixtures:load # Load fixtures into the current environment's database.
88
+ rake db:migrate # Migrate the database (options: VERSION=x, VERBOSE=false).
89
+ rake db:migrate:status # Display status of migrations
90
+ rake db:new_migration # Create a new migration
91
+ rake db:rollback # Rolls the schema back to the previous version (specify steps w/ STEP=n).
92
+ rake db:schema:dump # Create a db/schema.rb file that can be portably used against any DB supported by AR
93
+ rake db:schema:load # Load a schema.rb file into the database
94
+ rake db:seed # Load the seed data from db/seeds.rb
95
+ rake db:setup # Create the database, load the schema, and initialize with the seed data (use db:reset to also drop the db first)
96
+ rake db:structure:dump # Dump the database structure to db/structure.sql. Specify another file with DB_STRUCTURE=db/my_structure.sql
97
+ rake db:version # Retrieves the current schema version number
98
+ rake install # Build and install dtf-0.2.2.gem into system gems
99
+ rake release # Create tag v0.2.2 and build and push dtf-0.2.2.gem to Rubygems
100
+ ```
101
+
102
+
103
+ ## Usage
104
+ Once you have finished configuring your database(s) and applying all migrations, you are now ready to work with
105
+ DTF directly. The following is a summary of all current possible commands, and their expected options/parameters:
106
+
107
+ ** STILL TO BE WRITTEN ***
108
+
109
+ --
110
+ Enjoy!
data/Rakefile ADDED
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env rake
2
+ # encoding: UTF-8
3
+
4
+ require "bundler/gem_tasks"
5
+
6
+ begin
7
+ require 'tasks/standalone_migrations'
8
+ rescue LoadError => e
9
+ puts "gem install standalone_migrations to get db:migrate:* tasks! (Error: #{e})"
10
+ end
11
+
12
+ namespace :cover_me do
13
+
14
+ desc "Generates and opens code coverage report."
15
+ task :report do
16
+ require 'cover_me'
17
+ CoverMe.complete!
18
+ end
19
+
20
+ end
21
+
22
+ task :test do
23
+ Rake::Task['cover_me:report'].invoke
24
+ end
25
+
26
+ task :spec do
27
+ Rake::Task['cover_me:report'].invoke
28
+ end
29
+
30
+ namespace :dtf do
31
+
32
+ desc "Install DTF thor tasks"
33
+ task :install do
34
+ require 'dtf'
35
+ puts "Installing DTF tasks"
36
+ FileUtils.cp(Dir.glob("#{File.join("#{Gem.loaded_specs['dtf'].gem_dir}", 'lib/tasks/*')}"), 'lib/tasks/')
37
+ end
38
+ end
39
+
@@ -0,0 +1,15 @@
1
+ # encoding: UTF-8
2
+
3
+ # AnalysisCase defines the 'test premise', which is broken down into steps called CaseTests
4
+ #
5
+ # AnalysisCases own CaseTests. Users own each CaseTest through its AnalysisCase
6
+ class AnalysisCase < ActiveRecord::Base
7
+
8
+ attr_accessible :name, :description
9
+ validates_presence_of :name, :description
10
+
11
+ belongs_to :verification_suite, :autosave => :true
12
+ belongs_to :user, :autosave => :true
13
+ has_many :case_tests, :dependent => :destroy
14
+
15
+ end
@@ -0,0 +1,11 @@
1
+ # encoding: UTF-8
2
+
3
+ # CaseTest is the recording of each individual step of an AnalysisCase's 'test premise'
4
+ class CaseTest < ActiveRecord::Base
5
+
6
+ attr_accessible :description, :cmd
7
+ validates_presence_of :description, :cmd
8
+
9
+ belongs_to :analysis_case, :autosave => :true
10
+ has_one :verification_suite, :through => :analysis_case, :autosave => :true
11
+ end
@@ -0,0 +1,14 @@
1
+ # encoding: UTF-8
2
+
3
+ # User class owns all Verification Suites in the DTF system
4
+ class User < ActiveRecord::Base
5
+
6
+ attr_accessible :full_name, :email_address, :user_name
7
+ validates :full_name, :email_address, :user_name, :presence => true
8
+ validates :user_name, :email_address, :uniqueness => true
9
+
10
+ has_many :verification_suites, :dependent => :destroy
11
+ has_many :analysis_cases, :through => :verification_suites, :dependent => :destroy
12
+ has_many :case_tests, :through => :verification_suites, :dependent => :destroy
13
+
14
+ end
@@ -0,0 +1,23 @@
1
+ # encoding: UTF-8
2
+
3
+ # VerificationSuite is the core container class.
4
+ #
5
+ # ASSOCIATIONS BREAKDOWN: It contains many AnalysisCases. Each AnalysisCase contains
6
+ # multiple case_tests, owned by both the User and the AnalysisCase. The goal is to
7
+ # make 'packs' of tests which Users can share between Suites, grouped by Cases, and
8
+ # even share those Tests between Cases.
9
+ #
10
+ # Also, Users should be able to share their individual Test(s), AnalysisCase(s), through
11
+ # their VerificationSuite(s) with other Users for inclusion in their own AnalysisCase(s)
12
+ # and Suite(s) allowing for mix-and-match batching.
13
+
14
+ class VerificationSuite < ActiveRecord::Base
15
+
16
+ attr_accessible :name, :description
17
+ validates_presence_of :name, :description
18
+
19
+ belongs_to :user, :autosave => :true
20
+ has_many :analysis_cases, :dependent => :destroy
21
+ has_many :case_tests, :through => :analysis_cases, :dependent => :destroy
22
+
23
+ end
data/db/config.yml ADDED
@@ -0,0 +1,25 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ development:
7
+ adapter: sqlite3
8
+ database: db/dtf_rvm_development.sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ # Warning: The database defined as "test" will be erased and
13
+ # re-generated from your development database when you run "rake".
14
+ # Do not set this db to the same as development or production.
15
+ test:
16
+ adapter: sqlite3
17
+ database: db/dtf_rvm_test.sqlite3
18
+ pool: 5
19
+ timeout: 5000
20
+
21
+ production:
22
+ adapter: sqlite3
23
+ database: db/dtf_rvm_production.sqlite3
24
+ pool: 5
25
+ timeout: 5000
File without changes
data/db/schema.rb ADDED
@@ -0,0 +1,48 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended to check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(:version => 20120616203436) do
15
+
16
+ create_table "analysis_cases", :force => true do |t|
17
+ t.string "name"
18
+ t.string "description"
19
+ t.integer "verification_suite_id"
20
+ t.datetime "created_at", :null => false
21
+ t.datetime "updated_at", :null => false
22
+ end
23
+
24
+ create_table "case_tests", :force => true do |t|
25
+ t.string "description"
26
+ t.text "cmd"
27
+ t.integer "analysis_case_id"
28
+ t.datetime "created_at", :null => false
29
+ t.datetime "updated_at", :null => false
30
+ end
31
+
32
+ create_table "users", :force => true do |t|
33
+ t.string "full_name"
34
+ t.string "user_name"
35
+ t.string "email_address"
36
+ t.datetime "created_at", :null => false
37
+ t.datetime "updated_at", :null => false
38
+ end
39
+
40
+ create_table "verification_suites", :force => true do |t|
41
+ t.string "name"
42
+ t.text "description"
43
+ t.integer "user_id"
44
+ t.datetime "created_at", :null => false
45
+ t.datetime "updated_at", :null => false
46
+ end
47
+
48
+ end
data/db/seeds.rb ADDED
@@ -0,0 +1,4 @@
1
+ # encoding: UTF-8
2
+ require 'dtf-rvm'
3
+
4
+ User.create(full_name: "Library Owner", email_address: "library_owner@localhost.lan", user_name: "library_owner")
data/dtf-rvm.gemspec ADDED
@@ -0,0 +1,31 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'dtf-rvm/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "dtf-rvm"
8
+ gem.version = Dtf::Rvm::VERSION
9
+ gem.authors = ["David Deryl Downey"]
10
+ gem.email = ["me@daviddwdowney.com"]
11
+ gem.description = %q{DTF gem integrating RVM into DTF}
12
+ gem.summary = %q{DTF-RVM is a DTF sub-gem integrating RVM into the DTF platform}
13
+ gem.homepage = "https://dtf-gems.daviddwdowney.com/dtf-rvm"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+ gem.required_ruby_version = '>= 1.9.2'
20
+
21
+ gem.add_dependency("dtf")
22
+ gem.add_dependency("rake")
23
+ gem.add_dependency "sqlite3"
24
+ gem.add_dependency "json"
25
+ gem.add_dependency "json_pure"
26
+
27
+ gem.add_development_dependency "rspec"
28
+ gem.add_development_dependency "fabrication"
29
+ gem.add_development_dependency "yard" # For generating documentation
30
+ gem.add_development_dependency "redcarpet" # For generating YARD docs
31
+ end
@@ -0,0 +1,34 @@
1
+ # encoding: UTF-8
2
+
3
+ # Application wide requirements
4
+ require 'active_record'
5
+ require 'active_model'
6
+ require 'active_support'
7
+ require 'multi_json'
8
+ require 'sqlite3'
9
+ require 'yaml'
10
+ require 'logger'
11
+ require 'thor'
12
+
13
+ # NOTE: Set RAILS_ENV to 'production' for ActiveRecord. Affects the database to use.
14
+ # Change this to 'development' while working on the gem itself, or set it in the
15
+ # environment prefixed to commands, in order to gain access to testing gems.
16
+ ENV['RAILS_ENV'] ||= 'development'
17
+
18
+ # Load the db config and create a connectoid. Make an ivar so its shared throughout the application
19
+ if ENV['RAILS_ENV'] == 'test' then
20
+ ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:'
21
+ puts "NOTICE: Loading db schema to IN-MEMORY SQLite3 db"
22
+ load "#{File.join(File.dirname(__FILE__), '../../db/schema.rb')}"
23
+ else
24
+ @dbconfig = YAML::load(File.open(File.join(File.dirname(__FILE__), '../../db/config.yml')))[ENV['RAILS_ENV']]
25
+ # Establish the database connection
26
+ puts "NOTICE: Loading db schema to ON-DISK SQLite3 db"
27
+ ActiveRecord::Base.establish_connection(@dbconfig) # Line that actually connects the db.
28
+ end
29
+
30
+ # Load all the models
31
+ Dir["#{File.join(File.dirname(__FILE__), '../../app/models/*.rb')}"].each do |model|
32
+ load "#{model}"
33
+ end
34
+
data/lib/dtf-rvm.rb ADDED
@@ -0,0 +1,9 @@
1
+ require "dtf-rvm/version"
2
+
3
+ module Dtf
4
+ load "#{File.join(File.dirname(__FILE__), "/config/environment.rb")}"
5
+
6
+ module Rvm
7
+ # Your code goes here...
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ module Dtf
2
+ module Rvm
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,75 @@
1
+ # encoding: UTF-8
2
+
3
+ class DtfSetup < Thor
4
+
5
+ desc "install", "Installs DTF core database migrations"
6
+ method_options :force => :boolean
7
+ def install(name= "*")
8
+ puts "Installing db migrations, main schema, and config files"
9
+
10
+ # The gem is installed elsewhere so the copy path needs to be
11
+ # relative to the gem, not the user. Gem.loaded_specs['dtf'].gemdir
12
+ # tells us where the DTF master gem lives and we need to build up the from location
13
+ # based off that, then copy locally relative to the user.
14
+ #
15
+ # Migrations
16
+ from_dir = "#{File.join("#{Gem.loaded_specs['dtf'].gem_dir}", 'db/migrate')}"
17
+ # Add schema.rb to list of additional files to be pushed
18
+ other_files = ["#{from_dir}/../schema.rb"]
19
+ # Since the models may change in DTF, copy them over as well. This ensures all sub-gems have current models.
20
+ models_dir = "#{File.join("#{Gem.loaded_specs['dtf'].gem_dir}", 'app/models')}"
21
+
22
+ Dir["#{models_dir}/#{name}"].each do |model|
23
+ puts "Generating app/models/#{File.basename(model)}"
24
+ FileUtils.cp(model, "#{Dir.pwd}/app/models/#{File.basename(model)}" )
25
+ end
26
+
27
+ other_files.each do |source|
28
+ puts "Generating db/#{File.basename(source)}"
29
+ FileUtils.cp(source, "#{Dir.pwd}/db/#{File.basename(source)}" )
30
+ end
31
+
32
+ Dir["#{from_dir}/#{name}"].each do |source|
33
+
34
+ # Use File.basename to remove the gem's path info so we can
35
+ # use just the filename to copy relative to the user.
36
+ destination = "#{Dir.pwd}/db/migrate/#{File.basename(source)}"
37
+
38
+ FileUtils.rm(destination) if options[:force] && File.exist?(destination) && File.file?(destination)
39
+ if File.directory?(destination)
40
+ puts "Oops, db/migrate/#{File.basename(destination)} is a directory. Skipping!"
41
+ elsif File.exist?(destination)
42
+ puts "Skipping db/migrate/#{File.basename(destination)} because it already exists"
43
+ else
44
+ puts "Generating db/migrate/#{File.basename(destination)}"
45
+ FileUtils.cp(source, destination)
46
+ end
47
+ end
48
+ puts "Don't forget to run 'rake db:setup' next! Run 'rake db:drop:all' first, if your databases already exist."
49
+ end
50
+
51
+ # dtf_setup:config is added to make sure you can copy the *config* without having to recopy
52
+ # the migrations and schema as well.
53
+ desc "config [NAME]", "Copy db configuration"
54
+ method_options :force => :boolean
55
+ def config(name = "config.yml")
56
+
57
+ from_dir = "#{Gem.loaded_specs['dtf'].gem_dir}"
58
+
59
+ # Use File.basename to remove the gem's path info so we can
60
+ # use just the filename to copy relative to the user.
61
+ destination = "#{Dir.pwd}/db/#{name}"
62
+
63
+ FileUtils.rm(destination) if options[:force] && File.exist?(destination) && File.file?(destination)
64
+ if File.directory?(destination)
65
+ puts "Oops, db/#{File.basename(destination)} is a directory. Ignoring!"
66
+ elsif File.exist?(destination)
67
+ puts "Skipping db/#{File.basename(destination)} because it already exists"
68
+ else
69
+ puts "Generating db/#{File.basename(destination)}"
70
+ FileUtils.cp("#{from_dir}/db/#{name}", destination)
71
+ end
72
+ puts "Don't forget to run 'rake db:setup' next! Run 'rake db:drop:all' first, if your databases already exist."
73
+ end
74
+
75
+ end
@@ -0,0 +1,31 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Dtf::Rvm do
4
+
5
+ context "Module" do
6
+ it "should be a Module" do
7
+ Dtf::Rvm.class.should eq(Module)
8
+ end
9
+
10
+ it "should specify a VERSION" do
11
+ Dtf::Rvm.class.const_defined?(:VERSION)
12
+ Dtf::Rvm::VERSION.should_not be_empty
13
+ Dtf::Rvm::VERSION.class.should eq(String)
14
+ end
15
+ end
16
+
17
+ context "Dependencies" do
18
+ it "should depend on DTF master gem" do
19
+ @gem_dep = false
20
+
21
+ Gem.loaded_specs['dtf-rvm'].dependencies.each do |spec|
22
+ if spec.name == "dtf"
23
+ @gem_dep = true
24
+ end
25
+ end
26
+
27
+ @gem_dep.should be_true
28
+ end
29
+ end
30
+
31
+ end
File without changes
@@ -0,0 +1,7 @@
1
+ # encoding: UTF-8
2
+
3
+ Fabricator(:analysis_case) do
4
+ name "DTF Analysis Case"
5
+ description "Fabricated AC for DTF testing"
6
+ case_tests(count: 3)
7
+ end
@@ -0,0 +1,6 @@
1
+ # encoding: UTF-8
2
+
3
+ Fabricator(:case_test) do
4
+ description "Fabricated CT for DTF testing"
5
+ cmd "ruby --version"
6
+ end
@@ -0,0 +1,8 @@
1
+ # encoding: UTF-8
2
+
3
+ Fabricator(:user) do
4
+ full_name { sequence(:num, 5 ) { |num| "John Q Public #{num}" } }
5
+ email_address { sequence(:email_address, 5) { |num| "jqp#{num}@public.com" } }
6
+ user_name { sequence(:user_name, 5) { |num| "johnpublic#{num}" } }
7
+ end
8
+
@@ -0,0 +1,6 @@
1
+ # encoding: UTF-8
2
+
3
+ Fabricator(:verification_suite) do
4
+ name "DTF Verification Suite"
5
+ description "Fabricated VS for DTF testing"
6
+ end
@@ -0,0 +1,50 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe "AnalysisCase" do
6
+
7
+ context "when instantiated" do
8
+
9
+ it "should be the proper class" do
10
+ Fabricate.build(:analysis_case).should be_a(AnalysisCase)
11
+ end
12
+
13
+ it "should be invalid without a name" do
14
+ Fabricate.build(:analysis_case, name: nil).should_not be_valid
15
+ end
16
+
17
+ it "should be invalid without a description" do
18
+ Fabricate.build(:analysis_case, description: nil).should_not be_valid
19
+ end
20
+
21
+ it "should be invalid without being assigned to a verification suite" do
22
+ analysis_case = Fabricate.build(:analysis_case)
23
+ analysis_case[:verification_suite_id].should be_nil
24
+ end
25
+
26
+ it "should not be saved" do
27
+ Fabricate.build(:analysis_case).new_record?.should be_true
28
+ end
29
+
30
+ end
31
+
32
+ context "when created" do
33
+ user = Fabricate(:user)
34
+ vs = user.verification_suites.create(name: "RSpec Test VS", description: "Bogus VS for RSpec")
35
+ analysis_case = vs.analysis_cases.create(name: "RSpec Test AC", description: "Bogus AC for RSpec")
36
+
37
+ it "should be owned by a verification suite" do
38
+ analysis_case.verification_suite_id.should_not be_nil
39
+ end
40
+
41
+ it "should have a valid name and description" do
42
+ analysis_case.should be_valid
43
+ end
44
+
45
+ it "should be saved" do
46
+ analysis_case.new_record?.should_not be_true
47
+ analysis_case.persisted?.should be_true
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,53 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe "CaseTest" do
6
+
7
+ context "when instantiated" do
8
+
9
+ it "should be the proper class" do
10
+ Fabricate.build(:case_test).should be_a(CaseTest)
11
+ end
12
+
13
+ it "should be invalid without a description" do
14
+ Fabricate.build(:case_test, description: nil).should_not be_valid
15
+ end
16
+
17
+ it "should be invalid without a command" do
18
+ Fabricate.build(:case_test, cmd: nil).should_not be_valid
19
+ end
20
+
21
+ it "should be invalid without being assigned to an analysis case" do
22
+ case_test = Fabricate.build(:case_test)
23
+ case_test[:analysis_case_id].should be_nil
24
+ end
25
+
26
+ it "should not be saved" do
27
+ Fabricate.build(:case_test).new_record?.should be_true
28
+ end
29
+
30
+ end
31
+
32
+ context "when created" do
33
+ user = Fabricate(:user)
34
+ vs = user.verification_suites.create(name: "RSpec Test VS", description: "Bogus VS for RSpec")
35
+ analysis_case = vs.analysis_cases.create(name: "RSpec Test AC", description: "Bogus AC for RSpec")
36
+ case_test = analysis_case.case_tests.create(cmd: "bundle exec rspec spec",
37
+ description: "Bogus CT for RSpec"
38
+ )
39
+
40
+ it "should be owned by an analysis case" do
41
+ case_test.analysis_case_id.should_not be_nil
42
+ end
43
+
44
+ it "should have a valid cmd and description" do
45
+ case_test.should be_valid
46
+ end
47
+
48
+ it "should be saved" do
49
+ case_test.new_record?.should_not be_true
50
+ case_test.persisted?.should be_true
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,44 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe "User" do
6
+
7
+ context "when instantiated" do
8
+
9
+ it "should be the proper class" do
10
+ Fabricate.build(:user).should be_a(User)
11
+ end
12
+
13
+ it "should be invalid without a user_name" do
14
+ Fabricate.build(:user, user_name: nil).should_not be_valid
15
+ end
16
+
17
+ it "should be invalid without an email_address" do
18
+ Fabricate.build(:user, email_address: nil).should_not be_valid
19
+ end
20
+
21
+ it "should be invalid without a full_name" do
22
+ Fabricate.build(:user, full_name: nil).should_not be_valid
23
+ end
24
+
25
+ it "should not be saved" do
26
+ Fabricate.build(:user).new_record?.should be_true
27
+ end
28
+
29
+ end
30
+
31
+ context "when created" do
32
+ let(:user) { Fabricate(:user)}
33
+
34
+ it "should have a valid user_name, full_name, and email_address" do
35
+ user.should be_valid
36
+ user.errors.should be_empty
37
+ end
38
+
39
+ it "should be saved" do
40
+ user.new_record?.should_not be_true
41
+ user.persisted?.should be_true
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,51 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe "VerificationSuite" do
6
+
7
+ context "when instantiated" do
8
+
9
+ it "should be the proper class" do
10
+ Fabricate.build(:verification_suite).should be_a(VerificationSuite)
11
+ end
12
+
13
+ it "should be invalid without a name" do
14
+ Fabricate.build(:verification_suite, name: nil).should_not be_valid
15
+ end
16
+
17
+ it "should be invalid without a description" do
18
+ Fabricate.build(:verification_suite, description: nil).should_not be_valid
19
+ end
20
+
21
+ it "should be invalid without being assigned to a user" do
22
+ user = Fabricate.build(:user)
23
+ verification_suite = user.verification_suites.build(name: "RSpec Test VS", description: nil)
24
+ verification_suite.should_not be_valid
25
+ end
26
+
27
+ it "should not be saved" do
28
+ Fabricate.build(:verification_suite).new_record?.should be_true
29
+ end
30
+
31
+ end
32
+
33
+ context "when created" do
34
+ user = Fabricate(:user)
35
+ verification_suite = user.verification_suites.create(name: "RSpec Test VS", description: "Bogus VS for RSpec")
36
+ user.verification_suites.count.should == 1
37
+
38
+ it "should be owned by a user" do
39
+ verification_suite.user_id.should_not be_nil
40
+ end
41
+
42
+ it "should have a valid name and description" do
43
+ verification_suite.should be_valid
44
+ end
45
+
46
+ it "should be saved" do
47
+ verification_suite.new_record?.should_not be_true
48
+ verification_suite.persisted?.should be_true
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,34 @@
1
+ # encoding: UTF-8
2
+ require 'cover_me'
3
+ require 'dtf-rvm'
4
+ require 'rspec'
5
+ require 'fabrication'
6
+ require 'database_cleaner'
7
+
8
+ # Require any RSpec support files, helpers, and custom matchers we define
9
+ Dir[File.join(File.dirname(__FILE__), "support/**/*.rb")].each do |f|
10
+ require f
11
+ end
12
+
13
+ # Turnip steps load line
14
+ Dir.glob("spec/steps/**/*steps.rb") do |f|
15
+ load f, true
16
+ end
17
+
18
+ # This config section is for DatabaseCleaner
19
+ RSpec.configure do |config|
20
+
21
+ config.before(:suite) do
22
+ DatabaseCleaner.strategy = :transaction
23
+ DatabaseCleaner.clean_with(:truncation)
24
+ end
25
+
26
+ config.before(:each) do
27
+ DatabaseCleaner.start
28
+ end
29
+
30
+ config.after(:each) do
31
+ DatabaseCleaner.clean
32
+ end
33
+
34
+ end
File without changes
metadata ADDED
@@ -0,0 +1,238 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dtf-rvm
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - David Deryl Downey
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-20 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: dtf
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: sqlite3
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: json
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: json_pure
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: rspec
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: fabrication
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: yard
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ - !ruby/object:Gem::Dependency
143
+ name: redcarpet
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ description: DTF gem integrating RVM into DTF
159
+ email:
160
+ - me@daviddwdowney.com
161
+ executables: []
162
+ extensions: []
163
+ extra_rdoc_files: []
164
+ files:
165
+ - .gitignore
166
+ - .rspec
167
+ - .rvmrc
168
+ - .travis.yml
169
+ - Gemfile
170
+ - LICENSE.txt
171
+ - README.md
172
+ - Rakefile
173
+ - app/models/analysis_case.rb
174
+ - app/models/case_test.rb
175
+ - app/models/user.rb
176
+ - app/models/verification_suite.rb
177
+ - db/config.yml
178
+ - db/migrate/.gitkeep
179
+ - db/schema.rb
180
+ - db/seeds.rb
181
+ - dtf-rvm.gemspec
182
+ - lib/config/environment.rb
183
+ - lib/dtf-rvm.rb
184
+ - lib/dtf-rvm/version.rb
185
+ - lib/tasks/setup.thor
186
+ - spec/dtf-rvm/dtf_rvm_spec.rb
187
+ - spec/dtf-rvm/rvm/.gitkeep
188
+ - spec/fabricators/analysis_case_fabricator.rb
189
+ - spec/fabricators/case_test_fabricator.rb
190
+ - spec/fabricators/user_fabricator.rb
191
+ - spec/fabricators/verification_suite_fabricator.rb
192
+ - spec/models/analysis_case_spec.rb
193
+ - spec/models/case_test_spec.rb
194
+ - spec/models/user_spec.rb
195
+ - spec/models/verification_suite_spec.rb
196
+ - spec/spec_helper.rb
197
+ - spec/support/custom_matchers/.gitkeep
198
+ homepage: https://dtf-gems.daviddwdowney.com/dtf-rvm
199
+ licenses: []
200
+ post_install_message:
201
+ rdoc_options: []
202
+ require_paths:
203
+ - lib
204
+ required_ruby_version: !ruby/object:Gem::Requirement
205
+ none: false
206
+ requirements:
207
+ - - ! '>='
208
+ - !ruby/object:Gem::Version
209
+ version: 1.9.2
210
+ required_rubygems_version: !ruby/object:Gem::Requirement
211
+ none: false
212
+ requirements:
213
+ - - ! '>='
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ segments:
217
+ - 0
218
+ hash: 3060296988641051204
219
+ requirements: []
220
+ rubyforge_project:
221
+ rubygems_version: 1.8.24
222
+ signing_key:
223
+ specification_version: 3
224
+ summary: DTF-RVM is a DTF sub-gem integrating RVM into the DTF platform
225
+ test_files:
226
+ - spec/dtf-rvm/dtf_rvm_spec.rb
227
+ - spec/dtf-rvm/rvm/.gitkeep
228
+ - spec/fabricators/analysis_case_fabricator.rb
229
+ - spec/fabricators/case_test_fabricator.rb
230
+ - spec/fabricators/user_fabricator.rb
231
+ - spec/fabricators/verification_suite_fabricator.rb
232
+ - spec/models/analysis_case_spec.rb
233
+ - spec/models/case_test_spec.rb
234
+ - spec/models/user_spec.rb
235
+ - spec/models/verification_suite_spec.rb
236
+ - spec/spec_helper.rb
237
+ - spec/support/custom_matchers/.gitkeep
238
+ has_rdoc: