Skip to content

Instantly share code, notes, and snippets.

@vcostin
Created April 30, 2015 09:10
Show Gist options
  • Save vcostin/316145158428479279ac to your computer and use it in GitHub Desktop.
Save vcostin/316145158428479279ac to your computer and use it in GitHub Desktop.
openproject plugin file generator
#!/usr/bin/ruby
# url_content_iterate.rb
require 'open-uri'
#https://gist.github.com/myabc/7905820e99914c2acdf8#file-list-of-plugins
REMOTE_URL = 'https://gist.githubusercontent.com/myabc/7905820e99914c2acdf8/raw/4b0f8da8ff8462c824f155b1b3f04ed36ff8e661/List%20of%20plugins'
LOCAL_FILE = './plugin_list.txt'
LOCAL_PLUGIN_GENERATOR = 'plugin_generator.plugin'
PLUGIN_BRANCH = 'release/4.1'
# string template
plugin_file = "PLUGIN_BRANCH = '#{PLUGIN_BRANCH}' # your topic branch \n"
plugin_file += "\n"
plugin_file += "group :opf_plugins do \n"
open(REMOTE_URL, 'rb') do |read_file|
read_file.each_line do |line|
# puts line
line = line.delete("\n")
plugin_file +=" gem '#{line}', git: 'git@github.com:finnlabs/#{line}', branch: PLUGIN_BRANCH \n"
end
end
plugin_file += "end \n"
def write_string_to_file(file_name = LOCAL_PLUGIN_GENERATOR, string_content = '')
File.open(file_name, 'wb') do |plugin_generator_file|
plugin_generator_file.write(string_content)
end
end
write_string_to_file(LOCAL_PLUGIN_GENERATOR, plugin_file)
puts 'done'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment