logirel 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
data/.semver CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 0
4
- :patch: 14
4
+ :patch: 15
5
5
  :special: ""
data/Rakefile.rb CHANGED
@@ -24,7 +24,7 @@ task :tag => :verify do
24
24
  Rake::Task["build"].invoke
25
25
 
26
26
  if `git tag`.split("\n").include?("#{v.to_s}")
27
- raise "Version #{v.to_s} has already been released"
27
+ raise "Version #{v.to_s} has already been released! You cannot release it twice."
28
28
  end
29
29
  puts 'adding'
30
30
  `git add Rakefile.rb`
@@ -42,4 +42,11 @@ task :push => :verify do
42
42
  `git push --tags`
43
43
  puts 'pushing'
44
44
  `git push`
45
+ end
46
+
47
+ desc "run specs, tag, push and release (to rubygems)"
48
+ task :all => [:verify] do
49
+ Rake::Task["spec"].invoke
50
+ Rake::Task["release"].invoke
51
+ Rake::Task["push"].invoke
45
52
  end
@@ -1,6 +1,9 @@
1
1
  require 'semver'
2
2
  require 'enumerator'
3
3
  require 'net/http'
4
+ require 'logirel/q_model'
5
+ require 'uuid'
6
+
4
7
 
5
8
  module Logirel
6
9
  class Initer
@@ -168,18 +171,12 @@ task :ci => ["env:release", :build, :package]
168
171
 
169
172
  def init_project_details(metadata)
170
173
  base_path = ensure_path @buildscripts_path
174
+ projects = {}
175
+ metadata.each{|m|
176
+ projects[:"#{m[:ruby_key]}"] = m #.select{|kv| :"#{kv[0]}" != :"ruby_key"}
177
+ }
171
178
  File.open(File.join(base_path, "project_details.rb"), "w+") do |f|
172
- f.puts "Projects = {"
173
- # m = ["my key", value]
174
- # projects[m[0]] = value
175
- metadata.keys.each_with_index do |key, index|
176
- if index == metadata.length-1
177
- f.puts ":#{key} = #{p(metadata[key])}"
178
- else
179
- f.puts ":#{key} = #{p(metadata[key])},"
180
- end
181
- end
182
- f.puts "}"
179
+ f.puts "Projects = #{p(projects)}"
183
180
  end
184
181
  end
185
182
 
@@ -188,5 +185,25 @@ task :ci => ["env:release", :build, :package]
188
185
  Dir.mkdir base_path unless Dir.exists? base_path
189
186
  base_path
190
187
  end
188
+
189
+ def meta_for p, dir
190
+ base = File.basename(p)
191
+
192
+ puts "META DATA FOR: '#{base}'"
193
+ p_dir = File.join(dir, base)
194
+
195
+ {
196
+ :title => StrQ.new("Title", base).exec,
197
+ :dir => p_dir,
198
+ :test_dir => StrQ.new("Test Directory", base + ".Tests").exec,
199
+ :description => StrQ.new("Description", "Missing description for #{base}").exec,
200
+ :copyright => StrQ.new("Copyright").exec,
201
+ :authors => StrQ.new("Authors").exec,
202
+ :company => StrQ.new("Company").exec,
203
+ :nuget_key => StrQ.new("NuGet key", base).exec,
204
+ :ruby_key => StrQ.new("Ruby key (e.g. 'autotx')", nil, STDIN, lambda { |s| s != nil && s.length > 0 }).exec,
205
+ :guid => UUID.new.generate
206
+ }
207
+ end
191
208
  end
192
209
  end
data/lib/logirel/cli.rb CHANGED
@@ -27,7 +27,7 @@ module Logirel
27
27
  }
28
28
 
29
29
  src_folders = Initer.new('.').parse_folders.inspect
30
- dir = folder.call("Source Directory. Default contains (#{src_folders})", "src").exec
30
+ dir = folder.call("Source Directory. Default (src) contains (#{src_folders})", "src").exec
31
31
  buildscripts = folder.call("Buildscripts Directory", "buildscripts").exec
32
32
  tools = folder.call("Tools Directory", "tools").exec
33
33
  initer = Initer.new(".")
@@ -50,32 +50,24 @@ module Logirel
50
50
  puts "Project Meta-Data Definitions"
51
51
  puts "-----------------------------"
52
52
  puts "Let's set up some meta-data!"
53
- metas = selected_projs.map do |p|
54
-
55
- base = File.basename(p)
56
-
57
- puts "META DATA FOR: '#{base}'"
58
- p_dir = File.join(dir, base)
59
-
60
- {
61
- :dir => p_dir,
62
- :title => StrQ.new("Title", base).exec,
63
- :test_dir => StrQ.new("Test Directory", base + ".Tests").exec,
64
- :description => StrQ.new("Description", "of #{base}").exec,
65
- :copyright => StrQ.new("Copyright").exec,
66
- :authors => StrQ.new("Authors").exec,
67
- :company => StrQ.new("Company").exec,
68
- :nuget_key => StrQ.new("NuGet key", base).exec,
69
- :ruby_key => StrQ.new("Ruby key (e.g. 'autotx')").exec,
70
- :guid => UUID.new
71
- }
72
- end
53
+ metas = selected_projs.map{|p| initer.meta_for p, dir }
73
54
 
55
+ puts "initing project details"
74
56
  initer.init_project_details(metas)
75
- initer.init_path_rb(metas)
76
- initer.init_environement_rb
57
+
58
+ puts "initing paths"
59
+ initer.init_path_rb(metas)
60
+
61
+ puts "initing environment"
62
+ initer.init_environement_rb
63
+
64
+ puts "initing gemfile"
77
65
  initer.init_gemfile
66
+
67
+ puts "initing utils"
78
68
  initer.init_utils
69
+
70
+ puts "initing meta-datas"
79
71
  initer.init_rakefile(metas)
80
72
  end
81
73
  end
@@ -52,9 +52,11 @@ module Logirel
52
52
 
53
53
  def exec
54
54
  @io_target.print @question + " [#{@default}]: "
55
+ valid = false
55
56
  begin
56
57
  @answer = @io_source.gets.chomp
57
- end while !@answer.empty? && !@validator.call(@answer)
58
+ valid = @validator.call(@answer)
59
+ end while !valid || (!valid && @answer.empty?)
58
60
  @answer = @answer.empty? ? @default : @answer
59
61
  @io_target.puts "Chose '#{@answer}'."
60
62
  @answer
@@ -47,10 +47,10 @@ describe Initer, "setting up folder structure" do
47
47
  end
48
48
 
49
49
  it "should create project_details.rb" do
50
- @r.init_project_details({
50
+ @r.init_project_details([{
51
51
  :ruby_key => "p_ruby",
52
52
  :dir => "p_dir"
53
- })
53
+ }])
54
54
  File.exists?(File.join(@bs, "project_details.rb")).should be_true
55
55
  end
56
56
  end
@@ -45,10 +45,10 @@ describe Logirel::StrQ, "when accepting the defaults" do
45
45
  @out = StringIO.new
46
46
 
47
47
  @validator = double('validator')
48
- @validator.should_receive(:call).never.
48
+ @validator.should_receive(:call).once.
49
49
  with(an_instance_of(String)).
50
- # the validator should never be called for empty input if we have a default
51
- and_return(false)
50
+ # the validator should be called for empty input once if we have a default, directly when defaulting with validator{true}
51
+ and_return(true)
52
52
  end
53
53
  subject { StrQ.new("q?", "def", @io, @validator, @out) }
54
54
  specify {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logirel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-06-29 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &20363640 !ruby/object:Gem::Requirement
16
+ requirement: &20461944 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.6.0
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *20363640
24
+ version_requirements: *20461944
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: memoize
27
- requirement: &20363364 !ruby/object:Gem::Requirement
27
+ requirement: &20461668 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *20363364
35
+ version_requirements: *20461668
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: devver-construct
38
- requirement: &20363052 !ruby/object:Gem::Requirement
38
+ requirement: &20461356 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *20363052
46
+ version_requirements: *20461356
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: albacore
49
- requirement: &20362536 !ruby/object:Gem::Requirement
49
+ requirement: &20460840 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.2.5
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *20362536
57
+ version_requirements: *20460840
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: semver
60
- requirement: &20362056 !ruby/object:Gem::Requirement
60
+ requirement: &20460360 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.0.6
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *20362056
68
+ version_requirements: *20460360
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
- requirement: &20361588 !ruby/object:Gem::Requirement
71
+ requirement: &20459892 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 1.0.14
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *20361588
79
+ version_requirements: *20459892
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: thor
82
- requirement: &20361192 !ruby/object:Gem::Requirement
82
+ requirement: &20459496 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *20361192
90
+ version_requirements: *20459496
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: uuid
93
- requirement: &20360760 !ruby/object:Gem::Requirement
93
+ requirement: &20459064 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: '0'
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *20360760
101
+ version_requirements: *20459064
102
102
  description: ! "The gem works by having as its dependencies \n everything you need
103
103
  to get started with OSS and proprietary .Net coding.\n The aim of the gem is to
104
104
  allow developers to get up and running quickly\n and provide a nice way of converting