dtf 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/.rspec +1 -1
  2. data/.travis.yml +7 -2
  3. data/Gemfile +3 -2
  4. data/README.md +105 -6
  5. data/Rakefile +2 -0
  6. data/app/models/analysis_case.rb +1 -1
  7. data/app/models/case_test.rb +1 -1
  8. data/app/models/user.rb +3 -2
  9. data/app/models/verification_suite.rb +1 -1
  10. data/bin/dtf +23 -20
  11. data/db/seeds.rb +4 -0
  12. data/doc/AnalysisCase.html +123 -0
  13. data/doc/CaseTest.html +123 -0
  14. data/doc/Dtf.html +129 -0
  15. data/doc/Dtf/DtfCommands.html +471 -0
  16. data/doc/User.html +123 -0
  17. data/doc/VerificationSuite.html +123 -0
  18. data/doc/_index.html +171 -0
  19. data/doc/class_list.html +53 -0
  20. data/doc/css/common.css +1 -0
  21. data/doc/css/full_list.css +57 -0
  22. data/doc/css/style.css +328 -0
  23. data/doc/file.README.html +256 -0
  24. data/doc/file_list.html +55 -0
  25. data/doc/frames.html +28 -0
  26. data/doc/index.html +256 -0
  27. data/doc/js/app.js +214 -0
  28. data/doc/js/full_list.js +173 -0
  29. data/doc/js/jquery.js +4 -0
  30. data/doc/method_list.html +100 -0
  31. data/doc/top-level-namespace.html +274 -0
  32. data/dtf.gemspec +3 -1
  33. data/lib/config/environment.rb +1 -1
  34. data/lib/dtf.rb +85 -2
  35. data/lib/dtf/dtf_error_system.rb +16 -0
  36. data/lib/dtf/dtf_help_system.rb +55 -0
  37. data/lib/dtf/version.rb +2 -2
  38. data/lib/tasks/setup.thor +5 -3
  39. data/spec/acceptance/create_basic_associations.feature +13 -0
  40. data/spec/acceptance/implement_help_system.feature +16 -0
  41. data/spec/fabricators/analysis_case_fabricator.rb +1 -1
  42. data/spec/fabricators/case_test_fabricator.rb +1 -1
  43. data/spec/fabricators/user_fabricator.rb +4 -4
  44. data/spec/fabricators/verification_suite_fabricator.rb +1 -1
  45. data/spec/models/analysis_case_spec.rb +53 -11
  46. data/spec/models/case_test_spec.rb +57 -11
  47. data/spec/models/user_spec.rb +46 -11
  48. data/spec/models/verification_suite_spec.rb +52 -12
  49. data/spec/spec_helper.rb +21 -1
  50. data/spec/steps/feature_steps.rb +14 -12
  51. data/spec/support/custom_matchers/model_steps.rb +17 -18
  52. metadata +77 -18
  53. data/bin/dtf-create_user +0 -11
  54. data/bin/dtf-create_vs +0 -10
  55. data/bin/dtf-delete_user +0 -18
  56. data/bin/dtf-delete_vs +0 -14
  57. data/bin/dtf-setup +0 -7
  58. data/spec/acceptance/0001_create_basic_models.feature +0 -9
  59. data/spec/acceptance/0002_create_basic_associations.feature +0 -11
  60. data/spec/acceptance/0003_execute_help_switch.feature +0 -7
data/.rspec CHANGED
@@ -1 +1 @@
1
- -r turnip/rspec --color
1
+ -r turnip/rspec --color --format doc
@@ -1,5 +1,7 @@
1
1
  rvm:
2
2
  - 1.9.3
3
+ before_install:
4
+ - gem update bundler
3
5
  before_script:
4
6
  - RAILS_ENV='development' bundle exec thor dtf_setup:config
5
7
  - RAILS_ENV='development' bundle exec rake db:migrate
@@ -10,7 +12,10 @@ notifications:
10
12
  irc:
11
13
  channels:
12
14
  - "irc.freenode.org#dtf-gems"
15
+ on_success: always
16
+ on_failure: always
13
17
  email:
14
18
  recipients:
