fanforce-plugin-factory 2.0.0.rc9 → 2.0.0.rc10

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: 8e212a1da66f382e5fb89e0feb285414bd858bff
4
- data.tar.gz: 4485a106e8fe69b1f4f5556ef53f780ceea3e2e8
3
+ metadata.gz: 390d5af91387a7f3b02561397f8c262b42b03338
4
+ data.tar.gz: 4a8297cd4fbe497592481d49e3d2748670fa42e6
5
5
  SHA512:
6
- metadata.gz: 4246057f32d34e3a6a386a312967a2454a96a3be98b9104466456abc86c3fbe906cb4b9c9db4a166f4116475eadc168f57af8f552be3e9a971fdd3ed72f27b95
7
- data.tar.gz: 9ff0cd6d538b30dc7df4cc5c53d0e07726a26813056880df469ad832ca09499f22a2632696b780f7e747fea33f32d764118837bbe990705b50c8f2832826a8be
6
+ metadata.gz: 4257fe4a78ea785a3b18e5796aab274b93876bc558fd983cdb96536759c0b34fcbf01551c9b2d79bad2b1513f2a34ea1b0bb4c166e91d9301812dff446c5e8ad
7
+ data.tar.gz: c8aed09ba1e5330ec9fbac53783d0b7d1b44f50e04c68eeb89cf178ef7beef339202e88376a472500cb66c20d9432b5f662a7154e915b9df13a7dab15569b3f3
@@ -39,7 +39,7 @@ Gem::Specification.new do |gem|
39
39
 
40
40
  gem.add_runtime_dependency 'fanforce-base', '>= 2.0.0.rc2'
41
41
  gem.add_runtime_dependency 'fanforce-api', '>= 2.0.0.rc4'
42
- gem.add_runtime_dependency 'fanforce-plugin-worker', '>= 2.0.0.rc4'
42
+ gem.add_runtime_dependency 'fanforce-plugin-worker', '>= 2.0.0.rc6'
43
43
 
44
44
  gem.add_development_dependency 'fanforce-test', '>= 2.0.0.rc2'
45
45
  end
@@ -15,4 +15,5 @@ body { padding:0; font-size:12px;
15
15
  }
16
16
 
17
17
  }
