dev_projects 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 16bf584da3df3ff37f191411f8f6dc92d6faec05
4
- data.tar.gz: 5d6610128d23573aaaecd7978c5cb432164265c9
3
+ metadata.gz: 5f5686c2dbaa869b7ab40b4e29902e74611b514a
4
+ data.tar.gz: 648756526340ea2b1f6f1f65dfbd5bc7215a12e9
5
5
  SHA512:
6
- metadata.gz: ed0e03d6cf14ed2486d717709b4a24d83090d92b793987232c6ac29e91dca1d36956e66a3afce492c357325b8c92bb448c488b24586b679266f7ce91bbba1215
7
- data.tar.gz: 2b02e99109309bb7c55b580e85859151497442f39cf150924c2093f27f0c718351f88044d54ad11418447ca498bcce981f52e72930ab713382243cb9ce151d41
6
+ metadata.gz: 9089b2654a761abf1dc9ebc1ecaa459c7c3eeab8463c982e43d828ea98c2e06a1b165ed33631d9e35e3c8f2de26a1e44fb6c99b13bb38dd9c06d999f3f0e89ec
7
+ data.tar.gz: 31af7f16c341b1e10507162dadf83ee9ef658eab6ec32ecf986d19ebd68af09ea1707df2df7c432db307b760d914a0dc1396afbf34c796b01802dfb5c037de84
data/lib/dev_projects.rb CHANGED
@@ -3,4 +3,8 @@ require_relative 'projects.rb'
3
3
  require_relative 'project.rb'
4
4
 
5
5
  PROJECTS=Projects.new
6
- PROJECTS.open Projects.user_projects_filename if File.exists? Projects.user_projects_filename
6
+ PROJECTS.open Projects.user_projects_filename if File.exists? Projects.user_projects_filename
7
+ PROJECTS.save Projects.user_projects_filename if !File.exists? Projects.user_projects_filename
8
+
9
+ class DevProjects
10
+ end
data/lib/project.rb CHANGED
@@ -11,11 +11,14 @@ attr_accessor :filename
11
11
  end
12
12
  end
13
13
 
14
+ def name
15
+ self[:name]
16
+ end
17
+
14
18
  def get_latest_unique_id
15
19
  '51ed9c9d45ba3979c808740d75ba1831c85aff5d'
16
20
  end
17
21
 
18
- def save
19
- File.open(@filename,'w'){|f|f.write(self.to_json)} if @filename.length > 0
20
- end
21
- end
22
+
23
+ end
24
+
data/lib/projects.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require 'dev_environment'
2
+ require 'dev_git'
2
3
  require 'json'
4
+ require 'rake'
3
5
 
4
6
  class Projects < Hash
5
7
  attr_accessor :filename
@@ -31,4 +33,23 @@ class Projects < Hash
31
33
  FileUtils.mkdir("#{Environment.dev_root}/data") if(!File.exists?("#{Environment.dev_root}/data"))
32
34
  "#{Environment.dev_root}/data/PROJECTS.json"
33
35
  end
36
+
37
+ def self.current
38
+ project=nil
39
+ if(File.exists?('.git'))
40
+ if(Rake.application.original_dir.include?('/wrk/') &&
41
+ Git.remote_origin.length > 0)
42
+ project=Project.new(Git.remote_origin)
43
+ name=Rake.application.original_dir.gsub("#{Environment.dev_root}/wrk/",'')
44
+ if(defined?(PROJECTS))
45
+ PROJECTS[name]=project if(!PROJECTS.has_key?(name))
46
+ project.each{|k,v|PROJECTS[name][k]=v}
47
+ PROJECTS.save
48
+ else
49
+ project[:name]=name
50
+ end
51
+ end
52
+ end
53
+ project
54
+ end
34
55
  end
@@ -0,0 +1,7 @@
1
+ require_relative '../lib/dev_projects.rb'
2
+
3
+ describe DevProjects do
4
+ it "should create a data/PROJECTS.json" do
5
+ expect(File.exists?("#{Environment.dev_root}/data/PROJECTS.json")).to eq(true)
6
+ end
7
+ end
data/spec/project_spec.rb CHANGED
@@ -15,4 +15,6 @@ describe Project do
15
15
  unique_id = project.get_latest_unique_id
16
16
  expect(unique_id.length).to eq(40)
17
17
  end
18
+
19
+
18
20
  end
@@ -25,4 +25,8 @@ describe Projects do
25
25
  expect(projects2['github/dev_projects.gem'].is_a?(Project)).to eq(true)
26
26
  FileUtils.rm('tmp/test.project.json') if(File.exists?('tmp/test.project.json'))
27
27
  end
28
+
29
+ it "should be able to get the current Project" do
30
+ expect(Projects.current).not_to eq(nil)
31
+ end
28
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dev_projects
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lou Parslow
@@ -24,6 +24,34 @@ dependencies:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: dev_git
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: dev_environment
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: rspec
29
57
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +66,34 @@ dependencies:
38
66
  - - '>='
39
67
  - !ruby/object:Gem::Version
40
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: dev_git
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: dev_environment
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
41
97
  description: management of development projects
42
98
  email: lou.parslow@gmail.com
43
99
  executables: []
@@ -49,6 +105,7 @@ files:
49
105
  - lib/project.rb
50
106
  - lib/projects.rb
51
107
  - spec/build_spec.rb
108
+ - spec/dev_projects_spec.rb
52
109
  - spec/project_spec.rb
53
110
  - spec/projects_spec.rb
54
111
  - LICENSE
@@ -73,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
130
  version: '0'
74
131
  requirements: []
75
132
  rubyforge_project:
76
- rubygems_version: 2.0.3
133
+ rubygems_version: 2.0.14
77
134
  signing_key:
78
135
  specification_version: 4
79
136
  summary: gem to manage development projects