15
- - me@deryldoucette.com
16
- on_failure: change
19
+ - me@daviddwdowney.com
20
+ on_success: always
21
+ on_failure: always
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
- # -*- coding: UTF-8 -*-
2
-
1
+ # encoding: UTF-8
3
2
  source 'https://rubygems.org'
3
+ ruby "1.9.3"
4
4
 
5
5
  # Specify your gem's dependencies in dtf.gemspec
6
6
  group :development, :test do
@@ -21,6 +21,7 @@ group :development, :test do
21
21
  gem "jist"
22
22
  gem "pry-theme"
23
23
  gem 'simplecov'
24
+ gem 'database_cleaner'
24
25
  end
25
26
 
26
27
  gemspec
data/README.md CHANGED
@@ -77,12 +77,111 @@ really is when it comes to version numbers and what they mean. This _will_ be a
77
77
 
78
78
 
79
79
  ## Installation
80
-
81
- To Be Announced
80
+ DTF uses Thor for setup and configuration, and has 3 possible sub-tasks under task name 'dtf_setup':
81
+
82
+ ```sh
83
+ ∴ thor list
84
+ dtf_setup
85
+ ---------
86
+ thor dtf_setup:config [NAME] # Copy db configuration file(s)
87
+ thor dtf_setup:install # Installs database migrations, the main schema, and configuration files
88
+ ```
89
+
90
+ As you can see, you can copy just the db config files, and/or the migrations, and main schema.
91
+
92
+ ```sh
93
+ ∴ thor help dtf_setup
94
+ Tasks:
95
+ thor dtf_setup:config [NAME] # Copy db configuration file(s)
96
+ thor dtf_setup:help [TASK] # Describe available tasks or one specific task
97
+ thor dtf_setup:install # Installs database migrations, the main schema, and configuration files
98
+ ```
99
+
100
+ To see how to install everything you would run the following command:
101
+
102
+ ```sh
103
+ ∴ thor dtf_setup:help install
104
+ Usage:
105
+ thor dtf_setup:install
106
+
107
+ Options:
108
+ [--force]
109
+
110
+ Installs database migrations, the main schema, and configuration files
111
+ ```
112
+
113
+ To see how to install just the configuration files for accessing the database(s), you would run:
114
+
115
+ ```sh
116
+ ∴ thor dtf_setup:help config
117
+ Usage:
118
+ thor dtf_setup:config [NAME]
119
+
120
+ Options:
121
+ [--force]
122
+
123
+ Copy db configuration file(s)
124
+ ```
125
+
126
+ Once the configuration files and/or database migrations are in place, the remaining setup is handled by 'rake'.
127
+ To see all possible commands, you would run 'rake -T', and pick the one(s) you need.
128
+
129
+ ```sh
130
+ ∴ rake -T
131
+ rake build # Build dtf-0.2.2.gem into the pkg directory
132
+ rake db:create # Create the database from config/database.yml for the current Rails.env (use db:create:all to create all dbs i...
133
+ rake db:drop # Drops the database for the current Rails.env (use db:drop:all to drop all databases)
134
+ rake db:fixtures:load # Load fixtures into the current environment's database.
135
+ rake db:migrate # Migrate the database (options: VERSION=x, VERBOSE=false).
136
+ rake db:migrate:status # Display status of migrations
137
+ rake db:new_migration # Create a new migration
138
+ rake db:rollback # Rolls the schema back to the previous version (specify steps w/ STEP=n).
139
+ rake db:schema:dump # Create a db/schema.rb file that can be portably used against any DB supported by AR
140
+ rake db:schema:load # Load a schema.rb file into the database
141
+ rake db:seed # Load the seed data from db/seeds.rb
142
+ rake db:setup # Create the database, load the schema, and initialize with the seed data (use db:reset to also drop the db first)
143
+ rake db:structure:dump # Dump the database structure to db/structure.sql. Specify another file with DB_STRUCTURE=db/my_structure.sql
144
+ rake db:version # Retrieves the current schema version number
145
+ rake install # Build and install dtf-0.2.2.gem into system gems
146
+ rake release # Create tag v0.2.2 and build and push dtf-0.2.2.gem to Rubygems
147
+ ```
82
148
 