18
- .btn { padding: 2px 10px; color: #666666; border-radius: 3px; font-size: 11.05px; background-color: #F5F5F5; @include ff-gradient(#FFFFFF, #E6E6E6); border-color: #CCCCCC #CCCCCC #B3B3B3; @include box-shadow(0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 1px 2px rgba(0, 0, 0, 0.05)); text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); }
18
+ .btn-primary { border-radius: 3px; background-color: #F5F5F5; @include ff-gradient(#FFFFFF, #E6E6E6); border-color: #CCCCCC #CCCCCC #B3B3B3; @include box-shadow(0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 1px 2px rgba(0, 0, 0, 0.05)); text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); }
19
+ //padding: 2px 10px; color: #666666; font-size: 11.05px;
@@ -1,7 +1,7 @@
1
1
  class Fanforce::PluginFactory::CLI::Iron
2
2
  include Fanforce::PluginFactory::CLI::Utils
3
3
 
4
- require_gem 'iron_worker_ng', 'iron_worker_ng'
4
+ require_gem 'iron_worker', 'iron_worker'
5
5
 
6
6
  attr_reader :plugin
7
7
 
@@ -9,44 +9,83 @@ class Fanforce::PluginFactory::CLI::Iron
9
9
  @plugin = plugin
10
10
  end
11
11
 
12
+ def workers_dir
13
+ "#{plugin.dir}/workers"
14
+ end
15
+
12
16
  def upload(environment, worker_filename=nil)
13
- if !File.directory?("#{plugin.dir}/workers")
14
- return log "#{'Skipped '.format(:bold)} no workers folder was found"
15
- end
17
+ return log "#{'Skipped '.format(:bold)} no workers folder was found" if !File.directory?(workers_dir)
16
18
 
19
+ worker_filename = worker_filename.gsub('.worker', '') if worker_filename
17
20
  env = Fanforce::PluginFactory::CLI::Env.new(plugin)
18
21
  vars = env.vars(environment) || {}
19
- factory_version = current_factory_version
22
+ #factory_version = current_factory_version
20
23
 
21
24
  return puts "#{'Skipped '.format(:bold)} #{environment.to_s.titleize} is missing IRON_TOKEN and/or IRON_PROJECT_ID env variables" if vars['IRON_TOKEN'].blank? or vars['IRON_PROJECT_ID'].blank?
22
25
 
23
- puts "#{'Updating Env'.format(:green,:bold)} #{environment.to_s.titleize}... and workers have #{vars.size} env variables"
24
- env.push_to(environment, vars, true)
26
+ # puts "#{'Updating Env'.format(:green,:bold)} #{environment.to_s.titleize}... and workers have #{vars.size} env variables"
27
+ # env.push_to(environment, vars, true)
25
28
 
26
- iron_worker = IronWorkerNG::Client.new(:token => vars['IRON_TOKEN'], :project_id => vars['IRON_PROJECT_ID'])
27
- Dir.chdir("#{plugin.dir}/workers") do
28
- workers = Dir['*.worker']
29
+ iron_worker = IronWorker::Client.new(:token => vars['IRON_TOKEN'], :project_id => vars['IRON_PROJECT_ID'])
30
+ Dir.chdir(workers_dir) do
31
+ workers = Dir['*.rb']
29
32
  return puts "#{'Skipped '.format(:bold)} #{environment.to_s.titleize} has 0 workers" if workers.size == 0
30
33
 
31
34
  upload_processes = []
32
35
  workers.each do |filename|
33
36
  next if worker_filename and !filename.include?(worker_filename)
34
- code_name = filename.gsub('.worker', '')
35
-
36
- puts "#{'Uploading'.format(:green,:bold)} #{filename.gsub('.worker', '')} to #{environment.to_s.titleize}..."
37
-
38
- code = IronWorkerNG::Code::Base.new(:workerfile => "#{plugin.dir}/workers/#{filename}")
39
- code.gem('fanforce-plugin-factory', factory_version)
40
- code.remote
41
- code.name = code_name
42
- code.file("#{plugin.dir}/workers/.env/#{environment}.rb", '.env')
43
37
 
44
- upload_processes << upload_iron_worker(iron_worker, code, filename, environment)
38
+ compile_worker(filename, environment)
45
39
  end
46
40
  upload_processes.each { |pid| Process.waitpid(pid) }
47
41
  end
48
42
  end
49
43
 
44
+ def compile_worker(filename, environment)
45
+ puts "#{'Compiling'.format(:green,:bold)} #{filename.gsub('.rb', '')} to #{environment.to_s.titleize}..."
46
+ code_name = filename.gsub('.rb', '')
47
+ absolute_dir = "#{workers_dir}/#{code_name}"
48
+ relative_dir = "workers/#{code_name}"
49
+
50
+ if !File.directory?(absolute_dir)
51
+ puts "Creating #{relative_dir}/"
52
+ Dir.mkdir(absolute_dir)
53
+ end
54
+
55
+ if File.exists?("#{plugin.dir}/Gemfile") and !File.exists?("#{absolute_dir}/Gemfile")
56
+ puts "Copying /Gemfile to #{relative_dir}/Gemfile"
57
+ contents = File.read("#{plugin.dir}/Gemfile").gsub("ruby '2.1.6'", "ruby '2.1.4'")
58
+ File.open("#{absolute_dir}/Gemfile", 'w') {|f| f.write(contents) }
59
+ end
60
+
61
+ if File.directory?("#{plugin.dir}/lib") and !File.directory?("#{absolute_dir}/lib")
62
+ puts "Copying /lib/ to #{relative_dir}/lib/"
63
+ FileUtils.copy_entry("#{plugin.dir}/lib", "#{absolute_dir}/lib")
64
+ end
65
+
66
+ if File.directory?("#{plugin.dir}/mailers") and !File.directory?("#{absolute_dir}/mailers")
67
+ puts "Copying /mailers/ to #{relative_dir}/mailers/"
68
+ FileUtils.copy_entry("#{plugin.dir}/mailers", "#{absolute_dir}/mailers")
69
+ end
70
+
71
+ puts "Dockerizing #{File.expand_path(absolute_dir)}"
72
+ puts `docker run --rm -v "#{File.expand_path(absolute_dir)}":/worker -w /worker iron/images:ruby-2.1 sh -c 'bundle install --standalone'`
73
+
74
+ end
75
+
76
+ def upload_worker(filename)
77
+ # code_name = filename.gsub('.rb', '')
78
+ # puts "#{'Uploading'.format(:green,:bold)} #{filename.gsub('.rb', '')} to #{environment.to_s.titleize}..."
79
+ #
80
+ # code = IronWorker::Code::Ruby.new(:workerfile => "#{plugin.dir}/workers/#{filename}")
81
+ # code.gem('fanforce-plugin-factory', factory_version)
82
+ # code.remote
83
+ # code.name = code_name
84
+ # code.file("#{plugin.dir}/workers/.env/#{environment}.rb", '.env')
85
+ #
86
+ # upload_processes << upload_iron_worker(iron_worker, code, filename, environment)
87
+ end
88
+
50
89
  def current_factory_version
51
90
  `bundle list`.lines.each do |line|
52
91
  return $1 if line =~ /fanforce-plugin-factory \(([A-Za-z0-9.-]+)\)/
@@ -41,6 +41,10 @@ class Fanforce::PluginFactory::CLI::Scripts
41
41
  end
42
42
  end
43
43
 
44
+ def expand_path(path)
45
+ File.expand_path(path)
46
+ end
47
+
44
48
  def update_factory
45
49
  require_gem 'rest-client', 'rest_client'
46
50
  require_gem 'multi_json', 'multi_json'
@@ -51,20 +55,22 @@ class Fanforce::PluginFactory::CLI::Scripts
51
55
  rubygems_version = MultiJson.load(response, symbolize_keys: true).first[:number]
52
56
  current_version = config[:plugin_factory_gem][:version].match(/(\S+)\s*$/)[1] if config[:plugin_factory_gem][:version]
53
57
 
54
- local_path = '/Fanforce/gems/fanforce-plugin-factory'
55
- if File.directory?(local_path)
56
- silence_warnings do require "#{local_path}/lib/fanforce/plugin_factory/version" end
58
+ local_path = '~/Fanforce/gems/fanforce-plugin-factory'
59
+ if File.directory?(expand_path(local_path))
60
+ silence_warnings do require "#{expand_path(local_path)}/lib/fanforce/plugin_factory/version" end
57
61
  local_version = Fanforce::PluginFactory::VERSION
62
+ else
63
+ local_path = nil
58
64
  end
59
65
 
60
- if current_version and (rubygems_version != current_version or local_version)
66
+ # if current_version and (rubygems_version != current_version or local_version)
61
67
  i = 0
62
68
  options = {}
63
69
  log "\n\nWe found multiple gem versions. Select the one you want used:"
64
70
 
65
71
  if local_version or config[:plugin_factory_gem][:path]
66
72
  if config[:plugin_factory_gem][:path]
67
- log " #{i+=1}. #{local_version} (found in .fanforce-plugin-factory / locally)"
73
+ log " #{i+=1}. #{local_version || 'UNKNOWN VERSION'} (found in .fanforce-plugin-factory / locally)"
68
74
  else
69
75
  log " #{i+=1}. #{local_version} (found locally)"
70
76
  end
@@ -98,10 +104,10 @@ class Fanforce::PluginFactory::CLI::Scripts
98
104
  config[:plugin_factory_gem][:version] = version
99
105
  f.write config.to_yaml
100
106
  end
101
- else
102
- log 'DONE'
103
- version = rubygems_version
104
- end
107
+ # else
108
+ # log 'DONE'
109
+ # version = rubygems_version
110
+ # end
105
111
  log divider '---------------------------------------------------------------------------------------------------+'
106
112
 
107
113
 
@@ -116,10 +122,10 @@ class Fanforce::PluginFactory::CLI::Scripts
116
122
  def install_local_factory_gem(version, local_gem_path)
117
123
  return if !local_gem_path
118
124
  gem_filepath = nil
119
- Dir.chdir(local_gem_path) do
125
+ Dir.chdir(expand_path(local_gem_path)) do
120
126
  system 'git add -A'
121
127
  system 'rake build'
122
- Dir.glob("#{local_gem_path}/pkg/*.gem").each do |file|
128
+ Dir.glob("#{expand_path(local_gem_path)}/pkg/*.gem").each do |file|
123
129
  break gem_filepath = file if file.include?(version)
124
130
  end
125
131
  end
@@ -1,5 +1,5 @@
1
1
  class Fanforce
2
2
  class PluginFactory
3
- VERSION = '2.0.0.rc9'
3
+ VERSION = '2.0.0.rc10'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fanforce-plugin-factory
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.rc9
4
+ version: 2.0.0.rc10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Caleb Clark
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-01 00:00:00.000000000 Z
11
+ date: 2015-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -310,14 +310,14 @@ dependencies:
310
310
  requirements:
311
311
  - - ">="
312
312
  - !ruby/object:Gem::Version
313
- version: 2.0.0.rc4
313
+ version: 2.0.0.rc6
314
314
  type: :runtime
315
315
  prerelease: false
316
316
  version_requirements: !ruby/object:Gem::Requirement
317
317
  requirements:
318
318
  - - ">="
319
319
  - !ruby/object:Gem::Version
320
- version: 2.0.0.rc4
320
+ version: 2.0.0.rc6
321
321
  - !ruby/object:Gem::Dependency
322
322
  name: fanforce-test
323
323
  requirement: !ruby/object:Gem::Requirement