cbaoth 0.0.5 → 0.0.6
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.
- checksums.yaml +4 -4
- data/bin/cbaoth +2 -1
- data/lib/base_files/base_rakefile +10 -11
- data/lib/cbaoth.rb +8 -1
- data/lib/cbaoth/version.rb +1 -1
- data/spec/lib/cbaoth_spec.rb +31 -31
- data/spec/spec_helper.rb +2 -2
- metadata +3 -5
- data/spec/testing_dir/test/process.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 778297b623f7488b6a361ad8ac605b6de563e1a6
|
4
|
+
data.tar.gz: dc977dc8cbc461de1ae951b361a9a75a30c190d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06d712d6bd8653313e36dc0c38f9d52e666c09ddc7354a37b670daeac418a44d90f7c3b8fd61b5d30c664ea321dfcc4e8c26c9402742a9802a00059388bcac50
|
7
|
+
data.tar.gz: 04f04adcdc50fff4941a93207a1ab6d43ea49bd5e5c89a5aa01c4965f8c8d9e7f497ac35876508ab479613b35029b7f2a7fa13bc1b6a6488a607d413bb0cda5b
|
data/bin/cbaoth
CHANGED
@@ -4,6 +4,7 @@ require 'cbaoth'
|
|
4
4
|
require 'cbaoth/version'
|
5
5
|
|
6
6
|
app_name = ARGV.first
|
7
|
+
flag = ARGV[1] || ""
|
7
8
|
|
8
9
|
if app_name == '--help'
|
9
10
|
puts
|
@@ -21,5 +22,5 @@ if app_name == '--help'
|
|
21
22
|
puts "new app dir and run the respec and guard init commands."
|
22
23
|
else
|
23
24
|
gen = Cbaoth::Generator.new
|
24
|
-
gen.generate app_name
|
25
|
+
gen.generate app_name, flag
|
25
26
|
end
|
@@ -5,6 +5,14 @@ require 'database_cleaner'
|
|
5
5
|
|
6
6
|
CONFIG = YAML::load(File.open('config/database.yml'))
|
7
7
|
|
8
|
+
namespace :run do
|
9
|
+
puts "todo: change the description of this for your needs."
|
10
|
+
desc "Rakefile to run your app"
|
11
|
+
task :import_mbm_data do
|
12
|
+
system "ruby process.rb"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
8
16
|
task :default => :migrate
|
9
17
|
namespace :db do
|
10
18
|
desc "Migrate the database through scripts in db/migrate. Target specific version with VERSION=x"
|
@@ -12,15 +20,6 @@ namespace :db do
|
|
12
20
|
ActiveRecord::Migrator.migrate('db/migrate', ENV["VERSION"] ? ENV["VERSION"].to_i : nil )
|
13
21
|
end
|
14
22
|
|
15
|
-
task :drop => :environment do
|
16
|
-
puts "----- Drop DB -----"
|
17
|
-
ActiveRecord::Base.establish_connection CONFIG["production"]
|
18
|
-
ActiveRecord::Base.connection.tables.each do |table|
|
19
|
-
ActiveRecord::Base.connection.execute("DROP TABLE IF EXISTS #{table}")
|
20
|
-
puts "Dropped #{table}"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
23
|
task :create do
|
25
24
|
puts "----- Create DB -----"
|
26
25
|
config = YAML::load(File.open('config/database.yml'))
|
@@ -35,12 +34,13 @@ namespace :db do
|
|
35
34
|
|
36
35
|
task :reset => :environment do
|
37
36
|
puts "----- Reset DB -----"
|
38
|
-
Rake::Task["db:
|
37
|
+
Rake::Task["db:truncate"].invoke('all')
|
39
38
|
Rake::Task["db:migrate"].invoke
|
40
39
|
end
|
41
40
|
|
42
41
|
desc "Truncate all existing data"
|
43
42
|
task :truncate, [:arg1] => :environment do |t, args|
|
43
|
+
puts "*** Truncate - #{args[:arg1]}"
|
44
44
|
if args[:arg1] =~ /all/i
|
45
45
|
DatabaseCleaner.clean_with :truncation
|
46
46
|
else
|
@@ -53,7 +53,6 @@ namespace :db do
|
|
53
53
|
task :migrate do
|
54
54
|
ActiveRecord::Base.establish_connection CONFIG["test"]
|
55
55
|
ActiveRecord::Migrator.migrate('db/migrate', ENV["VERSION"] ? ENV["VERSION"].to_i : nil )
|
56
|
-
|
57
56
|
end
|
58
57
|
|
59
58
|
desc "Create test DB"
|
data/lib/cbaoth.rb
CHANGED
@@ -4,11 +4,12 @@ module Cbaoth
|
|
4
4
|
|
5
5
|
class Generator
|
6
6
|
|
7
|
-
def generate app_name
|
7
|
+
def generate app_name, flag
|
8
8
|
vars = init_variables app_name
|
9
9
|
create_app_name_dir app_name
|
10
10
|
create_dir_structure vars[:working_directory]
|
11
11
|
generate_base_files vars[:working_directory], vars[:gem_directory]
|
12
|
+
init_git app_name unless flag == '-g'
|
12
13
|
alert_user app_name
|
13
14
|
end
|
14
15
|
|
@@ -42,6 +43,12 @@ module Cbaoth
|
|
42
43
|
system "touch #{wd}/process.rb"
|
43
44
|
end
|
44
45
|
|
46
|
+
def init_git app_name
|
47
|
+
puts
|
48
|
+
puts "\tInitializing git"
|
49
|
+
system "git init #{app_name}"
|
50
|
+
end
|
51
|
+
|
45
52
|
def alert_user app_name
|
46
53
|
puts
|
47
54
|
puts "*" * 90
|
data/lib/cbaoth/version.rb
CHANGED
data/spec/lib/cbaoth_spec.rb
CHANGED
@@ -2,33 +2,28 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Cbaoth::Generator do
|
4
4
|
before :all do
|
5
|
-
FileUtils.mkdir_p("spec/testing_dir
|
6
|
-
Dir.chdir("spec/testing_dir
|
7
|
-
end
|
8
|
-
before :each do
|
5
|
+
FileUtils.mkdir_p("spec/testing_dir")
|
6
|
+
Dir.chdir("spec/testing_dir")
|
9
7
|
@generator = Cbaoth::Generator.new
|
10
8
|
end
|
11
9
|
|
12
|
-
describe '
|
10
|
+
describe 'methods' do
|
11
|
+
it { should respond_to :init_variables }
|
13
12
|
it { should respond_to :generate }
|
13
|
+
it { should respond_to :create_dir_structure }
|
14
|
+
it { should respond_to :generate_base_files }
|
15
|
+
it { should respond_to :alert_user }
|
14
16
|
end
|
15
17
|
|
16
|
-
describe '#
|
17
|
-
it
|
18
|
-
|
19
|
-
vars = {}
|
20
|
-
vars = @generator.init_variables 'test'
|
21
|
-
expect(vars.length).to eq 2
|
18
|
+
describe '#generate' do
|
19
|
+
it 'throws an argument error if arguments are not passed' do
|
20
|
+
expect { @generator.generate }.to raise_error(ArgumentError)
|
22
21
|
end
|
23
|
-
end
|
24
22
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
# Dir.chdir("spec/testing_dir/test")
|
30
|
-
dirs = @generator.init_variables 'test'
|
31
|
-
@generator.create_dir_structure dirs[:working_directory]
|
23
|
+
it 'generates a base ruby app' do
|
24
|
+
n = nil
|
25
|
+
@generator.generate "test", n
|
26
|
+
Dir.chdir "test"
|
32
27
|
end
|
33
28
|
|
34
29
|
it 'creates the bin dir' do
|
@@ -54,14 +49,6 @@ describe Cbaoth::Generator do
|
|
54
49
|
it 'creates the log dir' do
|
55
50
|
expect(Dir.exist?('log')).to be_true
|
56
51
|
end
|
57
|
-
end
|
58
|
-
|
59
|
-
describe '#generate_base_files' do
|
60
|
-
it { should respond_to :generate_base_files }
|
61
|
-
before {
|
62
|
-
wd = Dir.pwd
|
63
|
-
@generator.generate_base_files wd, "../../../"
|
64
|
-
}
|
65
52
|
it 'creates a rakefile' do
|
66
53
|
expect(File.exist?("Rakefile")).to be_true
|
67
54
|
end
|
@@ -77,10 +64,23 @@ describe Cbaoth::Generator do
|
|
77
64
|
it 'creates a database.yml file' do
|
78
65
|
expect(File.exist?("config/database.yml")).to be_true
|
79
66
|
end
|
80
|
-
end
|
81
67
|
|
82
|
-
|
83
|
-
|
68
|
+
describe 'git init' do
|
69
|
+
it 'inits git' do
|
70
|
+
n = ""
|
71
|
+
@generator.generate "test", n
|
72
|
+
Dir.chdir "test"
|
73
|
+
expect(Dir.exist?('.git')).to be_true
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe 'ignore git init' do
|
78
|
+
it 'inits git' do
|
79
|
+
n = "-g"
|
80
|
+
@generator.generate "test", n
|
81
|
+
Dir.chdir "test"
|
82
|
+
expect(Dir.exist?('.git')).to be_false
|
83
|
+
end
|
84
|
+
end
|
84
85
|
end
|
85
|
-
|
86
86
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -14,12 +14,12 @@ RSpec.configure do |config|
|
|
14
14
|
|
15
15
|
# todo: change this to after so we don't have unwanted test dir's/files
|
16
16
|
config.after :suite do
|
17
|
-
FileUtils.rm_rf "
|
17
|
+
FileUtils.rm_rf "../../testing_dir"
|
18
18
|
end
|
19
19
|
|
20
20
|
# Run specs in random order to surface order dependencies. If you find an
|
21
21
|
# order dependency and want to debug it, you can fix the order by providing
|
22
22
|
# the seed, which is printed after each run.
|
23
23
|
# --seed 1234
|
24
|
-
config.order = 'random'
|
24
|
+
# config.order = 'random'
|
25
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cbaoth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Curtis Ovard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -63,7 +63,6 @@ files:
|
|
63
63
|
- lib/cbaoth/version.rb
|
64
64
|
- spec/lib/cbaoth_spec.rb
|
65
65
|
- spec/spec_helper.rb
|
66
|
-
- spec/testing_dir/test/process.rb
|
67
66
|
homepage: https://github.com/covard/ruby_app_generator
|
68
67
|
licenses:
|
69
68
|
- MIT
|
@@ -84,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
83
|
version: '0'
|
85
84
|
requirements: []
|
86
85
|
rubyforge_project:
|
87
|
-
rubygems_version: 2.0.
|
86
|
+
rubygems_version: 2.0.7
|
88
87
|
signing_key:
|
89
88
|
specification_version: 4
|
90
89
|
summary: Gem to create a base ruby automation app from the command line. Simply typing
|
@@ -92,4 +91,3 @@ summary: Gem to create a base ruby automation app from the command line. Simply
|
|
92
91
|
test_files:
|
93
92
|
- spec/lib/cbaoth_spec.rb
|
94
93
|
- spec/spec_helper.rb
|
95
|
-
- spec/testing_dir/test/process.rb
|
File without changes
|