onboard 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OTgwMzQzNzYzZTdkM2I4Zjg5OWNlYjIyY2VmMmVkZTQ1ODhhYmJkMA==
4
+ ZTYzNmVlZDFjMDRmZWViZGVmYzllMTM3MjAzMGZkNjU4NjYwNjc5OA==
5
5
  data.tar.gz: !binary |-
6
- MDcyODg3MzM0NjAzMDNiY2Q0YTYzYTY3ZmZlNzM4NjkwZDBlMDg2ZQ==
6
+ YTQwZTBhYmRlZDc2MzRlYmVlZjliY2JiMzI0ZDY3NDY5MTM1M2RmOA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NzY4YjJiYjQxZTVkMTA0ZDY0YWNlOTQyMDFmOTFhOWQwMmIxYTYwYWVhODY2
10
- ZWY5ZTY5Yjg4YmJhOGZhMDVmOWI0ZDQwMTkyYzQ0YmRjMTdiNzVhNjcxYWU2
11
- ZWJhODJiYmVlN2ViYzUxYTVhZDY3MGNhZjA3Y2JkY2Y1ZTJmZWQ=
9
+ MTlhMDY5YTc4YTc2MjJmMTJlYzAzMTkwOGVmZTFlOWM0NTEwM2JiN2ViM2E5
10
+ NzhkMzMwYjcyZWYwOGU4ZjRjM2IyZGFjZjFmMDkwYmZmMGVhNTc5MzJkNjg4
11
+ ODllNTVlNjI5ODkyMzk2MDcxNjFiZGU3ZDdkODY1MzQ3ZGQzYzQ=
12
12
  data.tar.gz: !binary |-
13
- Y2M3NmI2Zjg1MzA2MGM2YThlOGZhZDNkMjlhNmRkZmU0OTMwYjIzZGRhZmJh
14
- ZjBkMWQ5NThkNTJiMDY5MmJlYmM2MDBmNDhhN2M2MmQ0MjE3NWUyZjM2MDQ0
15
- ZDkwOTc1OGRlNzg3ODA2ZDNkNjNhMDM4OGFmNDFiY2FjOGU2YWU=
13
+ YTllNDkwOTE1ZjJkZmExYzc0NGQyYWIxYWQ0MjM4MThlYTFjMGQ2MTFhZjBj
14
+ Y2MwMzYwY2EwM2I5MzAyNzNlZmU0ZGZlOTRjMjc2ZWMwM2Q2NjIzM2VmNzM2
15
+ NjUyNjI4MjVmZmJjMDUzZTE2NDViMmQ4YWNiM2Y5NTUwODYwOWI=
data/lib/onboard/cli.rb CHANGED
@@ -47,7 +47,7 @@ module Onboard
47
47
  say("Projects exist at the following locations:", :yellow)
48
48
  found.each do |x, y|
49
49
  puts " " + x
50
- projects[File.basename(x)] = y
50
+ projects[File.basename(x)] = y[0]
51
51
  end
52
52
  puts ""
53
53
  end
@@ -71,24 +71,14 @@ module Onboard
71
71
  exit
72
72
  end
73
73
  prj = {}
74
+ branch = options[:branch].nil? ? '' : options[:branch]
75
+ prj['branch'] = branch
74
76
  prj['codebase'] = codebase
75
- prj['path'] = "#{codebase}/#{path}"
76
- prj['projects'] = projects
77
77
  prj['core'] = core
78
+ prj['path'] = path
79
+ prj['projects'] = projects
80
+ prj['vc'] = options[:vc]
78
81
  Project.new(prj).dl
79
- if options[:vc] == true
80
- branch = options[:branch].nil? ? '' : options[:branch]
81
- repo = {}
82
- repo['branch'] = branch
83
- repo['codebase'] = codebase
84
- repo['projects'] = projects
85
- repo['path'] = path
86
- Repo.new(repo).update
87
- else
88
- projects.each do |x, y|
89
- say("#{x} added to codebase but changes are not yet tracked in version control.", :yellow)
90
- end
91
- end
92
82
  else
93
83
  say("All projects already in codebase.", :yellow)
94
84
  end
@@ -9,6 +9,7 @@ require 'zlib'
9
9
 
10
10
  require_relative 'confirm'
11
11
  require_relative 'download'
12
+ require_relative 'msg'
12
13
  require_relative 'repo'
13
14
 
14
15
  module Onboard
