hq-dev 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/bin/hq-dev-init CHANGED
@@ -26,35 +26,59 @@ def write_file name, lines
26
26
 
27
27
  end
28
28
 
29
- gem_versions = Hash[
30
- File.new("#{DEV_DIR}/data/gem-versions")
31
- .to_a
32
- .map { |line| line.split " " }
33
- ]
29
+ def warn_if_not_exists name
34
30
 
35
- puts "creating Rakefile"
36
- FileUtils.copy_entry "#{DEV_DIR}/templates/rakefile", "Rakefile"
31
+ if File.exist? name
37
32
 
38
- puts "creating #{PROJECT}.gemspec"
39
- FileUtils.copy_entry "#{DEV_DIR}/templates/gemspec", "#{PROJECT}.gemspec"
33
+ puts "not touching #{name}"
40
34
 
41
- puts "creating Gemfile"
42
- FileUtils.copy_entry "#{DEV_DIR}/templates/gemfile", "Gemfile"
35
+ else
36
+
37
+ puts "PLEASE CREATE: #{name}"
38
+
39
+ found_problem = true
40
+
41
+ end
43
42
 
44
- if File.exist? ".gitignore"
45
- puts "not touching .gitignore"
46
- else
47
- puts "creating .gitignore"
48
- FileUtils.copy_entry "#{DEV_DIR}/templates/gemfile", ".gitignore"
49
43
  end
50
44
 
51
- if File.exist? ".travis.yml"
52
- puts "not touching .travis.yml"
53
- else
54
- puts "creating .travis.yml"
55
- FileUtils.copy_entry "#{DEV_DIR}/templates/travis", ".travis.yml"
45
+ def copy_if_not_exists from, to
46
+
47
+ if File.exist? to
48
+
49
+ puts "not touching #{to}"
50
+
51
+ else
52
+
53
+ puts "creating #{to}"
54
+
55
+ FileUtils.copy_entry "#{DEV_DIR}/#{from}", to
56
+
57
+ end
58
+
56
59
  end
57
60
 
61
+ def copy_overwrite from, to
62
+
63
+ puts "creating #{to}"
64
+
65
+ FileUtils.copy_entry "#{DEV_DIR}/#{from}", to
66
+
67
+ end
68
+
69
+ gem_versions = Hash[
70
+ File.new("#{DEV_DIR}/data/gem-versions")
71
+ .to_a
72
+ .map { |line| line.split " " }
73
+ ]
74
+
75
+ copy_overwrite "templates/rakefile", "Rakefile"
76
+ copy_overwrite "templates/gemspec", "#{PROJECT}.gemspec"
77
+ copy_overwrite "templates/gemfile", "Gemfile"
78
+
79
+ copy_if_not_exists "templates/gitignore", ".gitignore"
80
+ copy_if_not_exists "templates/travis", ".travis.yml"
81
+
58
82
  unless Dir.exist? ".hq-dev"
59
83
  puts "creating .hq-dev"
60
84
  FileUtils.mkdir ".hq-dev"
@@ -71,48 +95,31 @@ else
71
95
  end
72
96
 
73
97
  if File.exist? ".hq-dev/development-dependencies"
74
-
75
98
  puts "not touching .hq-dev/development-dependencies"
76
-
77
99
  else
78
-
79
100
  puts "creating .hq-dev/development-dependencies"
80
-
81
101
  default_development_dependencies =
82
102
  File.new("#{DEV_DIR}/data/default-development-dependencies")
83
103
  .to_a
84
104
  .map { |line| line.strip }
85
105
  .map {
86
106
  |name|
87
-
88
107
  raise "no version for gem #{name}" \
89
108
  unless gem_versions[name]
90
-
91
109
  "#{name} #{gem_versions[name]}"
92
-
93
110
  }
94
-
95
111
  write_file \
96
112
  ".hq-dev/development-dependencies",
97
113
  default_development_dependencies
98
-
99
114
  end
100
115
 
101
116
  found_problem = false
102
117
 
103
- if File.exist? ".hq-dev/full-name"
104
- puts "not touching .hq-dev/full-name"
105
- else
106
- puts "PLEASE CREATE: .hq-dev/full-name"
107
- found_problem = true
108
- end
118
+ warn_if_not_exists ".hq-dev/description"
119
+ warn_if_not_exists ".hq-dev/full-name"
109
120
 
110
- if File.exist? ".hq-dev/description"
111
- puts "not touching .hq-dev/description"
112
- else
113
- puts "PLEASE CREATE: .hq-dev/description"
114
- found_problem = true
115
- end
121
+ copy_if_not_exists "defaults/files", ".hq-dev/files"
122
+ copy_if_not_exists "defaults/test-files", ".hq-dev/test-files"
116
123
 
117
124
  unless found_problem
118
125
  puts "done!"
data/data/gem-versions ADDED
@@ -0,0 +1,16 @@
1
+ bson_ext 1.8.5
2
+ capybara 2.0.2
3
+ cucumber 1.3.1
4
+ hq-engine 0.0.3
5
+ hq-tools 0.8.0
6
+ hq-web 0.0.2
7
+ json 1.7.7
8
+ libxml-ruby 2.6.0
9
+ mongo 1.8.5
10
+ multi_json 1.7.2
11
+ rack 1.5.1
12
+ rake 10.0.4
13
+ rrd-ffi 0.2.14
14
+ rspec 2.13.0
15
+ rspec_junit_formatter 0.1.6
16
+ simplecov 0.7.1
@@ -0,0 +1,7 @@
1
+ cucumber
2
+ hq-dev
3
+ json
4
+ rake
5
+ rspec
6
+ rspec_junit_formatter
7
+ simplecov
data/defaults/files ADDED
@@ -0,0 +1 @@
1
+ lib/**/*.rb
@@ -0,0 +1,3 @@
1
+ features/**/*.feature
2
+ features/**/*.rb
3
+ spec/**/*-spec.rb
data/templates/gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source "https://rubygems.org"
2
+ gemspec
data/templates/gemspec ADDED
@@ -0,0 +1,80 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $hq_project_path =
4
+ File.expand_path "..", __FILE__
5
+
6
+ module ::HQ
7
+
8
+ def self.project_param name
9
+ File.read("#{$hq_project_path}/.hq-dev/#{name}").strip
10
+ end
11
+
12
+ def self.project_include name
13
+ eval progect_param(name)
14
+ end
15
+
16
+ end
17
+
18
+ $hq_project_name =
19
+ HQ.project_param "name"
20
+
21
+ $hq_project_ver =
22
+ HQ.project_param "version"
23
+
24
+ $hq_project_full =
25
+ HQ.project_param "full-name"
26
+
27
+ $hq_project_desc =
28
+ HQ.project_param "description"
29
+
30
+ Gem::Specification.new do
31
+ |spec|
32
+
33
+ spec.name = $hq_project_name
34
+ spec.version = $hq_project_ver
35
+ spec.platform = Gem::Platform::RUBY
36
+ spec.authors = [ "James Pharaoh" ]
37
+ spec.email = [ "james@phsys.co.uk" ]
38
+ spec.homepage = "https://github.com/jamespharaoh/#{$hq_project_name}"
39
+ spec.summary = $hq_project_full
40
+ spec.description = $hq_project_desc
41
+ spec.required_rubygems_version = ">= 1.3.6"
42
+
43
+ spec.rubyforge_project = $hq_project_name
44
+
45
+ HQ.project_param("dependencies").split("\n").each do
46
+ |line|
47
+
48
+ name, version = line.split " "
49
+ spec.add_dependency name, ">= #{version}"
50
+
51
+ end
52
+
53
+ HQ.project_param("development-dependencies").split("\n").each do
54
+ |line|
55
+
56
+ name, version = line.split " "
57
+ spec.add_development_dependency name, ">= #{version}"
58
+
59
+ end
60
+
61
+ spec.files = Dir[
62
+ *HQ.project_param("files").split("\n")
63
+ ]
64
+
65
+ spec.test_files = Dir[
66
+ *HQ.project_param("test-files").split("\n")
67
+ ]
68
+
69
+ if Dir.exist? "bin"
70
+ spec.executables =
71
+ Dir.new("bin").entries - [ ".", ".." ]
72
+ end
73
+
74
+ Dir.mkdir "lib" unless Dir.exist? "lib"
75
+
76
+ spec.require_paths = Dir[
77
+ "lib",
78
+ ]
79
+
80
+ end
@@ -0,0 +1,6 @@
1
+ /.bundle
2
+ /.gems
3
+ /.stubs
4
+ /results
5
+ /test-configs
6
+ /*.gem
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "rspec/core/rake_task"
4
+ require "cucumber/rake/task"
5
+
6
+ default_targets = []
7
+ default_targets += :spec if Dir.exist? "spec"
8
+ default_targets += :features if Dir.exist? "features"
9
+
10
+ task :default => default_targets
11
+
12
+ desc "Run specs"
13
+ RSpec::Core::RakeTask.new :spec do
14
+ |task|
15
+
16
+ task.pattern = "spec/**/*-spec.rb"
17
+
18
+ task.rspec_opts = [
19
+
20
+ "--format progress",
21
+
22
+ "--format html",
23
+ "--out results/rspec.html",
24
+
25
+ "--format RspecJunitFormatter",
26
+ "--out results/rspec.xml",
27
+
28
+ ].join " "
29
+
30
+ task.ruby_opts = [
31
+ "-I lib",
32
+ ].join " "
33
+
34
+ end
35
+
36
+ desc "Run acceptance tests"
37
+ Cucumber::Rake::Task.new :features do
38
+ |task|
39
+
40
+ task.cucumber_opts = [
41
+
42
+ "features",
43
+
44
+ "--format progress",
45
+
46
+ "--format junit",
47
+ "--out", File.expand_path("results/features"),
48
+
49
+ "--format html",
50
+ "--out", File.expand_path("results/features.html"),
51
+
52
+ ].join " "
53
+
54
+ end
55
+
data/templates/travis ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hq-dev
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -116,6 +116,15 @@ executables:
116
116
  extensions: []
117
117
  extra_rdoc_files: []
118
118
  files:
119
+ - data/gem-versions
120
+ - defaults/test-files
121
+ - defaults/development-dependencies
122
+ - defaults/files
123
+ - templates/gitignore
124
+ - templates/rakefile
125
+ - templates/gemspec
126
+ - templates/travis
127
+ - templates/gemfile
119
128
  - bin/hq-dev-release
120
129
  - bin/hq-dev-init
121
130
  homepage: https://github.com/jamespharaoh/hq-dev