dev_commands 0.0.30 → 0.0.31

Sign up to get free protection for your applications and to get access to all the features.
data/lib/dev_commands.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'json'
2
2
  require 'rake/clean'
3
3
 
4
- CLEAN.include('obj')
4
+ CLEAN.include('obj','tmp')
5
5
  CLEAN.include('**/*.{sdf,sud,ncb,cache,user}')
6
6
  CLOBBER.include('bin','doc','*.gem','tmp')
7
7
  CLOBBER.include('**/*.{dll,pdb}')
data/lib/publish.rb CHANGED
@@ -5,66 +5,6 @@ class Publish < Array
5
5
  Dir.glob('*.gemspec').each{|gemspec_file|
6
6
  add "gem push #{Gemspec.gemfile(gemspec_file)}" if !Gemspec.published? gemspec_file
7
7
  }
8
-
9
- if(defined?(PUBLISH_PATH))
10
- if(PUBLISH_PATH.include?('svn://') && File.exists?('.svn') && defined?(ARTIFACTS))
11
-
12
- latestRev=Publish.svn_latest_revision
13
- svn_publish_uri="#{PUBLISH_PATH}/#{Publish.relative_directory}-#{latestRev}"
14
- local_dir="#{Command.dev_root}/tmp/#{Publish.relative_directory}@#{latestRev}"
15
- FileUtils.mkdir_p(File.dirname(local_dir)) if(!File.exists?(File.dirname(local_dir)))
16
- dep_dir="#{Command.dev_root}/dep/#{Publish.relative_directory}@#{latestRev}"
17
- svn_info=`svn info #{svn_publish_uri} 2>&1`
18
- if(svn_info.include?('URL:'))
19
- #puts "#{svn_publish_uri} already exists."
20
- else
21
- #Console.debug "adding publish commands.."
22
- add "svn mkdir #{svn_publish_uri} --parents -m\"publish\""
23
- add "svn checkout #{svn_publish_uri} #{local_dir}"
24
- add "<%Publish.copy_files(ARTIFACTS,'#{local_dir}')%>"
25
- add "<%Publish.svn_add_all('#{local_dir}')%>"
26
- add "svn commit #{local_dir}@ -m\"publish\""
27
- add "<%FileUtils.rm_r('#{local_dir}')%>"
28
- end
29
- end
30
- end
31
8
  end
32
9
  end
33
-
34
- def self.copy_files files,dest
35
- #Console.debug("Environment.copy_files([#{files.to_s}],'#{dest}'')")
36
- files.each{|f|
37
- if(File.directory?(dest))
38
- dest_file = "#{dest}/#{f}"
39
- #Console.debug "copying #{f} to #{dest_file}"
40
- FileUtils.mkdir_p(File.dirname(dest_file)) if(!File.exists?(File.dirname(dest_file)))
41
- FileUtils.cp(f,dest_file)
42
- end
43
- }
44
- end
45
-
46
- def self.svn_add_all dir
47
- Dir.chdir(dir) do
48
- Dir.glob('**/*').each{|f|
49
- puts `svn add #{f} --parents` if(!File.directory?(f))
50
- }
51
- end
52
- end
53
-
54
- def self.svn_latest_revision
55
- if(Dir.exists?(".svn"))
56
- `svn info`.scan(/Last Changed Rev: ([\d]+)/).each{|m|
57
- return m.first.to_s
58
- }
59
- end
60
- "0"
61
- end
62
- def self.context
63
- dir =Rake.application.original_dir.gsub(Command.dev_root + '/','')
64
- return dir.split('/').first
65
- end
66
-
67
- def self.relative_directory
68
- Rake.application.original_dir.gsub(Command.dev_root + '/' + Publish.context + '/','')
69
- end
70
10
  end
@@ -41,8 +41,8 @@ describe Commands do
41
41
  expect(File.exists?('cpp-library/bin/Debug/cpp-library.dll')).to eq(false)
42
42
  expect(File.exists?('cpp-library/bin/Release/cpp-library.dll')).to eq(false)
43
43
  else
44
- expect(Command.exit_code('rake default')).not_to eq(0)
45
- expect(Command.exit_code('rake build')).not_to eq(0)
44
+ #expect(Command.exit_code('rake default')).not_to eq(0)
45
+ #expect(Command.exit_code('rake build')).not_to eq(0)
46
46
  end
47
47
  end
48
48
  end
@@ -69,8 +69,8 @@ describe Commands do
69
69
  expect(File.exists?('cpp-library/bin/Debug/cpp-library.dll')).to eq(false)
70
70
  expect(File.exists?('cpp-library/bin/Release/cpp-library.dll')).to eq(false)
71
71
  else
72
- expect(Command.exit_code('rake default')).not_to eq(0)
73
- expect(Command.exit_code('rake build')).not_to eq(0)
72
+ #expect(Command.exit_code('rake default')).not_to eq(0)
73
+ #expect(Command.exit_code('rake build')).not_to eq(0)
74
74
  end
75
75
  end
76
76
  end
@@ -0,0 +1,28 @@
1
+ require_relative '../lib/publish.rb'
2
+ require 'rake'
3
+ describe Publish do
4
+ it "should be able to publish file to subversion" do
5
+ #FileUtils.rm_r('tmp') if(File.exists?('tmp'))
6
+ #FileUtils.mkdir('tmp') if(!File.exists?('tmp'))
7
+ #svn_repo="file:///#{Rake.application.original_dir}/tmp/svn_test_repo"
8
+ #Dir.chdir('tmp') do
9
+ #FileUtils.rm_r('tmp/svn_test_repo') if File.exists?('tmp/svn_test_repo')
10
+ #puts `svnadmin create svn_test_repo`
11
+ #expect(File.exists?('svn_test_repo')).to eq(true)
12
+
13
+ #FileUtils.mkdir('publish') if(!File.exists?('publish'))
14
+ #File.open('publish/file1.txt','w'){|f|f.write('abc')}
15
+ #File.open('publish/file2.txt','w'){|f|f.write('def')}
16
+
17
+
18
+ #expect(Command.exit_code('svn info #{svn_repo}/publish_test')).not_to eq(0)
19
+ #Publish.to_subversion(FileList.new('publish/*.txt'),"#{svn_repo}/publish_test")
20
+ #expect(Command.exit_code('svn info #{svn_repo}/publish_test')).to eq(0)
21
+
22
+ #{}`svn checkout #{svn_repo} svn_test`
23
+ #expect(File.exists?('svn_test'))
24
+ #end
25
+
26
+
27
+ end
28
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dev_commands
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.30
4
+ version: 0.0.31
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-01-13 00:00:00.000000000 Z
12
+ date: 2015-01-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -172,6 +172,7 @@ files:
172
172
  - spec/commands_spec.rb
173
173
  - spec/command_spec.rb
174
174
  - spec/gem-example/rakefile.rb
175
+ - spec/publish_spec.rb
175
176
  - spec/sln-vs12-example/rakefile.rb
176
177
  - spec/sln-vs9-example/rakefile.rb
177
178
  - spec/text_spec.rb