@@ -18,14 +19,17 @@ module Onboard
18
19
  DRUPAL_DL_LINK = "http://ftp.drupal.org/files/projects/"
19
20
 
20
21
  class Project < Thor
21
- attr_reader :core, :path, :projects, :codebase
22
+ attr_reader :branch, :codebase, :core, :path, :projects, :vc
22
23
 
23
24
  no_tasks do
24
25
  def initialize(args = {})
26
+ @branch = args['branch']
27
+ @codebase = args['codebase']
25
28
  @core = args['core']
26
- @path = args['path']
29
+ @path = "#{args['codebase']}/#{args['path']}"
27
30
  @projects = args['projects']
28
- @codebase = args['codebase']
31
+ @vc = args['vc']
32
+ @vc_path = args['path']
29
33
  end
30
34
 
31
35
  def feed(project)
@@ -46,14 +50,59 @@ module Onboard
46
50
  end
47
51
 
48
52
  def dl
53
+ changes = []
49
54
  projects.each do |x, y|
50
- self.hacked?(x, y[0]) if y.empty? == false
55
+ self.hacked?(x, y) if y.empty? == false
51
56
  self.clean("#{path}/#{x}")
57
+ # TODO: check existing version against release version - abort if same.
52
58
  md5, link = self.release(x)
53
59
  Download.new.fetch(link)
54
- self.extract(Download.new.path(link)) if self.verify(x, link)
55
60
  # TODO: retry download after failed download verification
61
+ self.extract(Download.new.path(link)) if self.verify(x, link)
62
+ if vc == true
63
+ repo = self.build_vc(x)
64
+ changes += self.vc_up(repo)
65
+ else
66
+ say("#{x} added to codebase but changes are not yet under version control.", :yellow)
67
+ end
68
+ end
69
+ if changes.empty? == false
70
+ repo = self.build_vc()
71
+ self.vc_push(repo)
72
+ end
73
+ end
74
+
75
+ def build_vc(x = '')
76
+ repo = {}
77
+ repo['codebase'] = codebase
78
+ repo['path'] = @vc_path
79
+ repo['branch'] = branch
80
+ repo['project'] = x
81
+ return repo
82
+ end
83
+
84
+ def vc_up(args)
85
+ g = Repo.new(args)
86
+ info = g.info
87
+ changes = []
88
+ msg = "Committing #{args['project']} on #{info['current_branch']} branch..."
89
+ Msg.new(msg).format
90
+ changes = g.commit("#{args['path']}/#{args['project']}")
91
+ if changes.empty? == false
92
+ say(" [done]", :green)
93
+ else
94
+ puts "\nNo changes to commit for #{args['project']}"
56
95
  end
96
+ return changes
97
+ end
98
+
99
+ def vc_push(args)
100
+ g = Repo.new(args)
101
+ info = g.info
102
+ msg = "Pushing all changes to #{info['remotes'][0]}..."
103
+ Msg.new(msg).format
104
+ g.push
105
+ say(" [done]", :green)
57
106
  end
58
107
 
59
108
  def verify(x, file, version='')
data/lib/onboard/repo.rb CHANGED
@@ -4,8 +4,6 @@ require 'git'
4
4
  require 'pathname'
5
5
  require 'thor'
6
6
 
7
- require_relative 'msg'
8
-
9
7
  module Onboard
10
8
  class Repo < Thor
11
9
  attr_reader :g, :path, :branch, :codebase, :projects
@@ -63,27 +61,6 @@ module Onboard
63
61
  Git.open((Pathname.new(args['codebase'])).to_s)
64
62
  end
65
63
 
66
- def update
67
- info = self.info
68
- changes = []
69
- projects.each do |x, y|
70
- msg = "Committing #{x} on #{info['current_branch']} branch..."
71
- Msg.new(msg).format
72
- changes = self.commit("#{path}/#{x}")
73
- if changes.empty? == false
74
- say(" [done]", :green)
75
- else
76
- puts "\nNo changes to commit for #{x}"
77
- end
78
- end
79
- if changes.empty? == false
80
- msg = "Pushing all changes to #{info['remotes'][0]}..."
81
- Msg.new(msg).format
82
- self.push
83
- say(" [done]", :green)
84
- end
85
- end
86
-
87
64
  def commit(path)
88
65
  project = File.basename(path)
89
66
 
@@ -1,3 +1,3 @@
1
1
  module Onboard
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onboard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathaniel Hoag
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-03 00:00:00.000000000 Z
11
+ date: 2014-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri