stones 0.2.5 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-gemset +1 -1
- data/.ruby-version +1 -1
- data/Gemfile +1 -14
- data/Gemfile.lock +93 -93
- data/MIT-LICENSE +1 -1
- data/README.md +21 -4
- data/Rakefile +0 -17
- data/app/assets/stylesheets/reset.css +22 -31
- data/app/views/layouts/_body.slim +2 -5
- data/app/views/layouts/_flash.slim +4 -4
- data/app/views/layouts/_footer.slim +2 -4
- data/app/views/layouts/_header.slim +3 -0
- data/lib/stones/version.rb +1 -1
- data/stones.gemspec +9 -13
- metadata +35 -7
- data/.watchr +0 -52
- data/lib/tasks/backup.rake +0 -92
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 604109717f1a47ecc8307f48891a444ed1ed9bcd
|
4
|
+
data.tar.gz: fc05e2ecbf6f04cd4512ad51e8be96f5db1f4963
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbd267725493622dae6fb4edd695220d7207c221c87d0341e15b7eeec2d62a49fafeb64bfe3609971913912ea4b79e612bb02e74b529b193c4a2fa2ca1a92902
|
7
|
+
data.tar.gz: 0921412e96b93a978354125282b62e31cb8a3bbcbdb0f5023f2ab93681828719429be4871592cdf0d9bf8effc3e65dc504a18d4841f8e8dacbd832a77b5fe24a
|
data/.ruby-gemset
CHANGED
@@ -1 +1 @@
|
|
1
|
-
rails-
|
1
|
+
rails-5.0
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.1
|
1
|
+
ruby-2.3.1
|
data/Gemfile
CHANGED
@@ -1,16 +1,3 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
|
-
gem 'rails'
|
4
|
-
#gem 'jquery-rails'
|
5
|
-
#gem 'rows_controller'
|
6
|
-
|
7
|
-
group :test do
|
8
|
-
gem "capybara"
|
9
|
-
gem 'rspec-rails'
|
10
|
-
end
|
11
|
-
|
12
|
-
group :development, :test do
|
13
|
-
gem "sqlite3"
|
14
|
-
gem 'watchr'
|
15
|
-
gem 'spork'
|
16
|
-
end
|
3
|
+
gem 'rails', '= 5.0.0.beta4', '< 5.1'
|
data/Gemfile.lock
CHANGED
@@ -1,115 +1,115 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
|
5
|
-
actionpack (=
|
6
|
-
|
4
|
+
actioncable (5.0.0.beta4)
|
5
|
+
actionpack (= 5.0.0.beta4)
|
6
|
+
nio4r (~> 1.2)
|
7
|
+
websocket-driver (~> 0.6.1)
|
8
|
+
actionmailer (5.0.0.beta4)
|
9
|
+
actionpack (= 5.0.0.beta4)
|
10
|
+
actionview (= 5.0.0.beta4)
|
11
|
+
activejob (= 5.0.0.beta4)
|
7
12
|
mail (~> 2.5, >= 2.5.4)
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
rack
|
13
|
-
|
14
|
-
|
13
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
14
|
+
actionpack (5.0.0.beta4)
|
15
|
+
actionview (= 5.0.0.beta4)
|
16
|
+
activesupport (= 5.0.0.beta4)
|
17
|
+
rack (~> 2.x)
|
18
|
+
rack-test (~> 0.6.3)
|
19
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
20
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
21
|
+
actionview (5.0.0.beta4)
|
22
|
+
activesupport (= 5.0.0.beta4)
|
15
23
|
builder (~> 3.1)
|
16
24
|
erubis (~> 2.7.0)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
26
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
27
|
+
activejob (5.0.0.beta4)
|
28
|
+
activesupport (= 5.0.0.beta4)
|
29
|
+
globalid (>= 0.3.6)
|
30
|
+
activemodel (5.0.0.beta4)
|
31
|
+
activesupport (= 5.0.0.beta4)
|
32
|
+
activerecord (5.0.0.beta4)
|
33
|
+
activemodel (= 5.0.0.beta4)
|
34
|
+
activesupport (= 5.0.0.beta4)
|
35
|
+
arel (~> 7.0)
|
36
|
+
activesupport (5.0.0.beta4)
|
37
|
+
concurrent-ruby (~> 1.0)
|
38
|
+
i18n (~> 0.7)
|
27
39
|
minitest (~> 5.1)
|
28
|
-
thread_safe (~> 0.1)
|
29
40
|
tzinfo (~> 1.1)
|
30
|
-
arel (
|
41
|
+
arel (7.0.0)
|
31
42
|
builder (3.2.2)
|
32
|
-
|
33
|
-
mime-types (>= 1.16)
|
34
|
-
nokogiri (>= 1.3.3)
|
35
|
-
rack (>= 1.0.0)
|
36
|
-
rack-test (>= 0.5.4)
|
37
|
-
xpath (~> 2.0)
|
38
|
-
diff-lcs (1.2.5)
|
43
|
+
concurrent-ruby (1.0.2)
|
39
44
|
erubis (2.7.0)
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
45
|
+
globalid (0.3.6)
|
46
|
+
activesupport (>= 4.1.0)
|
47
|
+
i18n (0.7.0)
|
48
|
+
json (1.8.3)
|
49
|
+
loofah (2.0.3)
|
50
|
+
nokogiri (>= 1.5.9)
|
51
|
+
mail (2.6.4)
|
52
|
+
mime-types (>= 1.16, < 4)
|
53
|
+
method_source (0.8.2)
|
54
|
+
mime-types (3.0)
|
55
|
+
mime-types-data (~> 3.2015)
|
56
|
+
mime-types-data (3.2016.0221)
|
57
|
+
mini_portile2 (2.0.0)
|
58
|
+
minitest (5.9.0)
|
59
|
+
nio4r (1.2.1)
|
60
|
+
nokogiri (1.6.7.2)
|
61
|
+
mini_portile2 (~> 2.0.0.rc2)
|
62
|
+
rack (2.0.0.rc1)
|
63
|
+
json
|
64
|
+
rack-test (0.6.3)
|
53
65
|
rack (>= 1.0)
|
54
|
-
rails (
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
66
|
+
rails (5.0.0.beta4)
|
67
|
+
actioncable (= 5.0.0.beta4)
|
68
|
+
actionmailer (= 5.0.0.beta4)
|
69
|
+
actionpack (= 5.0.0.beta4)
|
70
|
+
actionview (= 5.0.0.beta4)
|
71
|
+
activejob (= 5.0.0.beta4)
|
72
|
+
activemodel (= 5.0.0.beta4)
|
73
|
+
activerecord (= 5.0.0.beta4)
|
74
|
+
activesupport (= 5.0.0.beta4)
|
61
75
|
bundler (>= 1.3.0, < 2.0)
|
62
|
-
railties (=
|
63
|
-
sprockets-rails (
|
64
|
-
|
65
|
-
|
66
|
-
|
76
|
+
railties (= 5.0.0.beta4)
|
77
|
+
sprockets-rails (>= 2.0.0)
|
78
|
+
rails-deprecated_sanitizer (1.0.3)
|
79
|
+
activesupport (>= 4.2.0.alpha)
|
80
|
+
rails-dom-testing (1.0.7)
|
81
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
82
|
+
nokogiri (~> 1.6.0)
|
83
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
84
|
+
rails-html-sanitizer (1.0.3)
|
85
|
+
loofah (~> 2.0)
|
86
|
+
railties (5.0.0.beta4)
|
87
|
+
actionpack (= 5.0.0.beta4)
|
88
|
+
activesupport (= 5.0.0.beta4)
|
89
|
+
method_source
|
67
90
|
rake (>= 0.8.7)
|
68
91
|
thor (>= 0.18.1, < 2.0)
|
69
|
-
rake (
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
rspec-rails (3.1.0)
|
78
|
-
actionpack (>= 3.0)
|
79
|
-
activesupport (>= 3.0)
|
80
|
-
railties (>= 3.0)
|
81
|
-
rspec-core (~> 3.1.0)
|
82
|
-
rspec-expectations (~> 3.1.0)
|
83
|
-
rspec-mocks (~> 3.1.0)
|
84
|
-
rspec-support (~> 3.1.0)
|
85
|
-
rspec-support (3.1.2)
|
86
|
-
spork (0.9.2)
|
87
|
-
sprockets (2.12.3)
|
88
|
-
hike (~> 1.2)
|
89
|
-
multi_json (~> 1.0)
|
90
|
-
rack (~> 1.0)
|
91
|
-
tilt (~> 1.1, != 1.3.0)
|
92
|
-
sprockets-rails (2.2.0)
|
93
|
-
actionpack (>= 3.0)
|
94
|
-
activesupport (>= 3.0)
|
95
|
-
sprockets (>= 2.8, < 4.0)
|
96
|
-
sqlite3 (1.3.10)
|
92
|
+
rake (11.1.2)
|
93
|
+
sprockets (3.6.0)
|
94
|
+
concurrent-ruby (~> 1.0)
|
95
|
+
rack (> 1, < 3)
|
96
|
+
sprockets-rails (3.0.4)
|
97
|
+
actionpack (>= 4.0)
|
98
|
+
activesupport (>= 4.0)
|
99
|
+
sprockets (>= 3.0.0)
|
97
100
|
thor (0.19.1)
|
98
|
-
thread_safe (0.3.
|
99
|
-
tilt (1.4.1)
|
101
|
+
thread_safe (0.3.5)
|
100
102
|
tzinfo (1.2.2)
|
101
103
|
thread_safe (~> 0.1)
|
102
|
-
|
103
|
-
|
104
|
-
|
104
|
+
websocket-driver (0.6.3)
|
105
|
+
websocket-extensions (>= 0.1.0)
|
106
|
+
websocket-extensions (0.1.2)
|
105
107
|
|
106
108
|
PLATFORMS
|
107
109
|
ruby
|
108
110
|
|
109
111
|
DEPENDENCIES
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
sqlite3
|
115
|
-
watchr
|
112
|
+
rails (= 5.0.0.beta4, < 5.1)
|
113
|
+
|
114
|
+
BUNDLED WITH
|
115
|
+
1.12.2
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -4,7 +4,8 @@ Stones
|
|
4
4
|
Each time I created a new Rails project these files are required.
|
5
5
|
I got tired of it and collected them in a gem.
|
6
6
|
|
7
|
-
Some files (e.g. reset.css)
|
7
|
+
Some files (e.g. reset.css) can be overwritten by a
|
8
|
+
corresponding ones from your project.
|
8
9
|
Some files (e.g. .watchr) may be copied to your project.
|
9
10
|
|
10
11
|
|
@@ -21,14 +22,30 @@ Files:
|
|
21
22
|
app/views/layouts/_body.slim
|
22
23
|
app/views/layouts/_flash.slim
|
23
24
|
app/views/layouts/_footer.slim
|
25
|
+
app/views/layouts/_header.slim
|
24
26
|
app/views/layouts/_html_head.slim
|
27
|
+
app/views/layouts/_nav.slim
|
25
28
|
app/views/shared/_error_explanation.html.erb
|
26
29
|
config/initializers/concerns.rb
|
30
|
+
.watchr
|
27
31
|
|
32
|
+
Installation
|
33
|
+
------------
|
34
|
+
To install add the following to your Gemfile:
|
35
|
+
|
36
|
+
gem 'stones'
|
37
|
+
|
38
|
+
and run bundle.
|
28
39
|
|
29
40
|
Recommended
|
30
|
-
|
41
|
+
-----------
|
31
42
|
|
32
43
|
- rvm
|
33
|
-
- ruby 2.
|
34
|
-
- rails
|
44
|
+
- ruby 2.3.1
|
45
|
+
- rails 5.0
|
46
|
+
|
47
|
+
Dropped/cleaned files (still available in version 0.2.5):
|
48
|
+
|
49
|
+
- Rakefile
|
50
|
+
- .watchr
|
51
|
+
- lib/tasks/backup.rake
|
data/Rakefile
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
1
|
begin
|
4
2
|
require 'bundler'
|
5
3
|
require 'bundler/setup'
|
@@ -7,24 +5,9 @@ rescue LoadError
|
|
7
5
|
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
8
6
|
end
|
9
7
|
|
10
|
-
require 'rspec/core'
|
11
|
-
require 'rspec/core/rake_task'
|
12
|
-
|
13
8
|
Bundler::GemHelper.install_tasks
|
14
|
-
RSpec::Core::RakeTask.new(:spec)
|
15
|
-
|
16
|
-
task :default => :spec
|
17
|
-
|
18
9
|
|
19
10
|
desc "Clean automatically generated files"
|
20
11
|
task :clean do
|
21
12
|
FileUtils.rm_rf "pkg"
|
22
13
|
end
|
23
|
-
|
24
|
-
desc "Check syntax"
|
25
|
-
task :syntax do
|
26
|
-
Dir["**/*.rb"].each do |file|
|
27
|
-
print "#{file}: "
|
28
|
-
system("ruby -c #{file}")
|
29
|
-
end
|
30
|
-
end
|
@@ -9,47 +9,38 @@ dl, dt, dd, ol, ul, li,
|
|
9
9
|
fieldset, form, label, legend,
|
10
10
|
table, caption, tbody, tfoot, thead, tr, th, td, hr,
|
11
11
|
textarea {
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
font-size: 100%;
|
19
|
-
font-family: inherit;
|
20
|
-
vertical-align: baseline;
|
21
|
-
}
|
22
|
-
|
23
|
-
/* remember to define focus styles! */
|
24
|
-
:focus {
|
25
|
-
outline: 0;
|
12
|
+
margin: 0;
|
13
|
+
padding: 0;
|
14
|
+
border: 0;
|
15
|
+
outline: 0;
|
16
|
+
font-size: 100%;
|
17
|
+
vertical-align: baseline;
|
26
18
|
}
|
27
19
|
|
28
20
|
body {
|
29
|
-
|
30
|
-
|
31
|
-
|
21
|
+
line-height: 1;
|
22
|
+
color: black;
|
23
|
+
background: white;
|
32
24
|
}
|
25
|
+
a img {border:none;}
|
26
|
+
ins {text-decoration: none;}
|
27
|
+
del {text-decoration: line-through;}
|
33
28
|
|
34
|
-
|
35
|
-
|
36
|
-
}
|
29
|
+
:focus { outline: 0; }
|
30
|
+
ol, ul { list-style: none; }
|
37
31
|
|
38
32
|
/* tables still need 'cellspacing="0"' in the markup */
|
39
33
|
table {
|
40
|
-
|
41
|
-
|
34
|
+
border-collapse: collapse;
|
35
|
+
border-spacing: 0;
|
42
36
|
}
|
43
|
-
|
44
37
|
caption, th, td {
|
45
|
-
|
46
|
-
|
47
|
-
}
|
48
|
-
|
49
|
-
blockquote:before, blockquote:after, q:before, q:after {
|
50
|
-
content: "";
|
38
|
+
text-align: left;
|
39
|
+
font-weight: normal;
|
51
40
|
}
|
52
41
|
|
53
|
-
blockquote, q {
|
54
|
-
|
42
|
+
blockquote, q { quotes: none; }
|
43
|
+
blockquote:before, blockquote:after,
|
44
|
+
q:before, q:after {
|
45
|
+
content: "";
|
55
46
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
- (flash || {}).each do |key, value|
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
p(class="flash_#{key}") #{sanitize(value)}
|
3
|
+
- if key.to_s == 'notice'
|
4
|
+
script(type="text/javascript")
|
5
|
+
| $('.flash_notice').fadeOut(5000, function() { $(this).remove(); });
|
data/lib/stones/version.rb
CHANGED
data/stones.gemspec
CHANGED
@@ -1,10 +1,9 @@
|
|
1
|
-
lib = File.expand_path('../lib
|
2
|
-
|
3
|
-
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require 'stones/version'
|
5
4
|
|
6
5
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
6
|
+
s.name = 'stones'
|
8
7
|
s.version = Stones::VERSION
|
9
8
|
s.platform = Gem::Platform::RUBY
|
10
9
|
s.summary = "Stones contains some basic files."
|
@@ -12,16 +11,13 @@ Gem::Specification.new do |s|
|
|
12
11
|
s.authors = ['Dittmar Krall']
|
13
12
|
s.email = ['dittmar.krall@matique.de']
|
14
13
|
s.homepage = 'http://matique.de'
|
14
|
+
s.license = 'MIT'
|
15
|
+
|
15
16
|
s.files = `git ls-files`.split("\n")
|
16
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
|
+
# s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
# s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
19
|
s.require_paths = ["lib"]
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
# s.add_runtime_dependency "rest-client"
|
23
|
-
|
24
|
-
# s.add_development_dependency "sqlite3" # for testing
|
25
|
-
# s.add_development_dependency "rspec-rails"
|
26
|
-
# s.add_development_dependency "capybara"
|
21
|
+
s.add_development_dependency 'bundler'
|
22
|
+
s.add_development_dependency 'rake'
|
27
23
|
end
|
metadata
CHANGED
@@ -1,15 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stones
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dittmar Krall
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
11
|
+
date: 2016-06-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
13
41
|
description: A collection of, hopefully, useful files.
|
14
42
|
email:
|
15
43
|
- dittmar.krall@matique.de
|
@@ -19,7 +47,6 @@ extra_rdoc_files: []
|
|
19
47
|
files:
|
20
48
|
- ".ruby-gemset"
|
21
49
|
- ".ruby-version"
|
22
|
-
- ".watchr"
|
23
50
|
- Gemfile
|
24
51
|
- Gemfile.lock
|
25
52
|
- MIT-LICENSE
|
@@ -35,6 +62,7 @@ files:
|
|
35
62
|
- app/views/layouts/_body.slim
|
36
63
|
- app/views/layouts/_flash.slim
|
37
64
|
- app/views/layouts/_footer.slim
|
65
|
+
- app/views/layouts/_header.slim
|
38
66
|
- app/views/layouts/_html_head.slim
|
39
67
|
- app/views/layouts/application.html.erb
|
40
68
|
- app/views/shared/_error_explanation.html.erb
|
@@ -42,10 +70,10 @@ files:
|
|
42
70
|
- lib/stones.rb
|
43
71
|
- lib/stones/engine.rb
|
44
72
|
- lib/stones/version.rb
|
45
|
-
- lib/tasks/backup.rake
|
46
73
|
- stones.gemspec
|
47
74
|
homepage: http://matique.de
|
48
|
-
licenses:
|
75
|
+
licenses:
|
76
|
+
- MIT
|
49
77
|
metadata: {}
|
50
78
|
post_install_message:
|
51
79
|
rdoc_options: []
|
@@ -63,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
91
|
version: '0'
|
64
92
|
requirements: []
|
65
93
|
rubyforge_project:
|
66
|
-
rubygems_version: 2.
|
94
|
+
rubygems_version: 2.5.1
|
67
95
|
signing_key:
|
68
96
|
specification_version: 4
|
69
97
|
summary: Stones contains some basic files.
|
data/.watchr
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
HH = '#' * 22 unless defined?(HH)
|
2
|
-
H = '#' * 5 unless defined?(H)
|
3
|
-
|
4
|
-
def usage
|
5
|
-
puts <<-EOS
|
6
|
-
Ctrl-\\ or ctrl-4 Running all tests
|
7
|
-
Ctrl-C Exit
|
8
|
-
EOS
|
9
|
-
end
|
10
|
-
|
11
|
-
def run(cmd)
|
12
|
-
puts "#{HH} #{Time.now} #{HH}"
|
13
|
-
puts "#{H} #{cmd}"
|
14
|
-
system "/usr/bin/time --format '#{HH} Elapsed time %E' #{cmd}"
|
15
|
-
end
|
16
|
-
|
17
|
-
def run_it(type, file)
|
18
|
-
case type
|
19
|
-
when 'test'; run %Q{ruby -I"lib:test" -rubygems #{file}}
|
20
|
-
when 'spec'; run %Q{rspec -X #{file}}
|
21
|
-
else; puts "#{H} unknown type: #{type}, file: #{file}"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def run_all_tests
|
26
|
-
puts "\n#{HH} Running all tests #{HH}\n"
|
27
|
-
%w{test spec}.each { |dir| run "rake #{dir}" if File.exists?(dir) }
|
28
|
-
end
|
29
|
-
|
30
|
-
def run_matching_files(base)
|
31
|
-
base = base.split('_').first
|
32
|
-
%w{test spec}.each { |type|
|
33
|
-
files = Dir["#{type}/**/*.rb"].select { |file| file =~ /#{base}_.*\.rb/ }
|
34
|
-
run_it type, files.join(' ') unless files.empty?
|
35
|
-
}
|
36
|
-
end
|
37
|
-
|
38
|
-
%w{test spec}.each { |type|
|
39
|
-
watch("#{type}/#{type}_helper\.rb") { run_all_tests }
|
40
|
-
watch("#{type}/.*/*_#{type}\.rb") { |match| run_it type, match[0] }
|
41
|
-
}
|
42
|
-
%w{rb erb haml slim}.each { |type|
|
43
|
-
watch("app/.*/.*\.#{type}") { |m|
|
44
|
-
run_matching_files("#{m[0].split('/').at(2).split('.').first}")
|
45
|
-
}
|
46
|
-
}
|
47
|
-
|
48
|
-
# Ctrl-\ or ctrl-4
|
49
|
-
Signal.trap('QUIT') { run_all_tests }
|
50
|
-
# Ctrl-C
|
51
|
-
Signal.trap('INT') { abort("Interrupted\n") }
|
52
|
-
usage
|
data/lib/tasks/backup.rake
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
def dir
|
2
|
-
unless @dir
|
3
|
-
@dir = "#{Rails.root}/db/backup"
|
4
|
-
FileUtils.mkdir_p(@dir)
|
5
|
-
end
|
6
|
-
@dir
|
7
|
-
end
|
8
|
-
|
9
|
-
def interesting_tables
|
10
|
-
rval = ActiveRecord::Base.connection.tables.sort
|
11
|
-
rval.reject! do |tbl|
|
12
|
-
['schema_migrations','schema_info', 'sessions', 'public_exceptions'].include?(tbl)
|
13
|
-
end
|
14
|
-
rval
|
15
|
-
end
|
16
|
-
|
17
|
-
namespace :db do
|
18
|
-
namespace :backup do
|
19
|
-
|
20
|
-
desc "Dump entire db."
|
21
|
-
task :write => :environment do
|
22
|
-
FileUtils.chdir(dir)
|
23
|
-
interesting_tables.each do |tbl|
|
24
|
-
klass = tbl.classify.constantize
|
25
|
-
puts "Writing #{tbl}..."
|
26
|
-
File.open("#{tbl}.yml", 'w+') { |f| YAML.dump klass.find(:all).collect(&:attributes), f }
|
27
|
-
end
|
28
|
-
FileUtils.chdir(Rails.root)
|
29
|
-
end
|
30
|
-
|
31
|
-
desc "Loads the entire db."
|
32
|
-
task :read => [:environment, 'db:schema:load'] do
|
33
|
-
FileUtils.chdir(dir)
|
34
|
-
|
35
|
-
interesting_tables.each do |tbl|
|
36
|
-
ActiveRecord::Base.transaction do
|
37
|
-
begin
|
38
|
-
klass = tbl.classify.constantize
|
39
|
-
klass.destroy_all
|
40
|
-
klass.reset_column_information
|
41
|
-
|
42
|
-
puts "Loading #{tbl}..."
|
43
|
-
YAML.load_file("#{tbl}.yml").each do |fixture|
|
44
|
-
data = {}
|
45
|
-
klass.columns.each do |c|
|
46
|
-
# filter out missing columns
|
47
|
-
data[c.name] = fixture[c.name] if fixture[c.name]
|
48
|
-
end
|
49
|
-
sql = "INSERT INTO #{tbl} "
|
50
|
-
sql += "(#{data.keys.map{|kk| "#{kk}"}.join(",")}) "
|
51
|
-
sql += "VALUES (#{data.values.collect { |value| ActiveRecord::Base.connection.quote(value) }.join(",")})"
|
52
|
-
|
53
|
-
ActiveRecord::Base.connection.execute sql, 'Fixture Insert'
|
54
|
-
end
|
55
|
-
rescue Exception => exc
|
56
|
-
puts "failed to load table #{tbl}; Exception: #{exc}"
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
desc "Loads a table; e.g. rake db:backup:load[users]"
|
63
|
-
task :load, [:table] => :environment do |t, args|
|
64
|
-
FileUtils.chdir(dir)
|
65
|
-
|
66
|
-
tbl = args.table
|
67
|
-
ActiveRecord::Base.transaction do
|
68
|
-
begin
|
69
|
-
klass = tbl.classify.constantize
|
70
|
-
klass.reset_column_information
|
71
|
-
puts "Loading #{tbl}..."
|
72
|
-
YAML.load_file("#{tbl}.yml").each do |fixture|
|
73
|
-
data = {}
|
74
|
-
klass.columns.each do |c|
|
75
|
-
# filter out missing columns
|
76
|
-
data[c.name] = fixture[c.name] if fixture[c.name]
|
77
|
-
end
|
78
|
-
sql = "INSERT INTO #{tbl} "
|
79
|
-
sql += "(#{data.keys.map{|kk| "#{kk}"}.join(",")}) "
|
80
|
-
sql += "VALUES (#{data.values.collect { |value| ActiveRecord::Base.connection.quote(value) }.join(",")})"
|
81
|
-
|
82
|
-
ActiveRecord::Base.connection.execute sql, 'Fixture Insert'
|
83
|
-
|
84
|
-
end
|
85
|
-
rescue Exception => exc
|
86
|
-
puts "failed to load table #{tbl}; Exception: #{exc}"
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
end
|
92
|
-
end
|