83
149
 
84
150
  ## Usage
85
-
86
- To Be Announced
87
-
88
-
151
+ Once you have finished configuring your database(s) and applying all migrations, you are now ready to work with
152
+ DTF directly. The following is a summary of all current possible commands, and their expected options/parameters:
153
+
154
+ ```sh
155
+ dtf -v|--version -h|--help [[sub_cmds <options>] -h|--help]
156
+
157
+ Valid [sub_cmds] are: create_(user|vs), delete_(user|vs)
158
+ See 'dtf [sub_cmd] -h' for each sub_cmd's details and options
159
+
160
+ dtf create_user -h
161
+ Options:
162
+ --user-name, -u <s>: Username for new TF user - REQUIRED
163
+ --full-name, -n <s>: Real name for new TF user - REQUIRED
164
+ --email-address, -e <s>: Email address for new TF user - REQUIRED
165
+ --help, -h: Show this message
166
+
167
+ dtf delete_user -h
168
+ Options:
169
+ --user-name, -u <s>: Username of TF user to delete - REQUIRED
170
+ --delete-all, --no-delete-all, -d: Delete _all_ VSs this user owns (default: true)
171
+ --help, -h: Show this message
172
+
173
+ dtf create_vs -h
174
+ Options:
175
+ --user-name, -u <s>: TF user to associate this VS with - REQUIRED
176
+ --name, -n <s>: Name for new VS - REQUIRED
177
+ --description, -d <s>: Description of VS's intended use - OPTIONAL (default: )
178
+ --help, -h: Show this message
179
+
180
+ dtf delete_vs -h
181
+ Options:
182
+ --user-name, -u <s>: Username of VS owner - REQUIRED
183
+ --id, -i <i>: ID of VS to be deleted - REQUIRED
184
+ --help, -h: Show this message
185
+ ```
186
+
187
+ Enjoy!
data/Rakefile CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env rake
2
+ # encoding: UTF-8
3
+
2
4
  require "bundler/gem_tasks"
3
5
 
4
6
  begin
@@ -1,4 +1,4 @@
1
- # -*- coding: UTF-8 -*-
1
+ # encoding: UTF-8
2
2
 
3
3
  class AnalysisCase < ActiveRecord::Base
4
4
 
@@ -1,4 +1,4 @@
1
- # -*- coding: UTF-8 -*-
1
+ # encoding: UTF-8
2
2
 
3
3
  class CaseTest < ActiveRecord::Base
4
4
 
@@ -1,9 +1,10 @@
1
- # -*- coding: UTF-8 -*-
1
+ # encoding: UTF-8
2
2
 
3
3
  class User < ActiveRecord::Base
4
4
 
5
5
  attr_accessible :full_name, :email_address, :user_name
6
- validates_presence_of :full_name, :email_address, :user_name
6
+ validates :full_name, :email_address, :user_name, :presence => true
7
+ validates :user_name, :email_address, :uniqueness => true
7
8
 
8
9
  has_many :verification_suites, :dependent => :destroy
9
10
  has_many :analysis_cases, :through => :verification_suites, :dependent => :destroy
@@ -1,4 +1,4 @@
1
- # -*- coding: UTF-8 -*-
1
+ # encoding: UTF-8
2
2
 
3
3
  class VerificationSuite < ActiveRecord::Base
4
4
 
data/bin/dtf CHANGED
@@ -1,28 +1,31 @@
1
1
  #!/usr/bin/env ruby
2
+ # encoding: UTF-8
3
+ # (c) Copyright 2012 David Deryl Downey / Deryl R. Doucette. All Rights Reserved.
2
4
  #
3
- # This is the master script to be used to manage the various Verification Suites,
4
- # Analysis Cases, and Case Tests
5
- #
6
- # Ex: dtf create_user -u|--user @user_name -n|--name "John Public" -e|--email
7
- # "j@public.com"
8
- #
9
- # -u -n and -e are _required_ parameters
10
- #
11
- # Accessing the help system
12
- # Ex: dtf help create_user
5
+ # This is the master script for managing Users and Verification Suites
13
6
 
14
7
  require 'dtf'
15
- require 'optparse'
16
8
 
17
- options = {}
9
+ # -- LOAD HELP SYSTEM
10
+ require 'dtf/dtf_help_system'
11
+
12
+ # -- LOAD ERROR SYSTEM
13
+ require 'dtf/dtf_error_system'
18
14
 
19
- OptionParser.new do |opts|
20
- opts.banner = "Usage: dtf <cmd> [options]"
15
+
16
+ # -- START MAIN APPLICATION
17
+ # Ensure we have *all* required options for each possible sub_cmd
18
+ case @cmd
19
+ when "create_user"
20
+ Dtf::DtfCommands.create_user(@cmd_opts)
21
+
22
+ when "delete_user"
23
+ Dtf::DtfCommands.delete_user(@cmd, @cmd_opts)
24
+
25
+ when "create_vs"
26
+ Dtf::DtfCommands.create_vs(@cmd_opts)
21
27
 
22
- opts.on("-h", "--help",
23
- "Show this message") do |h|
24
- options[:help] = h
25
- puts opts
26
- end
28
+ when "delete_vs"
29
+ Dtf::DtfCommands.delete_vs(@cmd, @cmd_opts)
27
30
 
28
- end.parse!
31
+ end
@@ -0,0 +1,4 @@
1
+ # encoding: UTF-8
2
+ require 'dtf'
3
+
4
+ User.create(full_name: "Library Owner", email_address: "library_owner@localhost.lan", user_name: "library_owner")
@@ -0,0 +1,123 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Class: AnalysisCase
8
+
9
+ &mdash; Documentation by YARD 0.8.2.1
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '';
20
+ framesUrl = "frames.html#!" + escape(window.location.href);
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="_index.html">Index (A)</a> &raquo;
35
+
36
+
37
+ <span class="title">AnalysisCase</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Class: AnalysisCase
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+ <dt class="r1">Inherits:</dt>
75
+ <dd class="r1">
76
+ <span class="inheritName">ActiveRecord::Base</span>
77
+
78
+ <ul class="fullTree">
79
+ <li>Object</li>
80
+
81
+ <li class="next">ActiveRecord::Base</li>
82
+
83
+ <li class="next">AnalysisCase</li>
84
+
85
+ </ul>
86
+ <a href="#" class="inheritanceTree">show all</a>
87
+
88
+ </dd>
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+ <dt class="r2 last">Defined in:</dt>
99
+ <dd class="r2 last">app/models/analysis_case.rb</dd>
100
+
101
+ </dl>
102
+ <div class="clear"></div>
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+ </div>
115
+
116
+ <div id="footer">
117
+ Generated on Fri Sep 14 22:41:21 2012 by
118
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
119
+ 0.8.2.1 (ruby-1.9.3).
120
+ </div>
121
+
122
+ </body>
123
+ </html>
@@ -0,0 +1,123 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Class: CaseTest
8
+
9
+ &mdash; Documentation by YARD 0.8.2.1
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '';
20
+ framesUrl = "frames.html#!" + escape(window.location.href);
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="_index.html">Index (C)</a> &raquo;
35
+
36
+
37
+ <span class="title">CaseTest</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Class: CaseTest
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+ <dt class="r1">Inherits:</dt>
75
+ <dd class="r1">
76
+ <span class="inheritName">ActiveRecord::Base</span>
77
+
78
+ <ul class="fullTree">
79
+ <li>Object</li>
80
+
81
+ <li class="next">ActiveRecord::Base</li>
82
+
83
+ <li class="next">CaseTest</li>
84
+
85
+ </ul>
86
+ <a href="#" class="inheritanceTree">show all</a>
87
+
88
+ </dd>
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+ <dt class="r2 last">Defined in:</dt>
99
+ <dd class="r2 last">app/models/case_test.rb</dd>
100
+
101
+ </dl>
102
+ <div class="clear"></div>
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+ </div>
115
+
116
+ <div id="footer">
117
+ Generated on Fri Sep 14 22:41:21 2012 by
118
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
119
+ 0.8.2.1 (ruby-1.9.3).
120
+ </div>
121
+
122
+ </body>
123
+ </html>